aboutsummaryrefslogtreecommitdiff
path: root/src/dedo.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/dedo.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/dedo.go b/src/dedo.go
index 29cfb45..a6e951a 100644
--- a/src/dedo.go
+++ b/src/dedo.go
@@ -54,6 +54,7 @@ import (
"time"
"unsafe"
+ "pds"
g "gobang"
)
@@ -104,6 +105,14 @@ type elemRef struct {
index int
}
+type Value interface{
+ value() []byte // FIXME: should be - []byte | IBucket
+}
+
+type InMemory struct{
+ *pds.Map[[]byte, Value]
+}
+
type IDedo interface{
Close() error
View (func(tx *Tx) error) error
@@ -1624,6 +1633,26 @@ func initDB(db *DB, size int64) error {
return nil
}
+func OpenMemory() IDedo {
+ return &InMemory{pds.NewMap[[]byte, Value](nil)}
+}
+
+func (m *InMemory) Close() error {
+ return nil
+}
+
+func (m *InMemory) Path() string {
+ return ""
+}
+
+func (m *InMemory) Update(func(*Tx) error) error {
+ return nil
+}
+
+func (m *InMemory) View(func(*Tx) error) error {
+ return nil
+}
+
/// Open creates and opens a database at the given path. If the file does not
/// exist then it will be created automatically.
func OpenWith(path string, options OpenOptionsT) (IDedo, error) {