(ctx context.Context, clientID *ttnpb.ClientIdentifiers)
| 216 | } |
| 217 | |
| 218 | func (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 | |
| 238 | func (f *inMemoryCache) GatewayRights(ctx context.Context, gtwID *ttnpb.GatewayIdentifiers) (rights *ttnpb.Rights, err error) { |
| 239 | defer func() { registerRightsRequest(ctx, "gateway", rights, err) }() |
nothing calls this directly
no test coverage detected