MCPcopy
hub / github.com/dgraph-io/dgraph / refreshAclCache

Function refreshAclCache

edgraph/access.go:316–340  ·  view source on GitHub ↗
(ctx context.Context, ns, refreshTs uint64)

Source from the content-addressed store, hash-verified

314}
315
316func refreshAclCache(ctx context.Context, ns, refreshTs uint64) error {
317 req := &Request{
318 req: &api.Request{
319 Query: queryAcls,
320 ReadOnly: true,
321 StartTs: refreshTs,
322 },
323 doAuth: NoAuthorize,
324 }
325
326 ctx = x.AttachNamespace(ctx, ns)
327 queryResp, err := (&Server{}).doQuery(ctx, req)
328 if err != nil {
329 return errors.Errorf("unable to retrieve acls: %v", err)
330 }
331 groups, err := acl.UnmarshalGroups(queryResp.GetJson(), "allAcls")
332 if err != nil {
333 return err
334 }
335
336 worker.AclCachePtr.Update(ns, groups)
337 glog.V(2).Infof("Updated the ACL cache for namespace: %#x", ns)
338 return nil
339
340}
341
342func RefreshACLs(ctx context.Context) {
343 for ns := range schema.State().Namespaces() {

Callers 2

RefreshACLsFunction · 0.85
SubscribeForAclUpdatesFunction · 0.85

Calls 6

AttachNamespaceFunction · 0.92
UnmarshalGroupsFunction · 0.92
doQueryMethod · 0.80
InfofMethod · 0.80
ErrorfMethod · 0.45
UpdateMethod · 0.45

Tested by

no test coverage detected