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

Function getPostNodeChangeClient

common/nodes/core/handler-exec-struct.go:151–171  ·  view source on GitHub ↗

getPostNodeChangeClient finds or creates a new streamer to public PostNodeChanges events. If refresh is set, it will delete any previous instance and create a new one.

(ctx context.Context, serviceName string, refresh bool)

Source from the content-addressed store, hash-verified

149// getPostNodeChangeClient finds or creates a new streamer to public PostNodeChanges events.
150// If refresh is set, it will delete any previous instance and create a new one.
151func getPostNodeChangeClient(ctx context.Context, serviceName string, refresh bool) (tree.NodeChangesReceiverStreamer_PostNodeChangesClient, error) {
152 if pncClients == nil {
153 pncClients = make(map[string]tree.NodeChangesReceiverStreamer_PostNodeChangesClient)
154 pncLocks = &sync.Mutex{}
155 }
156 pncLocks.Lock()
157 defer pncLocks.Unlock()
158 if refresh {
159 delete(pncClients, serviceName)
160 }
161 if c, o := pncClients[serviceName]; o {
162 return c, nil
163 }
164 cl := tree.NewNodeChangesReceiverStreamerClient(grpc2.ResolveConn(ctx, common.ServiceDataSyncGRPC_+serviceName))
165 c, e := cl.PostNodeChanges(runtimecontext.ForkedBackgroundWithMeta(ctx))
166 if e != nil {
167 return nil, e
168 }
169 pncClients[serviceName] = c
170 return c, nil
171}
172
173func (f *StructStorageHandler) publish(ctx context.Context, identifier string, eventType tree.NodeChangeEvent_EventType, node *tree.Node) {
174 bi, er := nodes.GetBranchInfo(ctx, identifier)

Callers 1

publishMethod · 0.85

Calls 5

PostNodeChangesMethod · 0.95
makeFunction · 0.85
LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…