Documentation ¶
Index ¶
- Variables
- type Archive
- type Archives
- type Bucket
- type BucketOption
- type BucketOptions
- type Buckets
- 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) IsArchivingEnabled() bool
- func (b *Buckets) New(ctx context.Context, dbID thread.ID, key string, pth path.Path, ...) (*Bucket, error)
- func (b *Buckets) SaveSafe(ctx context.Context, dbID thread.ID, bucket *Bucket, opts ...Option) error
- type Collection
- func (c *Collection) Create(ctx context.Context, dbID thread.ID, instance interface{}, opts ...Option) (coredb.InstanceID, error)
- func (c *Collection) Delete(ctx context.Context, dbID thread.ID, id string, opts ...Option) error
- func (c *Collection) Get(ctx context.Context, dbID thread.ID, key string, instance interface{}, ...) error
- func (c *Collection) List(ctx context.Context, dbID thread.ID, query *db.Query, instance interface{}, ...) (interface{}, error)
- func (c *Collection) Save(ctx context.Context, dbID thread.ID, instance interface{}, opts ...Option) error
- type Deal
- type InboxMessage
- type Mail
- type Option
- type Options
- type SentboxMessage
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMailboxExists indicates that a mailbox with the same name and owner already exists. ErrMailboxExists = errors.New("mailbox already exists") )
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 BucketOption ¶
type BucketOption func(*BucketOptions)
BucketOption holds a bucket option.
func WithNewBucketKey ¶
func WithNewBucketKey(k []byte) BucketOption
WithNewBucketKey sets the bucket encryption key.
func WithNewBucketName ¶
func WithNewBucketName(n string) BucketOption
WithNewBucketName specifies a name for a bucket. Note: This is only valid when creating a new bucket.
func WithNewBucketToken ¶
func WithNewBucketToken(t thread.Token) BucketOption
WithNewBucketToken sets the threaddb token.
type BucketOptions ¶
BucketOptions defines options for interacting with buckets.
type Buckets ¶
type Buckets struct { Collection // contains filtered or unexported fields }
Buckets is a wrapper around a threaddb collection that performs object storage on IPFS and Filecoin.
func NewBuckets ¶
func NewBuckets(tc *dbc.Client, pgc *powc.Client, col *mdb.FFSInstances, defaultCidConfig *ffs.DefaultConfig) (*Buckets, error)
NewBuckets returns a new buckets collection mananger.
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) IsArchivingEnabled ¶
IsArchivingEnabled returns whether or not Powergate archiving is enabled.
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
Collection wraps a ThreadDB collection with some convenience methods.
func (*Collection) Create ¶
func (c *Collection) Create(ctx context.Context, dbID thread.ID, instance interface{}, opts ...Option) (coredb.InstanceID, error)
Create a collection instance.
func (*Collection) Get ¶
func (c *Collection) Get(ctx context.Context, dbID thread.ID, key string, instance interface{}, opts ...Option) error
Get a collection instance.
type InboxMessage ¶
type InboxMessage struct { ID string `json:"_id"` From string `json:"from"` To string `json:"to"` Body string `json:"body"` Signature string `json:"signature"` CreatedAt int64 `json:"created_at"` ReadAt int64 `json:"read_at"` }
InboxMessage represents the inbox threaddb collection schema.
type Mail ¶
type Mail struct { Inbox Collection Sentbox Collection // contains filtered or unexported fields }
Mail is a wrapper around a threaddb collection for sending mail between users.