MCPcopy
hub / github.com/etcd-io/bbolt / CopyFile

Method CopyFile

tx.go:486–498  ·  view source on GitHub ↗

CopyFile copies the entire database to file at the given path. A reader transaction is maintained during the copy so it is safe to continue using the database while a copy is in progress.

(path string, mode os.FileMode)

Source from the content-addressed store, hash-verified

484// A reader transaction is maintained during the copy so it is safe to continue
485// using the database while a copy is in progress.
486func (tx *Tx) CopyFile(path string, mode os.FileMode) error {
487 f, err := tx.db.openFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, mode)
488 if err != nil {
489 return err
490 }
491
492 _, err = tx.WriteTo(f)
493 if err != nil {
494 _ = f.Close()
495 return err
496 }
497 return f.Close()
498}
499
500// allocate returns a contiguous block of memory starting at a given page.
501func (tx *Tx) allocate(count int) (*common.Page, error) {

Callers 6

TestTx_CopyFileFunction · 0.80
ExampleTx_CopyFileFunction · 0.80
MustCheckMethod · 0.80
CopyTempFileMethod · 0.80

Calls 2

WriteToMethod · 0.95
CloseMethod · 0.45

Tested by 4

TestTx_CopyFileFunction · 0.64
ExampleTx_CopyFileFunction · 0.64