Documentation ¶
Index ¶
- Constants
- Variables
- type Archive
- type Archives
- type Bucket
- type Buckets
- func (b *Buckets) Archive(ctx context.Context, dbID thread.ID, key string, c cid.Cid, opts ...Option) error
- func (b *Buckets) ArchiveStatus(ctx context.Context, key string) (ffs.JobStatus, string, error)
- func (b *Buckets) ArchiveWatch(ctx context.Context, key string, ch chan<- string) error
- func (b *Buckets) Close() error
- func (b *Buckets) Create(ctx context.Context, dbID thread.ID, key, name string, pth path.Path, ...) (*Bucket, error)
- func (b *Buckets) Delete(ctx context.Context, dbID thread.ID, key string, opts ...Option) error
- func (b *Buckets) Get(ctx context.Context, dbID thread.ID, key string, opts ...Option) (*Bucket, error)
- func (b *Buckets) IsArchivingEnabled() bool
- func (b *Buckets) List(ctx context.Context, dbID thread.ID, opts ...Option) ([]*Bucket, error)
- func (b *Buckets) Save(ctx context.Context, dbID thread.ID, bucket *Bucket, opts ...Option) error
- type Deal
- type Option
- type Options
Constants ¶
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 ¶
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 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 ¶
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 ¶
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) 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) Get ¶
func (b *Buckets) Get(ctx context.Context, dbID thread.ID, key string, opts ...Option) (*Bucket, error)
Get a bucket instance.
func (*Buckets) IsArchivingEnabled ¶
IsArchivingEnabled returns whether or not Powergate archiving is enabled.