MCPcopy
hub / github.com/OpenListTeam/OpenList / copy

Method copy

drivers/halalcloud/driver.go:324–344  ·  view source on GitHub ↗
(ctx context.Context, obj model.Obj, dir model.Obj)

Source from the content-addressed store, hash-verified

322}
323
324func (d *HalalCloud) copy(ctx context.Context, obj model.Obj, dir model.Obj) (model.Obj, error) {
325 id := obj.GetID()
326 sourcePath := userfile.NewFormattedPath(d.GetCurrentDir(obj)).GetPath()
327 if len(id) > 0 {
328 sourcePath = ""
329 }
330 dest := &pubUserFile.File{
331 Identity: dir.GetID(),
332 Path: userfile.NewFormattedPath(d.GetCurrentDir(dir)).GetPath(),
333 }
334 _, err := pubUserFile.NewPubUserFileClient(d.HalalCommon.serv.GetGrpcConnection()).Copy(ctx, &pubUserFile.BatchOperationRequest{
335 Source: []*pubUserFile.File{
336 {
337 Path: sourcePath,
338 Identity: id,
339 },
340 },
341 Dest: dest,
342 })
343 return nil, err
344}
345
346func (d *HalalCloud) remove(ctx context.Context, obj model.Obj) error {
347 id := obj.GetID()

Callers 1

CopyMethod · 0.95

Calls 5

GetCurrentDirMethod · 0.95
GetGrpcConnectionMethod · 0.80
GetIDMethod · 0.65
GetPathMethod · 0.65
CopyMethod · 0.65

Tested by

no test coverage detected