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

Method ReadNode

common/nodes/sync/handler-sync-cache.go:315–339  ·  view source on GitHub ↗
(ctx context.Context, in *tree.ReadNodeRequest, opts ...grpc.CallOption)

Source from the content-addressed store, hash-verified

313}
314
315func (s *CacheHandler) ReadNode(ctx context.Context, in *tree.ReadNodeRequest, opts ...grpc.CallOption) (*tree.ReadNodeResponse, error) {
316 resp, e := s.Next.ReadNode(ctx, in, opts...)
317 if nodes.IsFlatStorage(ctx, "in") {
318 return resp, e
319 }
320 notFound := e != nil && errors.Is(e, errors.StatusNotFound)
321 tempo := e == nil && resp.Node.GetEtag() == "temporary"
322 out, isCached := s.cacheGet(ctx, in.Node.GetPath())
323 if e == nil && resp.Node != nil {
324 // Check it was not recently removed
325 if parentDiff, ok := s.cacheDiff(ctx, path.Dir(in.Node.GetPath())); ok {
326 if _, o := parentDiff.Deletes[in.Node.GetPath()]; o {
327 return nil, errors.WithMessage(errors.NodeNotFound, "NotFound in cache")
328 }
329 }
330 }
331 if isCached && (notFound || tempo) {
332 return &tree.ReadNodeResponse{
333 Node: out,
334 Success: true,
335 }, nil
336 }
337
338 return resp, e
339}

Callers

nothing calls this directly

Calls 7

cacheGetMethod · 0.95
cacheDiffMethod · 0.95
IsFlatStorageFunction · 0.92
ReadNodeMethod · 0.65
IsMethod · 0.65
GetEtagMethod · 0.65
GetPathMethod · 0.65

Tested by

no test coverage detected