diff options
-rw-r--r-- | src/dedo.go | 60 |
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 |