buckets

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CollectionName is the name of the threaddb collection used for buckets.
	CollectionName = "buckets"
	// SeedName is the file name reserved for a random bucket seed.
	SeedName = ".textileseed"
)

Variables

View Source
var (

	// ErrNonFastForward is returned when an update in non-fast-forward.
	ErrNonFastForward = fmt.Errorf("update is non-fast-forward")

	// ErrNoCurrentArchive is returned when not status about the last archive
	// can be retrieved, since the bucket was never archived.
	ErrNoCurrentArchive = fmt.Errorf("the bucket was never archived")
)

Functions

This section is empty.

Types

type Archive

type Archive struct {
	Cid   string `json:"cid"`
	Deals []Deal `json:"deals"`
}

Archive is a single archive containing a list of deals.

type Archives

type Archives struct {
	Current Archive   `json:"current"`
	History []Archive `json:"history"`
}

Archives contains all archives for a single bucket.

type Bucket

type Bucket struct {
	Key       string   `json:"_id"`
	Name      string   `json:"name"`
	Path      string   `json:"path"`
	DNSRecord string   `json:"dns_record,omitempty"`
	Archives  Archives `json:"archives"`
	CreatedAt int64    `json:"created_at"`
	UpdatedAt int64    `json:"updated_at"`
}

Bucket represents the buckets threaddb collection schema.

type Buckets

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

Buckets is a wrapper around a threaddb collection that performs object storage on IPFS and Filecoin.

func New

func New(t *dbc.Client, pgc *powc.Client, col *collections.FFSInstances, debug bool) (*Buckets, error)

New returns a new buckets collection mananger.

func (*Buckets) Archive

func (b *Buckets) Archive(ctx context.Context, dbID thread.ID, key string, c cid.Cid, opts ...Option) error

Archive pushes the current root Cid to the corresponding FFS instance of the bucket. If it's not the first archive, we leverage the Replace() API to more efficient pinning. The operation is async, so it will return as soon as the archiving is scheduled in Powergate.

func (*Buckets) ArchiveStatus

func (b *Buckets) ArchiveStatus(ctx context.Context, key string) (ffs.JobStatus, string, error)

ArchiveStatus returns the last known archive status on Powergate. If the return status is Failed, an extra string with the error message is provided.

func (*Buckets) ArchiveWatch

func (b *Buckets) ArchiveWatch(ctx context.Context, key string, ch chan<- string) error

ArchiveWatch allows to have the last log execution for the last archive, plus realtime human-friendly log output of how the current archive is executing. If the last archive is already done, it will simply return the log history and close the channel.

func (*Buckets) Close

func (b *Buckets) Close() error

func (*Buckets) Create

func (b *Buckets) Create(ctx context.Context, dbID thread.ID, key, name string, pth path.Path, opts ...Option) (*Bucket, error)

Create a bucket instance.

func (*Buckets) Delete

func (b *Buckets) Delete(ctx context.Context, dbID thread.ID, key string, opts ...Option) error

Delete a bucket instance.

func (*Buckets) Get

func (b *Buckets) Get(ctx context.Context, dbID thread.ID, key string, opts ...Option) (*Bucket, error)

Get a bucket instance.

func (*Buckets) IsArchivingEnabled

func (b *Buckets) IsArchivingEnabled() bool

IsArchivingEnabled returns whether or not Powergate archiving is enabled.

func (*Buckets) List

func (b *Buckets) List(ctx context.Context, dbID thread.ID, opts ...Option) ([]*Bucket, error)

List bucket instances.

func (*Buckets) Save

func (b *Buckets) Save(ctx context.Context, dbID thread.ID, bucket *Bucket, opts ...Option) error

Save a bucket instance.

type Deal

type Deal struct {
	ProposalCid string `json:"proposal_cid"`
	Miner       string `json:"miner"`
}

Deal contains details about a Filecoin deal.

type Option

type Option func(*Options)

func WithToken

func WithToken(t thread.Token) Option

type Options

type Options struct {
	Token thread.Token
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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