diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-02-14 08:32:42 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-02-14 08:34:04 -0700 |
commit | 0ebef9c0bbf183a267c5cf861833d8854b4b2e31 (patch) | |
tree | 2b025229ec9c14e3945c0cf1bfb00d63472559ab /db.go | |
parent | Add godoc badge. (diff) | |
download | dedo-0ebef9c0bbf183a267c5cf861833d8854b4b2e31.tar.gz dedo-0ebef9c0bbf183a267c5cf861833d8854b4b2e31.tar.xz |
Add examples.
Diffstat (limited to 'db.go')
-rw-r--r-- | db.go | 9 |
1 files changed, 2 insertions, 7 deletions
@@ -37,11 +37,6 @@ type DB struct { mmaplock sync.RWMutex // Protects mmap access during remapping. } -// NewDB creates a new DB instance. -func NewDB() *DB { - return &DB{} -} - // Path returns the path to currently open database file. func (db *DB) Path() string { return db.path @@ -460,8 +455,8 @@ func (db *DB) Copy(w io.Writer) error { // 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. -func (db *DB) CopyFile(path string) error { - f, err := os.Create(path) +func (db *DB) CopyFile(path string, mode os.FileMode) error { + f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, mode) if err != nil { return err } |