Skip to content

Commit 551c966

Browse files
committed
blockstore: expose event handler registration
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
1 parent 657a9ed commit 551c966

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

blocks/blockstore/blockstore.go

+6
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ type Blockstore interface {
4949
// HashOnRead specifies if every read block should be
5050
// rehashed to make sure it matches its CID.
5151
HashOnRead(enabled bool)
52+
// RegisterEventHandler registers an event handler
53+
RegisterEventHandler(EventID, EventFunc)
5254
}
5355

5456
// GCLocker abstract functionality to lock a blockstore when performing
@@ -107,6 +109,10 @@ type blockstore struct {
107109
rehash bool
108110
}
109111

112+
func (bs *blockstore) RegisterEventHandler(t EventID, eh EventFunc) {
113+
bs.events.addHandler(t, eh)
114+
}
115+
110116
func (bs *blockstore) HashOnRead(enabled bool) {
111117
bs.rehash = enabled
112118
}

0 commit comments

Comments
 (0)