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

Method DeleteNode

common/nodes/core/handler-exec.go:123–148  ·  view source on GitHub ↗
(ctx context.Context, in *tree.DeleteNodeRequest, opts ...grpc.CallOption)

Source from the content-addressed store, hash-verified

121}
122
123func (e *Executor) DeleteNode(ctx context.Context, in *tree.DeleteNodeRequest, opts ...grpc.CallOption) (*tree.DeleteNodeResponse, error) {
124 info, er := nodes.GetBranchInfo(ctx, "in")
125 if er != nil {
126 return nil, er
127 }
128 writer := info.Client
129
130 log.Logger(ctx).Debug("Exec.DeleteNode", in.Node.Zap())
131
132 s3Path := e.buildS3Path(info, in.Node)
133 success := true
134 var err error
135 if _, sE := writer.StatObject(ctx, info.ObjectsBucket, s3Path, nil); sE != nil && sE.Error() == noSuchKeyString && in.Node.IsLeaf() && !in.Silent {
136 log.Logger(ctx).Warn("Exec.DeleteNode : cannot find object in s3! Should it be removed from index?", in.Node.ZapPath())
137 }
138
139 if session := in.IndexationSession; session != "" {
140 ctx = propagator.WithAdditionalMetadata(ctx, map[string]string{common.XPydioSessionUuid: session})
141 }
142 err = writer.RemoveObject(ctx, info.ObjectsBucket, s3Path)
143 if err != nil {
144 log.Logger(ctx).Error("Error while deleting in s3 "+s3Path, zap.Error(err))
145 success = false
146 }
147 return &tree.DeleteNodeResponse{Success: success}, err
148}
149
150func (e *Executor) GetObject(ctx context.Context, node *tree.Node, requestData *models.GetRequestData) (io.ReadCloser, error) {
151 // Init logger now

Callers

nothing calls this directly

Calls 12

buildS3PathMethod · 0.95
GetBranchInfoFunction · 0.92
LoggerFunction · 0.92
WithAdditionalMetadataFunction · 0.92
DebugMethod · 0.65
ZapMethod · 0.65
StatObjectMethod · 0.65
ErrorMethod · 0.65
IsLeafMethod · 0.65
WarnMethod · 0.65
ZapPathMethod · 0.65
RemoveObjectMethod · 0.65

Tested by

no test coverage detected