retrieval

package
v2.6.20 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CITest = false
)

Functions

This section is empty.

Types

type BucketCreator

type BucketCreator interface {
	// CreateBucket creates a bucket with the provided information.
	CreateBucket(ctx context.Context,
		threadID thread.ID,
		threadToken thread.Token,
		buckName string,
		buckPrivate bool,
		dataCid cid.Cid) error
}

BucketCreator provides creating bucket functionality.

type FilRetrieval

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

FilRetrieval manages Retrievals from Accounts in go-datastore.

func NewFilRetrieval

func NewFilRetrieval(
	ds datastore.TxnDatastore,
	pgc *powc.Client,
	trr TrackerRetrievalRegistrator,
	jfe <-chan archive.JobEvent,
	is string,
) (*FilRetrieval, error)

func (*FilRetrieval) Close

func (fr *FilRetrieval) Close() error

Close closes gracefully all background work that is being executed.

func (*FilRetrieval) CreateForNewBucket

func (fr *FilRetrieval) CreateForNewBucket(
	ctx context.Context,
	accKey string,
	dbID thread.ID,
	dbToken thread.Token,
	buckName string,
	buckPrivate bool,
	dataCid cid.Cid,
	powToken string,
) (string, error)

CreateForNewBucket creates a queued Retrieval to bootstrap a new bucket with the provided information, only if the retrieval succeeds.

func (*FilRetrieval) GetAllByAccount

func (fr *FilRetrieval) GetAllByAccount(accKey string) ([]Retrieval, error)

func (*FilRetrieval) GetByAccountAndID

func (fr *FilRetrieval) GetByAccountAndID(accKey string, jobID string) (Retrieval, error)

func (*FilRetrieval) Logs

func (fr *FilRetrieval) Logs(ctx context.Context, accKey string, jobID string, powToken string, ch chan<- string) error

func (*FilRetrieval) RunDaemon

func (fr *FilRetrieval) RunDaemon()

func (*FilRetrieval) SetBucketCreator

func (fr *FilRetrieval) SetBucketCreator(bc BucketCreator)

type Retrieval

type Retrieval struct {
	Type         Type
	AccountKey   string
	PowToken     string
	JobID        string
	Cid          cid.Cid
	Selector     string
	Status       Status
	FailureCause string
	CreatedAt    int64

	// If Type == RetrievalTypeNewBucket
	DbID    thread.ID
	DbToken thread.Token
	Name    string
	Private bool

	// If Type == RetrievalTypeExistingBucket
	BuckKey  string
	BuckPath string
}

type Status

type Status int
const (
	StatusQueued Status = iota
	StatusExecuting
	StatusMoveToBucket
	StatusSuccess
	StatusFailed
)

type TrackerRetrievalRegistrator

type TrackerRetrievalRegistrator interface {
	// TrackRetrieval tracks JobID job.
	TrackRetrieval(ctx context.Context, accKey, jobID, powToken string) error
}

TrackerRegistrator manages retrieval Job tracking.

type Type

type Type int
const (
	TypeNewBucket Type = iota
	TypeExistingBucket
)

Jump to

Keyboard shortcuts

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