aboutsummaryrefslogtreecommitdiff
path: root/db.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-02-14 08:35:31 -0700
committerBen Johnson <benbjohnson@yahoo.com>2014-02-14 08:35:31 -0700
commitaf5b9182f1009af018b60cd19eb7ee19cfda995f (patch)
tree2b025229ec9c14e3945c0cf1bfb00d63472559ab /db.go
parentAdd godoc badge. (diff)
parentAdd examples. (diff)
downloaddedo-af5b9182f1009af018b60cd19eb7ee19cfda995f.tar.gz
dedo-af5b9182f1009af018b60cd19eb7ee19cfda995f.tar.xz
Merge pull request #30 from benbjohnson/examples
Examples
Diffstat (limited to 'db.go')
-rw-r--r--db.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/db.go b/db.go
index 88c3065..bb9bbf6 100644
--- a/db.go
+++ b/db.go
@@ -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
}