diff options
author | obscuren <obscuren@obscura.com> | 2014-01-01 20:36:48 +0800 |
---|---|---|
committer | obscuren <obscuren@obscura.com> | 2014-01-01 20:36:48 +0800 |
commit | 5da78427d0d5910c2ea0c0fc6ca84078f327e933 (patch) | |
tree | 8d704316190b98f061281db32d058802988e09c6 /memory_database.go | |
parent | 52952e274d791991c6c368d135234068968981bc (diff) | |
download | dexon-5da78427d0d5910c2ea0c0fc6ca84078f327e933.tar dexon-5da78427d0d5910c2ea0c0fc6ca84078f327e933.tar.gz dexon-5da78427d0d5910c2ea0c0fc6ca84078f327e933.tar.bz2 dexon-5da78427d0d5910c2ea0c0fc6ca84078f327e933.tar.lz dexon-5da78427d0d5910c2ea0c0fc6ca84078f327e933.tar.xz dexon-5da78427d0d5910c2ea0c0fc6ca84078f327e933.tar.zst dexon-5da78427d0d5910c2ea0c0fc6ca84078f327e933.zip |
Added db query interface and moved memory database
Diffstat (limited to 'memory_database.go')
-rw-r--r-- | memory_database.go | 25 |
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 +} |