From aa13f7f94f882fa0964b801c062217c0b9a45436 Mon Sep 17 00:00:00 2001 From: sasha-s Date: Mon, 18 May 2015 12:00:40 -0700 Subject: make ignoring Truncate() explicit https://github.com/boltdb/bolt/pull/371#issuecomment-103176330 --- db.go | 7 ------- 1 file changed, 7 deletions(-) (limited to 'db.go') diff --git a/db.go b/db.go index 5ae35cc..d1b722a 100644 --- a/db.go +++ b/db.go @@ -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. -- cgit v1.2.3