lib

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0, MIT Imports: 57 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var ErrFetcherUnexpectedEOF = fmt.Errorf("failed to fetch IPLD data")
View Source
var ErrNilBlock = caboose.ErrInvalidResponse{Message: "received a nil block with no error"}

Functions

func GatewayError added in v0.0.15

func GatewayError(err error) error

GatewayError translates underlying blockstore error into one that gateway code will return as HTTP 502 or 504 it also makes sure Retry-After hint from remote blockstore will be passed to HTTP client, if present.

func NewCacheBlockStore

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

Types

type AwaitCloser added in v0.0.15

type AwaitCloser interface {
	AwaitClose() <-chan error
}

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 ErrPartialResponse added in v0.0.15

type ErrPartialResponse = caboose.ErrPartialResponse

TODO: Don't use a caboose type

type GraphGateway

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

func NewGraphGatewayBackend

func NewGraphGatewayBackend(f CarFetcher, 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) 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 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 WithPrometheusRegistry added in v0.0.15

func WithPrometheusRegistry(reg prometheus.Registerer) GraphGatewayOption

WithPrometheusRegistry sets the registry to use for metrics collection

func WithValueStore

func WithValueStore(vs routing.ValueStore) GraphGatewayOption

WithValueStore sets the ValueStore to use for the gateway

Jump to

Keyboard shortcuts

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