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

Method CreateNode

common/nodes/put/handler-put.go:134–150  ·  view source on GitHub ↗

CreateNode recursively creates parents if they do not already exist Only applicable to COLLECTION inside a structured storage (need to create .pydio hidden files)

(ctx context.Context, in *tree.CreateNodeRequest, opts ...grpc.CallOption)

Source from the content-addressed store, hash-verified

132// CreateNode recursively creates parents if they do not already exist
133// Only applicable to COLLECTION inside a structured storage (need to create .pydio hidden files)
134func (m *Handler) CreateNode(ctx context.Context, in *tree.CreateNodeRequest, opts ...grpc.CallOption) (*tree.CreateNodeResponse, error) {
135 if info, er := nodes.GetBranchInfo(ctx, "in"); er == nil && (info.FlatStorage || info.Binary || info.IsInternal()) || in.Node.IsLeaf() {
136 resp, err := m.Next.CreateNode(ctx, in, opts...)
137 if err != nil || !nodes.IsFlatStorage(ctx, "in") {
138 return resp, err
139 }
140 // Handle input metadata, unless specified (typically when creating resources at Move)
141 if !nodes.HasSkipDefaultMeta(ctx) {
142 _, err = m.getMetaClient().ExtractAndPut(ctx, resp.GetNode(), nodes.GetContextWorkspaceOrNil(ctx, "in"), in.GetNode().GetMetaStore(), meta.ExtractNodeMetadata)
143 }
144 return resp, err
145 }
146 if e := m.createParentIfNotExist(ctx, in.GetNode().Clone(), in.GetIndexationSession()); e != nil {
147 return nil, e
148 }
149 return m.Next.CreateNode(ctx, in, opts...)
150}
151
152// PutObject eventually creates an index N, captures body to extract Mime Type and compute custom Hash
153func (m *Handler) PutObject(ctx context.Context, node *tree.Node, reader io.Reader, requestData *models.PutRequestData) (models.ObjectInfo, error) {

Callers

nothing calls this directly

Calls 14

getMetaClientMethod · 0.95
GetBranchInfoFunction · 0.92
IsFlatStorageFunction · 0.92
HasSkipDefaultMetaFunction · 0.92
GetContextWorkspaceOrNilFunction · 0.92
IsLeafMethod · 0.65
CreateNodeMethod · 0.65
ExtractAndPutMethod · 0.65
GetNodeMethod · 0.65
GetMetaStoreMethod · 0.65
CloneMethod · 0.65

Tested by

no test coverage detected