diff options
author | sasha-s <sasha@scaledinference.com> | 2015-05-18 12:00:40 -0700 |
---|---|---|
committer | sasha-s <sasha@scaledinference.com> | 2015-05-18 12:00:40 -0700 |
commit | aa13f7f94f882fa0964b801c062217c0b9a45436 (patch) | |
tree | 81bfb561bafd5be1c96768e3474ce88558614ad5 /db.go | |
parent | use a shared lock in read-only mode (diff) | |
download | dedo-aa13f7f94f882fa0964b801c062217c0b9a45436.tar.gz dedo-aa13f7f94f882fa0964b801c062217c0b9a45436.tar.xz |
make ignoring Truncate() explicit
https://github.com/boltdb/bolt/pull/371#issuecomment-103176330
Diffstat (limited to 'db.go')
-rw-r--r-- | db.go | 7 |
1 files changed, 0 insertions, 7 deletions
@@ -103,7 +103,6 @@ type DB struct { ops struct { writeAt func(b []byte, off int64) (n int, err error) - Truncate func(size int64) error } readOnly bool // Read only mode. Update()/Begin(true) would return ErrDatabaseReadOnly immediately. @@ -144,8 +143,6 @@ func Open(path string, mode os.FileMode, options *Options) (*DB, error) { if options.ReadOnly { flag = os.O_RDONLY db.readOnly = true - // Ignore truncations. - db.ops.Truncate = func(int64) error { return nil } } // Open data file and separate sync handler for metadata writes. @@ -156,10 +153,6 @@ func Open(path string, mode os.FileMode, options *Options) (*DB, error) { return nil, err } - if !db.readOnly { - db.ops.Truncate = db.file.Truncate - } - // Lock file so that other processes using Bolt in read-write mode cannot // use the database at the same time. This would cause corruption since // the two processes would write meta pages and free pages separately. |