diff options
author | EuAndreh <eu@euandre.org> | 2024-12-30 18:35:51 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2024-12-30 18:35:51 -0300 |
commit | b24540aa23bcf9b8f2e76901833ac6b5855dafef (patch) | |
tree | 3a6175b636f0f5f1a4d611773ea0a2ab38f4ac56 | |
parent | src/dedo.go: Sort imports (diff) | |
download | dedo-b24540aa23bcf9b8f2e76901833ac6b5855dafef.tar.gz dedo-b24540aa23bcf9b8f2e76901833ac6b5855dafef.tar.xz |
src/dedo.go: Remove DB.MmapFlags option
-rw-r--r-- | src/dedo.go | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/dedo.go b/src/dedo.go index cffd891..f6351e3 100644 --- a/src/dedo.go +++ b/src/dedo.go @@ -116,10 +116,6 @@ type DB struct { // debugging purposes. StrictMode bool - // If you want to read the entire database fast, you can set MmapFlag to - // syscall.MAP_POPULATE on Linux 2.6.23+ for sequential read-ahead. - MmapFlags int - // MaxBatchSize is the maximum size of a batch. Default value is // copied from DefaultMaxBatchSize in Open. // @@ -190,9 +186,6 @@ type panicked struct { // Options represents the options that can be set when opening a database. type Options struct { - // Sets the DB.MmapFlags flag before memory mapping the file. - MmapFlags int - // InitialMmapSize is the initial mmap size of the database // in bytes. Read transactions won't block write transaction // if the InitialMmapSize is large enough to hold database mmap @@ -688,7 +681,8 @@ func funlock(db *DB) error { // mmap memory maps a DB's data file. func mmap(db *DB, sz int) error { // Map the data file to memory. - b, err := syscall.Mmap(int(db.file.Fd()), 0, sz, syscall.PROT_READ, syscall.MAP_SHARED|db.MmapFlags) + fd := int(db.file.Fd()) + b, err := syscall.Mmap(fd, 0, sz, syscall.PROT_READ, syscall.MAP_SHARED) if err != nil { return err } @@ -1843,7 +1837,6 @@ func Open(path string, mode os.FileMode, options *Options) (*DB, error) { if options == nil { options = &Options{} } - db.MmapFlags = options.MmapFlags // Set default values for later DB operations. db.MaxBatchSize = DefaultMaxBatchSize |