carmirror

package
v0.0.0-...-9be8bb9 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const HASH_FUNCTION = 3
View Source
const Version = "0.1.0"

Variables

This section is empty.

Functions

func NewLocalNodeGetter

func NewLocalNodeGetter(api kubo.CoreAPI) (ipld.NodeGetter, error)

NewLocalNodeGetter creates a local (no fetch) NodeGetter from a CoreAPI.

func WriteError

func WriteError(w http.ResponseWriter, err error)

func WriteSuccess

func WriteSuccess(w http.ResponseWriter)

func XX3HashBlockId

func XX3HashBlockId(id cmipld.Cid, seed uint64) uint64

Types

type CancelParams

type CancelParams struct {
	Session string
}

type CarMirror

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

func New

func New(capi coreiface.CoreAPI, blockStore *KuboStore, opts ...func(cfg *Config)) (*CarMirror, error)

New creates a local CAR Mirror service.

func (*CarMirror) CancelHandler

func (cm *CarMirror) CancelHandler() http.HandlerFunc

func (*CarMirror) LsHandler

func (cm *CarMirror) LsHandler() http.HandlerFunc

func (*CarMirror) NewPullSessionHandler

func (cm *CarMirror) NewPullSessionHandler() http.HandlerFunc

func (*CarMirror) NewPushSessionHandler

func (cm *CarMirror) NewPushSessionHandler() http.HandlerFunc

func (*CarMirror) StartRemote

func (cm *CarMirror) StartRemote(ctx context.Context) error

func (*CarMirror) StatsHandler

func (cm *CarMirror) StatsHandler() http.HandlerFunc

type Config

type Config struct {
	HTTPRemoteAddr       string
	MaxBlocksPerRound    uint32
	MaxBlocksPerColdCall uint32
}

Config encapsulates CAR Mirror configuration

func (*Config) Validate

func (cfg *Config) Validate() error

Validate confirms the configuration is valid

type KuboStore

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

func NewKuboStore

func NewKuboStore(core kubo.CoreAPI) *KuboStore

func (*KuboStore) Add

func (ks *KuboStore) Add(ctx context.Context, block cm.RawBlock[cmipld.Cid]) (cm.Block[cmipld.Cid], error)

func (*KuboStore) AddMany

func (ks *KuboStore) AddMany(ctx context.Context, rawBlocks []cm.RawBlock[cmipld.Cid]) ([]cm.Block[cmipld.Cid], error)

func (*KuboStore) All

func (ks *KuboStore) All(ctx context.Context) (<-chan cmipld.Cid, error)

There doesn't seem to be a clear way to list all the CIDs since the underlying blockstore is not exposed in the core Kubo API. This method will therefore list the cids of all pinned objects

func (*KuboStore) Get

func (ks *KuboStore) Get(ctx context.Context, cid cmipld.Cid) (cm.Block[cmipld.Cid], error)

func (*KuboStore) Has

func (ks *KuboStore) Has(ctx context.Context, cid cmipld.Cid) (bool, error)

type LsParams

type LsParams struct {
}

TODO: Any params?

type LsResponse

type LsResponse struct {
	SessionId   string
	SessionInfo string
}

type PullParams

type PullParams struct {
	Cid        string
	Addr       string
	Stream     bool
	Background bool
}

type PushParams

type PushParams struct {
	Cid        string
	Addr       string
	Diff       string
	Stream     bool
	Background bool
}

type StatsParams

type StatsParams struct {
	Session string
}

Jump to

Keyboard shortcuts

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