lib

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0, MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultCacheBlockStoreSize = 1024
View Source
const GetBlockTimeout = time.Second * 60

Variables

This section is empty.

Functions

func NewCacheBlockStore

func NewCacheBlockStore(size int) (blockstore.Blockstore, error)

Types

type BlockPubSub

type BlockPubSub interface {
	Publish(blocks ...blocks.Block)
	Subscribe(ctx context.Context, keys ...multihash.Multihash) <-chan blocks.Block
	Shutdown()
}

BlockPubSub is a simple interface for publishing blocks and being able to subscribe for multihashes. It's used internally by an exchange to decouple receiving blocks and actually providing them back to the GetBlocks caller. Note: because multihashes are being requested and blocks returned the codecs could be anything

func NewBlockPubSub

func NewBlockPubSub() BlockPubSub

NewBlockPubSub generates a new BlockPubSub interface.

type CarFetcher

type CarFetcher interface {
	Fetch(ctx context.Context, path string, cb DataCallback) error
}

type DataCallback

type DataCallback = caboose.DataCallback

type DataCallback = func(resource string, reader io.Reader) error TODO: Don't use a caboose type, perhaps ask them to use a type alias instead of a type

type GraphGateway

type GraphGateway struct {
	// contains filtered or unexported fields
}

func NewGraphGatewayBackend

func NewGraphGatewayBackend(f CarFetcher, blockFetcher exchange.Fetcher, opts ...GraphGatewayOption) (*GraphGateway, error)

func (*GraphGateway) Get

func (*GraphGateway) GetAll

func (*GraphGateway) GetBlock

func (*GraphGateway) GetCAR

func (*GraphGateway) GetDNSLinkRecord

func (api *GraphGateway) GetDNSLinkRecord(ctx context.Context, hostname string) (ifacepath.Path, error)

TODO: This is copy-paste from blocks gateway, maybe share code

func (*GraphGateway) GetIPNSRecord

func (api *GraphGateway) GetIPNSRecord(ctx context.Context, c cid.Cid) ([]byte, error)

TODO: This is copy-paste from blocks gateway, maybe share code

func (*GraphGateway) Head

func (*GraphGateway) IsCached

func (api *GraphGateway) IsCached(ctx context.Context, path ifacepath.Path) bool

func (*GraphGateway) ResolveMutable

func (api *GraphGateway) ResolveMutable(ctx context.Context, p ifacepath.Path) (gateway.ImmutablePath, error)

TODO: This is copy-paste from blocks gateway, maybe share code

func (*GraphGateway) ResolvePath

type GraphGatewayMetrics

type GraphGatewayMetrics struct {
	// contains filtered or unexported fields
}

type GraphGatewayOption

type GraphGatewayOption func(gwOptions *gwOptions) error

func WithBlockstore

func WithBlockstore(bs blockstore.Blockstore) GraphGatewayOption

WithBlockstore sets the Blockstore to use for the gateway

func WithNameSystem

func WithNameSystem(ns namesys.NameSystem) GraphGatewayOption

WithNameSystem sets the name system to use for the gateway. If not set it will use a default DNSLink resolver along with any configured ValueStore

func WithValueStore

func WithValueStore(vs routing.ValueStore) GraphGatewayOption

WithValueStore sets the ValueStore to use for the gateway

type Notifier

type Notifier interface {
	NotifyNewBlocks(ctx context.Context, blocks ...blocks.Block) error
}

Jump to

Keyboard shortcuts

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