aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-01-24 20:34:56 -0300
committerEuAndreh <eu@euandre.org>2025-01-24 20:34:56 -0300
commit848de20da06e2b53d2f3d5114f3a1c43bb0ff523 (patch)
tree6d67d3fcfdb43b2523e85991422364ea496456f2 /src
parentsrc/dedo.go: Remove Stats-related code (diff)
downloaddedo-848de20da06e2b53d2f3d5114f3a1c43bb0ff523.tar.gz
dedo-848de20da06e2b53d2f3d5114f3a1c43bb0ff523.tar.xz
src/dedo.go: Remove dbops type
Diffstat (limited to 'src')
-rw-r--r--src/dedo.go16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/dedo.go b/src/dedo.go
index 948f579..e93beb3 100644
--- a/src/dedo.go
+++ b/src/dedo.go
@@ -65,10 +65,6 @@ type elemRef struct {
index int
}
-type dbops struct {
- writeAt func(b []byte, off int64) (n int, err error)
-}
-
// DB represents a collection of buckets persisted to a file on disk.
// All data access is performed through transactions which can be obtained through the DB.
// All the functions on DB will return a ErrDatabaseNotOpen if accessed before Open() is called.
@@ -123,8 +119,6 @@ type DB struct {
rwlock sync.Mutex // Allows only one writer at a time.
metalock sync.Mutex // Protects meta page access.
mmaplock sync.RWMutex // Protects mmap access during remapping.
-
- ops dbops
}
type call struct {
@@ -1461,7 +1455,6 @@ func newDB(path string, file *os.File) *DB {
opened: true,
path: path,
file: file,
- ops: dbops{writeAt: file.WriteAt},
}
}
@@ -1548,7 +1541,7 @@ func initDB(db *DB, size int64) error {
p.count = 0
// Write the buffer to our data file.
- if _, err := db.ops.writeAt(buf, 0); err != nil {
+ if _, err := db.file.WriteAt(buf, 0); err != nil {
return err
}
if err := fdatasync(db); err != nil {
@@ -1730,9 +1723,6 @@ func (db *DB) close() error {
db.freelist = nil
- // Clear ops.
- db.ops.writeAt = nil
-
// Close the mmap.
if err := db.munmap(); err != nil {
return err
@@ -3542,7 +3532,7 @@ func (tx *Tx) write() error {
// Write chunk to disk.
buf := ptr[:sz]
- if _, err := tx.db.ops.writeAt(buf, offset); err != nil {
+ if _, err := tx.db.file.WriteAt(buf, offset); err != nil {
return err
}
@@ -3590,7 +3580,7 @@ func (tx *Tx) writeMeta() error {
tx.meta.write(p)
// Write the meta page to file.
- if _, err := tx.db.ops.writeAt(buf, int64(p.id)*int64(tx.db.pageSize)); err != nil {
+ if _, err := tx.db.file.WriteAt(buf, int64(p.id)*int64(tx.db.pageSize)); err != nil {
return err
}