Documentation ¶
Index ¶
- Constants
- Variables
- func GatewayError(err error) error
- func NewCacheBlockStore(size int) (blockstore.Blockstore, error)
- type AwaitCloser
- type CarFetcher
- type DataCallback
- type ErrPartialResponse
- 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, params gateway.CarParams) (gateway.ContentPathMetadata, io.ReadCloser, 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, *gateway.HeadResponse, 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
Constants ¶
const DefaultCacheBlockStoreSize = 1024
const GetBlockTimeout = time.Second * 60
Variables ¶
var ErrFetcherUnexpectedEOF = fmt.Errorf("failed to fetch IPLD data")
var ErrNilBlock = caboose.ErrInvalidResponse{Message: "received a nil block with no error"}
Functions ¶
func GatewayError ¶ added in v0.0.15
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 (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, params gateway.CarParams) (gateway.ContentPathMetadata, io.ReadCloser, 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, *gateway.HeadResponse, 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 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