(ctx context.Context, gtwID *ttnpb.GatewayIdentifiers)
| 236 | } |
| 237 | |
| 238 | func (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 | |
| 258 | func (f *inMemoryCache) OrganizationRights(ctx context.Context, orgID *ttnpb.OrganizationIdentifiers) (rights *ttnpb.Rights, err error) { |
| 259 | defer func() { registerRightsRequest(ctx, "organization", rights, err) }() |
nothing calls this directly
no test coverage detected