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

Method GatewayRights

pkg/auth/rights/cache.go:238–256  ·  view source on GitHub ↗
(ctx context.Context, gtwID *ttnpb.GatewayIdentifiers)

Source from the content-addressed store, hash-verified

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) }()
240 req := newEntityReq(ctx, gtwID.GetEntityIdentifiers())
241 f.mu.Lock()
242 res := f.gatewayRights[req]
243 if !res.valid(f.successTTL, f.errorTTL) {
244 res = newRes()
245 f.gatewayRights[req] = res
246 go func() {
247 res.set(f.Fetcher.GatewayRights(ctx, gtwID))
248 }()
249 }
250 f.maybeCleanup()
251 f.mu.Unlock()
252 if err := res.wait(ctx); err != nil {
253 return nil, err
254 }
255 return res.rights, res.err
256}
257
258func (f *inMemoryCache) OrganizationRights(ctx context.Context, orgID *ttnpb.OrganizationIdentifiers) (rights *ttnpb.Rights, err error) {
259 defer func() { registerRightsRequest(ctx, "organization", 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
GatewayRightsMethod · 0.65
validMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected