carstore

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDownloadTooLarge means that the file being downloaded from the IPFS Gateway is larger than the
	// maximum size allowed.
	ErrDownloadTooLarge = errors.New("download is too large")
)
View Source
var (

	// ErrNotFound indicates that we do not have the requested CAR file in the car store
	ErrNotFound = errors.New("CAR not found")
)

Functions

func NewGatewayAPI

func NewGatewayAPI(baseURL string, sApi station.StationAPI, maxDownloadPerRequest uint64) *gatewayAPI

Types

type CarStore

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

func New

func New(rootDir string, gwAPI GatewayAPI, cfg Config, logger *logs.SaturnLogger) (*CarStore, error)

func (*CarStore) FetchAndWriteCAR

func (cs *CarStore) FetchAndWriteCAR(reqID uuid.UUID, root cid.Cid, writer func(bstore.Blockstore) error) error

func (*CarStore) IsIndexed

func (cs *CarStore) IsIndexed(ctx context.Context, root cid.Cid) (bool, error)

func (*CarStore) Start

func (cs *CarStore) Start(ctx context.Context) error

func (*CarStore) Stat

func (cs *CarStore) Stat() (station.StorageStats, error)

func (*CarStore) Stop added in v0.1.0

func (cs *CarStore) Stop() error

type Config

type Config struct {
	// Maximum size to allocate to the car files directory on disk.
	// defaults to 200 Gib
	MaxCARFilesDiskSpace int64
	DownloadTimeout      time.Duration
}

type GatewayAPI

type GatewayAPI interface {
	Fetch(ctx context.Context, rootCID cid.Cid) (mount.Reader, error)
}

type GatewayMount

type GatewayMount struct {
	API     GatewayAPI
	RootCID cid.Cid
}

func (*GatewayMount) Close

func (g *GatewayMount) Close() error

func (*GatewayMount) Deserialize

func (g *GatewayMount) Deserialize(u *url.URL) error

func (*GatewayMount) Fetch

func (g *GatewayMount) Fetch(ctx context.Context) (mount.Reader, error)

func (*GatewayMount) Info

func (g *GatewayMount) Info() mount.Info

func (*GatewayMount) Serialize

func (g *GatewayMount) Serialize() *url.URL

func (*GatewayMount) Stat

func (l *GatewayMount) Stat(ctx context.Context) (mount.Stat, error)

type GatewayReader

type GatewayReader struct {
	io.ReadCloser
	io.ReaderAt
	io.Seeker
	// contains filtered or unexported fields
}

func (*GatewayReader) Close

func (gw *GatewayReader) Close() error

func (*GatewayReader) Read

func (gw *GatewayReader) Read(p []byte) (int, error)

Jump to

Keyboard shortcuts

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