diff options
Diffstat (limited to 'storage/memory/storage.go')
-rw-r--r-- | storage/memory/storage.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/storage/memory/storage.go b/storage/memory/storage.go index 1bf99fc..6a56d6a 100644 --- a/storage/memory/storage.go +++ b/storage/memory/storage.go @@ -143,6 +143,7 @@ func (o *ObjectStorage) Get(t core.ObjectType, h core.Hash) (core.Object, error) if !ok || (core.AnyObject != t && obj.Type() != t) { return nil, core.ErrObjectNotFound } + return obj, nil } @@ -192,6 +193,15 @@ func (tx *TxObjectStorage) Set(obj core.Object) (core.Hash, error) { return h, nil } +func (tx *TxObjectStorage) Get(t core.ObjectType, h core.Hash) (core.Object, error) { + obj, ok := tx.Objects[h] + if !ok || (core.AnyObject != t && obj.Type() != t) { + return nil, core.ErrObjectNotFound + } + + return obj, nil +} + func (tx *TxObjectStorage) Commit() error { for h, obj := range tx.Objects { delete(tx.Objects, h) |