preparation

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: Apache-2.0, MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenRepo

func OpenRepo(ctx context.Context, cfg appconfig.RepoConfig, opts ...sqlrepo.Option) (*sqlrepo.Repo, error)

OpenRepo opens a database connection and applies migrations. If cfg.IsPostgres(), it connects to PostgreSQL; otherwise it uses SQLite.

Types

type API

type API struct {
	Repo    Repo
	Spaces  spaces.API
	Uploads uploads.API
	Sources sources.API
	DAGs    dags.API
	Scans   scans.API
	Bus     bus.Bus
}

func NewAPI

func NewAPI(repo Repo, client StorachaClient, options ...Option) API

func (API) AddSourceToSpace

func (a API) AddSourceToSpace(ctx context.Context, spaceDID did.DID, sourceID id.SourceID) error

func (API) CreateSource

func (a API) CreateSource(ctx context.Context, name string, path string, options ...sourcesmodel.SourceOption) (*sourcesmodel.Source, error)

func (API) ExecuteUpload

func (a API) ExecuteUpload(ctx context.Context, upload *uploadsmodel.Upload) (cid.Cid, error)

func (API) FindOrCreateSpace

func (a API) FindOrCreateSpace(ctx context.Context, spaceDID did.DID, name string, options ...spacesmodel.SpaceOption) (*spacesmodel.Space, error)

func (API) FindOrCreateUploads

func (a API) FindOrCreateUploads(ctx context.Context, spaceDID did.DID) ([]*uploadsmodel.Upload, error)

func (API) GetUploadByID

func (a API) GetUploadByID(ctx context.Context, uploadID id.UploadID) (*uploadsmodel.Upload, error)

type Option

type Option func(cfg *config) error

Option is an option configuring the API.

func WithAssumeUnchangedSources added in v0.5.1

func WithAssumeUnchangedSources(assume bool) Option

func WithBlobUploadParallelism added in v0.4.0

func WithBlobUploadParallelism(blobUploadParallelism int) Option

func WithEventBus added in v0.4.0

func WithEventBus(bus bus.Bus) Option

func WithGetLocalFSForPathFn

func WithGetLocalFSForPathFn(getLocalFSForPathFn func(path string) (fs.FS, error)) Option

func WithMaxNodesPerIndex

func WithMaxNodesPerIndex(maxNodesPerIndex int) Option

func WithReplicas added in v0.7.0

func WithReplicas(replicas uint) Option

WithReplicas sets the number of replicas to use when uploading blobs, including the original. The default is 3 replicas.

type Repo

type StorachaClient

type StorachaClient = storacha.Client

Jump to

Keyboard shortcuts

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