exchange

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: MIT Imports: 4 Imported by: 75

README

go-ipfs-exchange-interface

standard-readme compliant GoDoc Build Status

go-ipfs-exchange-interface defines the IPFS exchange interface

❗ This repo is no longer maintained.

👉 We highly recommend switching to the maintained version at https://github.com/ipfs/boxo/tree/main/exchange. 🏎️ Good news! There is tooling and documentation to expedite a switch in your repo.

⚠️ If you continue using this repo, please note that security fixes will not be provided (unless someone steps in to maintain it).

📚 Learn more, including how to take the maintainership mantle or ask questions, here.

Table of Contents

Install

go-ipfs-exchange-interface works like a regular Go module:

> go get github.com/ipfs/go-ipfs-exchange-interface

Usage

import "github.com/ipfs/go-ipfs-exchange-interface"

Check the GoDoc documentation

Contribute

PRs accepted.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT © Protocol Labs, Inc.

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 deprecated

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

Deprecated: use github.com/ipfs/boxo/exchange.Fetcher

type Interface deprecated

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.

Deprecated: use github.com/ipfs/boxo/exchange.Interface

type SessionExchange deprecated

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.

Deprecated: use github.com/ipfs/boxo/exchange.SessionExchange

Jump to

Keyboard shortcuts

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