aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-02-09 17:49:46 -0300
committerEuAndreh <eu@euandre.org>2025-02-09 17:49:46 -0300
commit681c109e8a57db57e0c244bf058faf6c6643e45e (patch)
treea2d22a84210cee700b675739158c0a5826ec7c21
parentsrc/dedo.go: Replace usage of empty `interface{}` with `any` (diff)
downloaddedo-681c109e8a57db57e0c244bf058faf6c6643e45e.tar.gz
dedo-681c109e8a57db57e0c244bf058faf6c6643e45e.tar.xz
src/dedo.go: Move public interfaces to the beginning of the file
-rw-r--r--src/dedo.go60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/dedo.go b/src/dedo.go
index 6cc30f6..39e1269 100644
--- a/src/dedo.go
+++ b/src/dedo.go
@@ -61,6 +61,36 @@ import (
+type SnapshotI interface{
+ Bucket([]byte) *Bucket
+ Cursor() *Cursor
+ ForEach(func([]byte, *Bucket) error) error
+
+ WriteTo(io.Writer) (int64, error)
+ Check() <-chan error
+}
+
+type TransactionI interface{
+ Bucket([]byte) *Bucket
+ Cursor() *Cursor
+ ForEach(func([]byte, *Bucket) error) error
+
+ WriteTo(io.Writer) (int64, error)
+ Check() <-chan error
+
+ CreateBucket ([]byte) (*Bucket, error)
+ CreateBucketIfNotExists([]byte) (*Bucket, error)
+ DeleteBucket([]byte) error
+ OnCommit(func())
+}
+
+type DatabaseI interface{
+ Close() error
+ View (func(tx SnapshotI) error) error
+ Update(func(tx TransactionI) error) error
+ Path() string
+}
+
type pgid uint64
/// bucket represents the on-file representation of a bucket. This is stored as
@@ -116,36 +146,6 @@ type InMemory struct{
*pds.Map[[]byte, *Bucket]
}
-type SnapshotI interface{
- Bucket([]byte) *Bucket
- Cursor() *Cursor
- ForEach(func([]byte, *Bucket) error) error
-
- WriteTo(io.Writer) (int64, error)
- Check() <-chan error
-}
-
-type TransactionI interface{
- Bucket([]byte) *Bucket
- Cursor() *Cursor
- ForEach(func([]byte, *Bucket) error) error
-
- WriteTo(io.Writer) (int64, error)
- Check() <-chan error
-
- CreateBucket ([]byte) (*Bucket, error)
- CreateBucketIfNotExists([]byte) (*Bucket, error)
- DeleteBucket([]byte) error
- OnCommit(func())
-}
-
-type DatabaseI interface{
- Close() error
- View (func(tx SnapshotI) error) error
- Update(func(tx TransactionI) error) error
- Path() string
-}
-
/// 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