aboutsummaryrefslogtreecommitdiffstats
path: root/examples/storage/aerospike/storage.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-09-05 07:59:20 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-09-05 07:59:20 +0200
commit65427f64599e9383ab926aed75fc02f2db32022d (patch)
tree5c81c00bc9dcfb54e0c6d0038ab2cbd8cddde389 /examples/storage/aerospike/storage.go
parent440cfd96cf88ffc9d04bbd32ec8a3b1afb42144c (diff)
downloadgo-git-65427f64599e9383ab926aed75fc02f2db32022d.tar.gz
core: ObjectStorage.Begin and TxObjectStorage
Diffstat (limited to 'examples/storage/aerospike/storage.go')
-rw-r--r--examples/storage/aerospike/storage.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/examples/storage/aerospike/storage.go b/examples/storage/aerospike/storage.go
index e77448a..b57d932 100644
--- a/examples/storage/aerospike/storage.go
+++ b/examples/storage/aerospike/storage.go
@@ -131,6 +131,26 @@ func (s *ObjectStorage) buildKey(h core.Hash, t core.ObjectType) (*driver.Key, e
return driver.NewKey(s.ns, t.String(), fmt.Sprintf("%s|%s", s.url, h.String()))
}
+func (s *ObjectStorage) Begin() core.TxObjectStorage {
+ return &TxObjectStorage{Storage: s}
+}
+
+type TxObjectStorage struct {
+ Storage *ObjectStorage
+}
+
+func (tx *TxObjectStorage) Set(obj core.Object) (core.Hash, error) {
+ return tx.Storage.Set(obj)
+}
+
+func (tx *TxObjectStorage) Commit() error {
+ return nil
+}
+
+func (tx *TxObjectStorage) Rollback() error {
+ return nil
+}
+
type ObjectIter struct {
t core.ObjectType
ch chan *driver.Record