(ctx context.Context, in *tree.DeleteNodeRequest, opts ...grpc.CallOption)
| 121 | } |
| 122 | |
| 123 | func (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 | |
| 150 | func (e *Executor) GetObject(ctx context.Context, node *tree.Node, requestData *models.GetRequestData) (io.ReadCloser, error) { |
| 151 | // Init logger now |
nothing calls this directly
no test coverage detected