Commit 75f682be authored by Brian Tiger Chow's avatar Brian Tiger Chow Committed by Jeromy

refactor(blockstore, blockservice) use Blockstore and offline.Exchange

License: MIT
Signed-off-by: default avatarBrian Tiger Chow <brian@perfmode.com>
parent 88779b41
...@@ -15,6 +15,8 @@ import ( ...@@ -15,6 +15,8 @@ import (
var ValueTypeMismatch = errors.New("The retrieved value is not a Block") var ValueTypeMismatch = errors.New("The retrieved value is not a Block")
type Blockstore interface { type Blockstore interface {
DeleteBlock(u.Key) error
Has(u.Key) (bool, error)
Get(u.Key) (*blocks.Block, error) Get(u.Key) (*blocks.Block, error)
Put(*blocks.Block) error Put(*blocks.Block) error
} }
...@@ -45,3 +47,11 @@ func (bs *blockstore) Get(k u.Key) (*blocks.Block, error) { ...@@ -45,3 +47,11 @@ func (bs *blockstore) Get(k u.Key) (*blocks.Block, error) {
func (bs *blockstore) Put(block *blocks.Block) error { func (bs *blockstore) Put(block *blocks.Block) error {
return bs.datastore.Put(block.Key().DsKey(), block.Data) return bs.datastore.Put(block.Key().DsKey(), block.Data)
} }
func (bs *blockstore) Has(k u.Key) (bool, error) {
return bs.datastore.Has(k.DsKey())
}
func (s *blockstore) DeleteBlock(k u.Key) error {
return s.datastore.Delete(k.DsKey())
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment