MCPcopy Create free account
hub / github.com/aptly-dev/aptly / RenameFile

Method RenameFile

gcs/public.go:341–360  ·  view source on GitHub ↗

RenameFile renames (moves) file.

(oldName, newName string)

Source from the content-addressed store, hash-verified

339
340// RenameFile renames (moves) file.
341func (g *PublishedStorage) RenameFile(oldName, newName string) error {
342 src := g.objectHandle(oldName)
343 dst := g.objectHandle(newName)
344
345 if g.debug {
346 log.Debug().Msgf("GCS: RenameFile %s -> %s", oldName, newName)
347 }
348
349 _, err := dst.CopierFrom(src).Run(context.TODO())
350 if err != nil {
351 return fmt.Errorf("error copying %s -> %s in %s: %s", oldName, newName, g, err)
352 }
353
354 err = g.applyACL(dst)
355 if err != nil {
356 return err
357 }
358
359 return g.Remove(oldName)
360}
361
362// SymLink creates a copy of src file and stores link information in metadata.
363func (g *PublishedStorage) SymLink(src string, dst string) error {

Callers 1

TestDebugModeMethod · 0.95

Calls 4

objectHandleMethod · 0.95
applyACLMethod · 0.95
RemoveMethod · 0.95
RunMethod · 0.80

Tested by 1

TestDebugModeMethod · 0.76