Documentation ¶
Index ¶
- Constants
- func NewCacheBlockStore(size int) (blockstore.Blockstore, error)
- type BlockPubSub
- type CarFetcher
- type DataCallback
- type GraphGateway
- func (api *GraphGateway) Get(ctx context.Context, path gateway.ImmutablePath, ...) (gateway.ContentPathMetadata, *gateway.GetResponse, error)
- func (api *GraphGateway) GetAll(ctx context.Context, path gateway.ImmutablePath) (gateway.ContentPathMetadata, files.Node, error)
- func (api *GraphGateway) GetBlock(ctx context.Context, path gateway.ImmutablePath) (gateway.ContentPathMetadata, files.File, error)
- func (api *GraphGateway) GetCAR(ctx context.Context, path gateway.ImmutablePath) (gateway.ContentPathMetadata, io.ReadCloser, <-chan error, error)
- func (api *GraphGateway) GetDNSLinkRecord(ctx context.Context, hostname string) (ifacepath.Path, error)
- func (api *GraphGateway) GetIPNSRecord(ctx context.Context, c cid.Cid) ([]byte, error)
- func (api *GraphGateway) Head(ctx context.Context, path gateway.ImmutablePath) (gateway.ContentPathMetadata, files.Node, error)
- func (api *GraphGateway) IsCached(ctx context.Context, path ifacepath.Path) bool
- func (api *GraphGateway) ResolveMutable(ctx context.Context, p ifacepath.Path) (gateway.ImmutablePath, error)
- func (api *GraphGateway) ResolvePath(ctx context.Context, path gateway.ImmutablePath) (gateway.ContentPathMetadata, error)
- type GraphGatewayMetrics
- type GraphGatewayOption
- type Notifier
Constants ¶
const DefaultCacheBlockStoreSize = 1024
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 (api *GraphGateway) Get(ctx context.Context, path gateway.ImmutablePath, byteRanges ...gateway.ByteRange) (gateway.ContentPathMetadata, *gateway.GetResponse, error)
func (*GraphGateway) GetAll ¶
func (api *GraphGateway) GetAll(ctx context.Context, path gateway.ImmutablePath) (gateway.ContentPathMetadata, files.Node, error)
func (*GraphGateway) GetBlock ¶
func (api *GraphGateway) GetBlock(ctx context.Context, path gateway.ImmutablePath) (gateway.ContentPathMetadata, files.File, error)
func (*GraphGateway) GetCAR ¶
func (api *GraphGateway) GetCAR(ctx context.Context, path gateway.ImmutablePath) (gateway.ContentPathMetadata, io.ReadCloser, <-chan error, error)
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 (api *GraphGateway) Head(ctx context.Context, path gateway.ImmutablePath) (gateway.ContentPathMetadata, files.Node, error)
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 ¶
func (api *GraphGateway) ResolvePath(ctx context.Context, path gateway.ImmutablePath) (gateway.ContentPathMetadata, error)
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