MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / SetProto

Function SetProto

pkg/redis/redis.go:249–256  ·  view source on GitHub ↗

SetProto marshals protocol buffer message represented by pb and stores it under key k in r. Note, that SetProto passes k verbatim to the underlying store and hence, k must represent the full key(including namespace etc.).

(ctx context.Context, r redis.Cmdable, k string, pb proto.Message, expiration time.Duration)

Source from the content-addressed store, hash-verified

247// SetProto marshals protocol buffer message represented by pb and stores it under key k in r.
248// Note, that SetProto passes k verbatim to the underlying store and hence, k must represent the full key(including namespace etc.).
249func SetProto(ctx context.Context, r redis.Cmdable, k string, pb proto.Message, expiration time.Duration) (*redis.StatusCmd, error) {
250 s, err := MarshalProto(pb)
251 if err != nil {
252 return nil, err
253 }
254 trace.Logf(ctx, "redis", "set proto to %q", k)
255 return r.Set(ctx, k, s, expiration), nil
256}
257
258// FindProto finds the protocol buffer stored under the key stored under k.
259// The external key is constructed using keyCmd.

Callers

nothing calls this directly

Calls 2

MarshalProtoFunction · 0.85
SetMethod · 0.65

Tested by

no test coverage detected