MCPcopy Create free account
hub / github.com/pydio/cells / getCtxCache

Method getCtxCache

common/nodes/sync/handler-sync-cache.go:91–105  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

89}
90
91func (s *CacheHandler) getCtxCache(ctx context.Context) cache.Cache {
92 pkgOnce.Do(func() {
93 _, _ = broker.Subscribe(context.WithoutCancel(ctx), common.TopicTreeChanges, func(ctx context.Context, publication broker.Message) error {
94 event := &tree.NodeChangeEvent{}
95 var e error
96 if ctx, e = publication.Unmarshal(ctx, event); e == nil && !event.Optimistic {
97 if event.Type == tree.NodeChangeEvent_CREATE || event.Type == tree.NodeChangeEvent_UPDATE_PATH || event.Type == tree.NodeChangeEvent_DELETE {
98 s.cacheEvent(runtime.WithServiceName(ctx, nodes.ViewsLibraryName), event)
99 }
100 }
101 return nil
102 }, broker.WithCounterName("nodes-cache"))
103 })
104 return cache_helper.MustResolveCache(ctx, common.CacheTypeShared, syncCacheConfig)
105}
106
107func (s *CacheHandler) cacheEvent(ctx context.Context, event *tree.NodeChangeEvent) {
108 log.Logger(ctx).Debug("Event received", zap.Any("e", event))

Callers 5

cacheEventMethod · 0.95
cacheAddMethod · 0.95
cacheDelMethod · 0.95
cacheGetMethod · 0.95
cacheDiffMethod · 0.95

Calls 5

cacheEventMethod · 0.95
SubscribeFunction · 0.92
WithServiceNameFunction · 0.92
WithCounterNameFunction · 0.92
UnmarshalMethod · 0.65

Tested by

no test coverage detected