Skip to content

Commit

Permalink
Fix some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hsanjuan committed Nov 22, 2024
1 parent e35b90f commit e9943e9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions exchange/providing/providing.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,26 @@ 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
provider provider.Provider
}

// 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,
provider: provider,
}
}

// 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...)
Expand Down

0 comments on commit e9943e9

Please sign in to comment.