diff options
-rw-r--r-- | src/dedo.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dedo.go b/src/dedo.go index 84c4cea..acf8ef1 100644 --- a/src/dedo.go +++ b/src/dedo.go @@ -125,10 +125,10 @@ type DB struct { /// Do not change concurrently with calls to Batch. MaxBatchDelay time.Duration - /// AllocSize is the amount of space allocated when the database needs + /// allocSize is the amount of space allocated when the database needs /// to create new pages. This is done to amortize the cost of /// truncate() and fsync() when growing the data file. - AllocSize int + allocSize int path string file *os.File @@ -323,7 +323,8 @@ const ( /// Default values if not set in a DB instance. DefaultMaxBatchSize int = 1000 DefaultMaxBatchDelay = 10 * time.Millisecond - DefaultAllocSize = 16 * 1024 * 1024 + + allocGrowthSize = 16 * 1024 * 1024 // 16MiB pageHeaderSize = int(unsafe.Offsetof(((*page)(nil)).ptr)) @@ -1513,7 +1514,6 @@ func newDB(path string, file *os.File, options OpenOptionsT) *DB { return &DB{ MaxBatchSize: DefaultMaxBatchSize, MaxBatchDelay: DefaultMaxBatchDelay, - AllocSize: DefaultAllocSize, opened: true, path: path, file: file, @@ -2209,10 +2209,10 @@ func (db *DB) grow(sz int) error { // If the data is smaller than the alloc size then only allocate what's // needed. Once it goes over the allocation size then allocate in // chunks. - if db.datasz < db.AllocSize { + if db.datasz < allocGrowthSize { sz = db.datasz } else { - sz += db.AllocSize + sz += allocGrowthSize } // Truncate and fsync to ensure file size metadata is flushed. |