From e9943e9f8c371f7af7051893fc5620e902cb9aba Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Fri, 22 Nov 2024 15:17:27 +0100 Subject: [PATCH] Fix some docs --- exchange/providing/providing.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/exchange/providing/providing.go b/exchange/providing/providing.go index d9516ca91f..6b28878588 100644 --- a/exchange/providing/providing.go +++ b/exchange/providing/providing.go @@ -10,7 +10,7 @@ import ( blocks "github.com/ipfs/go-block-format" ) -// Exchange is an exchange wrapper that calls ProvideMany for blocks received +// Exchange is an exchange wrapper that calls Provide for blocks received // over NotifyNewBlocks. type Exchange struct { exchange.Interface @@ -18,6 +18,9 @@ type Exchange struct { } // New creates a new providing Exchange with the given exchange and provider. +// This is a light wrapper. We recommend that the provider supports the +// handling of many concurrent provides etc. as it is called directly for +// every new block. func New(base exchange.Interface, provider provider.Provider) *Exchange { return &Exchange{ Interface: base, @@ -25,7 +28,8 @@ func New(base exchange.Interface, provider provider.Provider) *Exchange { } } -// NotifyNewBlocks calls provider.ProvideMany. +// NotifyNewBlocks calls NotifyNewBlocks on the underlying provider and +// provider.Provide for every block after that. func (ex *Exchange) NotifyNewBlocks(ctx context.Context, blocks ...blocks.Block) error { // Notify blocks on the underlying exchange. err := ex.Interface.NotifyNewBlocks(ctx, blocks...)