aboutsummaryrefslogtreecommitdiff
path: root/bolt_windows.go
diff options
context:
space:
mode:
Diffstat (limited to 'bolt_windows.go')
-rw-r--r--bolt_windows.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/bolt_windows.go b/bolt_windows.go
index c8539d4..8b782be 100644
--- a/bolt_windows.go
+++ b/bolt_windows.go
@@ -16,7 +16,7 @@ func fdatasync(db *DB) error {
}
// flock acquires an advisory lock on a file descriptor.
-func flock(f *os.File, _ time.Duration) error {
+func flock(f *os.File, _ bool, _ time.Duration) error {
return nil
}
@@ -28,9 +28,11 @@ func funlock(f *os.File) error {
// mmap memory maps a DB's data file.
// Based on: https://github.com/edsrzf/mmap-go
func mmap(db *DB, sz int) error {
- // Truncate the database to the size of the mmap.
- if err := db.file.Truncate(int64(sz)); err != nil {
- return fmt.Errorf("truncate: %s", err)
+ if !db.readOnly {
+ // Truncate the database to the size of the mmap.
+ if err := db.file.Truncate(int64(sz)); err != nil {
+ return fmt.Errorf("truncate: %s", err)
+ }
}
// Open a file mapping handle.