exchange

package
v0.10.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2023 License: Apache-2.0, MIT Imports: 4 Imported by: 1

Documentation

Overview

Package exchange defines the IPFS exchange interface

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetcher

type Fetcher interface {
	// GetBlock returns the block associated with a given cid.
	GetBlock(context.Context, cid.Cid) (blocks.Block, error)
	// GetBlocks returns the blocks associated with the given cids.
	// If the requested blocks are not found immediately, this function should hang until
	// they are found. If they can't be found later, it's also acceptable to terminate.
	GetBlocks(context.Context, []cid.Cid) (<-chan blocks.Block, error)
}

Fetcher is an object that can be used to retrieve blocks

type Interface

type Interface interface {
	Fetcher

	// NotifyNewBlocks tells the exchange that new blocks are available and can be served.
	NotifyNewBlocks(ctx context.Context, blocks ...blocks.Block) error

	io.Closer
}

Interface defines the functionality of the IPFS block exchange protocol.

type SessionExchange

type SessionExchange interface {
	Interface
	// NewSession generates a new exchange session. You should use this, rather
	// that calling GetBlocks, any time you intend to do several related calls
	// in a row. The exchange can leverage that to be more efficient.
	NewSession(context.Context) Fetcher
}

SessionExchange is an exchange.Interface which supports sessions.

Directories

Path Synopsis
package offline implements an object that implements the exchange interface but returns nil values to every request.
package offline implements an object that implements the exchange interface but returns nil values to every request.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL