mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-30 09:59:13 +08:00
docs(bitswap:notifications) Subscribe
This commit is contained in:
@ -22,8 +22,9 @@ func (ps *notifications) Publish(block *blocks.Block) {
|
||||
ps.wrapped.Pub(block, topic)
|
||||
}
|
||||
|
||||
// Sub returns a one-time use |blockChannel|. |blockChannel| returns nil if the
|
||||
// |ctx| times out or is cancelled
|
||||
// Subscribe returns a one-time use |blockChannel|. |blockChannel| returns nil
|
||||
// if the |ctx| times out or is cancelled. Then channel is closed after the
|
||||
// block given by |k| is sent.
|
||||
func (ps *notifications) Subscribe(ctx context.Context, k u.Key) <-chan *blocks.Block {
|
||||
topic := string(k)
|
||||
subChan := ps.wrapped.SubOnce(topic)
|
||||
|
Reference in New Issue
Block a user