Documentation
¶
Index ¶
- Constants
- Variables
- type Archive
- type Archives
- type Bucket
- type Buckets
- func (b *Buckets) Archive(ctx context.Context, dbID thread.ID, key string, newCid cid.Cid, ...) 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 string, pth path.Path, opts ...Option) (*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") // ErrZeroBalance is returned when archiving a bucket which // underlying FFS instance balance is zero. ErrZeroBalance = errors.New("bucket FIL balance is zero, if recently created wait 30s") )
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct {
Key string `json:"_id"`
Name string `json:"name"`
Path string `json:"path"`
EncKey string `json:"key,omitempty"`
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, defaultCidConfig *ffs.DefaultConfig, 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, newCid cid.Cid, opts ...Option) error
Archive pushes the current root Cid to the corresponding FFS instance of the bucket. The behaviour changes depending on different cases, depending on a previous archive.
- No previous archive or last one aborted: simply pushes the Cid to the FFS instance.
- Last archive exists with the same Cid: a. Last archive Successful: fails, there's nothing to do. b. Last archive Executing/Queued: fails, that work already starting and is in progress. c. Last archive Failed/Canceled: work to do, push again with override flag to try again.
- Archiving on new Cid: work to do, it will always call Replace(,) in the FFS instance.
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 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.