diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dedo.go | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/dedo.go b/src/dedo.go index b81b55b..3feaf56 100644 --- a/src/dedo.go +++ b/src/dedo.go @@ -174,10 +174,6 @@ type panicked struct { reason interface{} } -// Options represents the options that can be set when opening a database. -type Options struct { -} - // Stats represents statistics about the database. type Stats struct { // Freelist stats @@ -624,7 +620,7 @@ func fdatasync(db *DB) error { // flock acquires an advisory lock on a file descriptor. -func flock(db *DB, mode os.FileMode) error { +func flock(db *DB) error { const exclusive = true // FIXME: allow multiple processes to cooperate for { @@ -1800,16 +1796,12 @@ func openFile(path string) (*os.File, error) { // Open creates and opens a database at the given path. // If the file does not exist then it will be created automatically. // Passing in nil options will cause Bolt to open the database with the default options. -func Open(path string, mode os.FileMode, options *Options) (*DB, error) { +func Open(path string) (*DB, error) { var db = &DB{ opened: true, path: path, } - if options == nil { - options = &Options{} - } - // Set default values for later DB operations. db.MaxBatchSize = DefaultMaxBatchSize db.MaxBatchDelay = DefaultMaxBatchDelay @@ -1829,7 +1821,7 @@ func Open(path string, mode os.FileMode, options *Options) (*DB, error) { // if !options.ReadOnly. // The database file is locked using the shared lock (more than one process may // hold a lock at the same time) otherwise (options.ReadOnly is set). - if err := flock(db, mode); err != nil { + if err := flock(db); err != nil { _ = db.close() return nil, err } @@ -4271,7 +4263,7 @@ func (cmd *CheckCommand) Run(args ...string) error { } // Open database. - db, err := Open(path, 0666, nil) + db, err := Open(path) if err != nil { return err } @@ -4349,7 +4341,7 @@ func (cmd *InfoCommand) Run(args ...string) error { } // Open the database. - db, err := Open(path, 0666, nil) + db, err := Open(path) if err != nil { return err } @@ -4753,7 +4745,7 @@ func (cmd *PagesCommand) Run(args ...string) error { } // Open database. - db, err := Open(path, 0666, nil) + db, err := Open(path) if err != nil { return err } @@ -4840,7 +4832,7 @@ func (cmd *StatsCommand) Run(args ...string) error { } // Open database. - db, err := Open(path, 0666, nil) + db, err := Open(path) if err != nil { return err } @@ -4963,7 +4955,7 @@ func (cmd *BenchCommand) Run(args ...string) error { } // Create database. - db, err := Open(options.Path, 0666, nil) + db, err := Open(options.Path) if err != nil { return err } @@ -5492,14 +5484,14 @@ func (cmd *CompactCommand) Run(args ...string) (err error) { initialSize := fi.Size() // Open source database. - src, err := Open(cmd.SrcPath, 0444, nil) + src, err := Open(cmd.SrcPath) if err != nil { return err } defer src.Close() // Open destination database. - dst, err := Open(cmd.DstPath, fi.Mode(), nil) + dst, err := Open(cmd.DstPath) if err != nil { return err } |