aboutsummaryrefslogtreecommitdiff
path: root/src/dedo.go
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-12-30 23:17:16 -0300
committerEuAndreh <eu@euandre.org>2024-12-30 23:17:16 -0300
commite933fbca8ca26042787b8202a78ccf394bf18766 (patch)
tree4a33a552b253f60f2ec854126f247354d5be7aba /src/dedo.go
parentsrc/dedo.go: Remove Options.InitialMmapSize option (diff)
downloaddedo-e933fbca8ca26042787b8202a78ccf394bf18766.tar.gz
dedo-e933fbca8ca26042787b8202a78ccf394bf18766.tar.xz
src/dedo.go: Remove mode and options from Open()
Diffstat (limited to 'src/dedo.go')
-rw-r--r--src/dedo.go28
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
}