diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-02-14 08:35:31 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-02-14 08:35:31 -0700 |
commit | af5b9182f1009af018b60cd19eb7ee19cfda995f (patch) | |
tree | 2b025229ec9c14e3945c0cf1bfb00d63472559ab /db.go | |
parent | Add godoc badge. (diff) | |
parent | Add examples. (diff) | |
download | dedo-af5b9182f1009af018b60cd19eb7ee19cfda995f.tar.gz dedo-af5b9182f1009af018b60cd19eb7ee19cfda995f.tar.xz |
Merge pull request #30 from benbjohnson/examples
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 } |