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

Method ClientRights

pkg/auth/rights/cache.go:218–236  ·  view source on GitHub ↗
(ctx context.Context, clientID *ttnpb.ClientIdentifiers)

Source from the content-addressed store, hash-verified

216}
217
218func (f *inMemoryCache) ClientRights(ctx context.Context, clientID *ttnpb.ClientIdentifiers) (rights *ttnpb.Rights, err error) {
219 defer func() { registerRightsRequest(ctx, "client", rights, err) }()
220 req := newEntityReq(ctx, clientID.GetEntityIdentifiers())
221 f.mu.Lock()
222 res := f.clientRights[req]
223 if !res.valid(f.successTTL, f.errorTTL) {
224 res = newRes()
225 f.clientRights[req] = res
226 go func() {
227 res.set(f.Fetcher.ClientRights(ctx, clientID))
228 }()
229 }
230 f.maybeCleanup()
231 f.mu.Unlock()
232 if err := res.wait(ctx); err != nil {
233 return nil, err
234 }
235 return res.rights, res.err
236}
237
238func (f *inMemoryCache) GatewayRights(ctx context.Context, gtwID *ttnpb.GatewayIdentifiers) (rights *ttnpb.Rights, err error) {
239 defer func() { registerRightsRequest(ctx, "gateway", rights, err) }()

Callers

nothing calls this directly

Calls 9

maybeCleanupMethod · 0.95
registerRightsRequestFunction · 0.85
newEntityReqFunction · 0.85
newResFunction · 0.85
waitMethod · 0.80
GetEntityIdentifiersMethod · 0.65
ClientRightsMethod · 0.65
validMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected