aboutsummaryrefslogtreecommitdiffstats
path: root/memory_database.go
diff options
context:
space:
mode:
authorobscuren <obscuren@obscura.com>2014-01-01 20:36:48 +0800
committerobscuren <obscuren@obscura.com>2014-01-01 20:36:48 +0800
commit5da78427d0d5910c2ea0c0fc6ca84078f327e933 (patch)
tree8d704316190b98f061281db32d058802988e09c6 /memory_database.go
parent52952e274d791991c6c368d135234068968981bc (diff)
downloadgo-tangerine-5da78427d0d5910c2ea0c0fc6ca84078f327e933.tar.gz
go-tangerine-5da78427d0d5910c2ea0c0fc6ca84078f327e933.tar.zst
go-tangerine-5da78427d0d5910c2ea0c0fc6ca84078f327e933.zip
Added db query interface and moved memory database
Diffstat (limited to 'memory_database.go')
-rw-r--r--memory_database.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/memory_database.go b/memory_database.go
new file mode 100644
index 000000000..fc40f76f3
--- /dev/null
+++ b/memory_database.go
@@ -0,0 +1,25 @@
+package main
+
+import (
+)
+
+/*
+ * This is a test memory database. Do not use for any production it does not get persisted
+ */
+type MemDatabase struct {
+ db map[string][]byte
+}
+
+func NewMemDatabase() (*MemDatabase, error) {
+ db := &MemDatabase{db: make(map[string][]byte)}
+
+ return db, nil
+}
+
+func (db *MemDatabase) Put(key []byte, value []byte) {
+ db.db[string(key)] = value
+}
+
+func (db *MemDatabase) Get(key []byte) ([]byte, error) {
+ return db.db[string(key)], nil
+}