Documentation
¶
Index ¶
- Constants
- Variables
- func NewAPIKeyContext(ctx context.Context, key *APIKey) context.Context
- func NewAccountContext(ctx context.Context, user, org *Account) context.Context
- func NewSessionContext(ctx context.Context, session *Session) context.Context
- type APIKey
- type APIKeyType
- type APIKeys
- func (k *APIKeys) Create(ctx context.Context, owner thread.PubKey, keyType APIKeyType, secure bool) (*APIKey, error)
- func (k *APIKeys) DeleteByOwner(ctx context.Context, owner thread.PubKey) error
- func (k *APIKeys) Get(ctx context.Context, key string) (*APIKey, error)
- func (k *APIKeys) Invalidate(ctx context.Context, key string) error
- func (k *APIKeys) ListByOwner(ctx context.Context, owner thread.PubKey) ([]APIKey, error)
- type Account
- type AccountCtx
- type AccountType
- type Accounts
- func (a *Accounts) AddMember(ctx context.Context, username string, member Member) error
- func (a *Accounts) CreateDev(ctx context.Context, username, email string, powInfo *PowInfo) (*Account, error)
- func (a *Accounts) CreateOrg(ctx context.Context, name string, members []Member, powInfo *PowInfo) (*Account, error)
- func (a *Accounts) CreateUser(ctx context.Context, key thread.PubKey, powInfo *PowInfo) (*Account, error)
- func (a *Accounts) Delete(ctx context.Context, key thread.PubKey) error
- func (a *Accounts) Get(ctx context.Context, key thread.PubKey) (*Account, error)
- func (a *Accounts) GetByUsername(ctx context.Context, username string) (*Account, error)
- func (a *Accounts) GetByUsernameOrEmail(ctx context.Context, usernameOrEmail string) (*Account, error)
- func (a *Accounts) IsMember(ctx context.Context, username string, member thread.PubKey) (bool, error)
- func (a *Accounts) IsNameAvailable(ctx context.Context, name string) (s string, err error)
- func (a *Accounts) IsOwner(ctx context.Context, username string, member thread.PubKey) (bool, error)
- func (a *Accounts) IsUsernameAvailable(ctx context.Context, username string) error
- func (a *Accounts) ListByMember(ctx context.Context, member thread.PubKey) ([]Account, error)
- func (a *Accounts) ListByOwner(ctx context.Context, owner thread.PubKey) ([]Account, error)
- func (a *Accounts) ListMembers(ctx context.Context, members []Member) ([]Account, error)
- func (a *Accounts) RemoveMember(ctx context.Context, username string, member thread.PubKey) error
- func (a *Accounts) SetToken(ctx context.Context, key thread.PubKey, token thread.Token) error
- func (a *Accounts) UpdatePowInfo(ctx context.Context, key thread.PubKey, powInfo *PowInfo) (*Account, error)
- func (a *Accounts) ValidateUsername(username string) error
- type Archive
- type ArchiveConfig
- type ArchiveRenew
- type ArchiveTracking
- func (at *ArchiveTracking) CreateArchive(ctx context.Context, dbID thread.ID, dbToken thread.Token, bucketKey string, ...) error
- func (at *ArchiveTracking) CreateRetrieval(ctx context.Context, accKey, jobID, powToken string) error
- func (at *ArchiveTracking) Finalize(ctx context.Context, jid string, cause string) error
- func (at *ArchiveTracking) Get(ctx context.Context, jid string) (*TrackedJob, error)
- func (at *ArchiveTracking) GetReadyToCheck(ctx context.Context, n int64) ([]*TrackedJob, error)
- func (at *ArchiveTracking) Reschedule(ctx context.Context, jid string, dur time.Duration, cause string) error
- type Archives
- type BucketArchive
- type BucketArchives
- type Collections
- type DealInfo
- type IPNSKey
- type IPNSKeys
- func (k *IPNSKeys) Create(ctx context.Context, name, cid string, threadID thread.ID, pth string) error
- func (k *IPNSKeys) Delete(ctx context.Context, name string) error
- func (k *IPNSKeys) Get(ctx context.Context, name string) (*IPNSKey, error)
- func (k *IPNSKeys) GetByCid(ctx context.Context, cid string) (*IPNSKey, error)
- func (k *IPNSKeys) List(ctx context.Context) ([]IPNSKey, error)
- func (k *IPNSKeys) ListByThreadID(ctx context.Context, threadID thread.ID) ([]IPNSKey, error)
- func (k *IPNSKeys) SetPath(ctx context.Context, pth string, name string) error
- type Invite
- type Invites
- func (i *Invites) Accept(ctx context.Context, token string) error
- func (i *Invites) Create(ctx context.Context, from thread.PubKey, org, emailTo string) (*Invite, error)
- func (i *Invites) Delete(ctx context.Context, token string) error
- func (i *Invites) DeleteByFrom(ctx context.Context, from thread.PubKey) error
- func (i *Invites) DeleteByFromAndOrg(ctx context.Context, from thread.PubKey, org string) error
- func (i *Invites) DeleteByOrg(ctx context.Context, org string) error
- func (i *Invites) Get(ctx context.Context, token string) (*Invite, error)
- func (i *Invites) ListByEmail(ctx context.Context, email string) ([]Invite, error)
- type Member
- type PowInfo
- type Role
- type Session
- type Sessions
- func (s *Sessions) Create(ctx context.Context, owner thread.PubKey) (*Session, error)
- func (s *Sessions) Delete(ctx context.Context, id string) error
- func (s *Sessions) DeleteByOwner(ctx context.Context, owner thread.PubKey) error
- func (s *Sessions) Get(ctx context.Context, id string) (*Session, error)
- func (s *Sessions) Touch(ctx context.Context, id string) error
- type Thread
- type Threads
- func (t *Threads) Create(ctx context.Context, id thread.ID, owner thread.PubKey, isDB bool) (*Thread, error)
- func (t *Threads) Delete(ctx context.Context, id thread.ID, owner thread.PubKey) error
- func (t *Threads) DeleteByOwner(ctx context.Context, owner thread.PubKey) error
- func (t *Threads) Get(ctx context.Context, id thread.ID, owner thread.PubKey) (*Thread, error)
- func (t *Threads) GetByName(ctx context.Context, name string, owner thread.PubKey) (*Thread, error)
- func (t *Threads) ListByKey(ctx context.Context, key string) ([]Thread, error)
- func (t *Threads) ListByOwner(ctx context.Context, owner thread.PubKey) ([]Thread, error)
- type TrackedJob
Constants ¶
View Source
const (
DuplicateErrMsg = "E11000 duplicate key error"
)
Variables ¶
View Source
var (
ErrInvalidThreadName = fmt.Errorf("name may only contain alphanumeric characters or non-consecutive hyphens, and cannot begin or end with a hyphen")
)
View Source
var (
ErrInvalidUsername = fmt.Errorf("username may only contain alphanumeric characters or single hyphens, " +
"and cannot begin or end with a hyphen")
)
Functions ¶
func NewAccountContext ¶ added in v2.1.4
Types ¶
type APIKey ¶
type APIKeys ¶
type APIKeys struct {
// contains filtered or unexported fields
}
func (*APIKeys) DeleteByOwner ¶
type AccountCtx ¶ added in v2.1.4
func AccountCtxForAccount ¶ added in v2.1.7
func AccountCtxForAccount(account *Account) *AccountCtx
func AccountFromContext ¶ added in v2.1.4
func AccountFromContext(ctx context.Context) (*AccountCtx, bool)
func (*AccountCtx) Owner ¶ added in v2.1.4
func (ac *AccountCtx) Owner() *Account
type Accounts ¶
type Accounts struct {
// contains filtered or unexported fields
}
func (*Accounts) CreateUser ¶ added in v2.1.4
func (*Accounts) GetByUsername ¶
func (*Accounts) GetByUsernameOrEmail ¶
func (*Accounts) IsNameAvailable ¶
func (*Accounts) IsUsernameAvailable ¶
func (*Accounts) ListByMember ¶
func (*Accounts) ListByOwner ¶
func (*Accounts) ListMembers ¶
func (*Accounts) RemoveMember ¶
func (*Accounts) UpdatePowInfo ¶
func (*Accounts) ValidateUsername ¶
type ArchiveConfig ¶ added in v2.1.0
type ArchiveConfig struct {
// RepFactor (ignored in Filecoin mainnet) indicates the desired amount of active deals
// with different miners to store the data. While making deals
// the other attributes of FilConfig are considered for miner selection.
RepFactor int `bson:"rep_factor"`
// DealMinDuration indicates the duration to be used when making new deals.
DealMinDuration int64 `bson:"deal_min_duration"`
// ExcludedMiners (ignored in Filecoin mainnet) is a set of miner addresses won't be ever be selected
// when making new deals, even if they comply to other filters.
ExcludedMiners []string `bson:"excluded_miners"`
// TrustedMiners (ignored in Filecoin mainnet) is a set of miner addresses which will be forcibly used
// when making new deals. An empty/nil list disables this feature.
TrustedMiners []string `bson:"trusted_miners"`
// CountryCodes (ignored in Filecoin mainnet) indicates that new deals should select miners on specific
// countries.
CountryCodes []string `bson:"country_codes"`
// Renew indicates deal-renewal configuration.
Renew ArchiveRenew `bson:"renew"`
// MaxPrice is the maximum price that will be spent to store the data
MaxPrice uint64 `bson:"max_price"`
// FastRetrieval indicates that created deals should enable the
// fast retrieval feature.
FastRetrieval bool `bson:"fast_retrieval"`
// DealStartOffset indicates how many epochs in the future impose a
// deadline to new deals being active on-chain. This value might influence
// if miners accept deals, since they should seal fast enough to satisfy
// this constraint.
DealStartOffset int64 `bson:"deal_start_offset"`
// VerifiedDeal indicates that new deals should be marked as verified,
// assuming the wallet address has enough data-cap.
VerifiedDeal bool `bson:"verified_deal"`
}
ArchiveConfig is the desired state of a Cid in the Filecoin network.
type ArchiveRenew ¶ added in v2.1.0
type ArchiveRenew struct {
// Enabled indicates that deal-renewal is enabled for this Cid.
Enabled bool `bson:"enabled"`
// Threshold indicates how many epochs before expiring should trigger
// deal renewal. e.g: 100 epoch before expiring.
Threshold int `bson:"threshold"`
}
ArchiveRenew contains renew configuration for a ArchiveConfig.
type ArchiveTracking ¶
type ArchiveTracking struct {
// contains filtered or unexported fields
}
func NewArchiveTracking ¶
func (*ArchiveTracking) CreateArchive ¶ added in v2.6.0
func (*ArchiveTracking) CreateRetrieval ¶ added in v2.6.0
func (at *ArchiveTracking) CreateRetrieval(ctx context.Context, accKey, jobID, powToken string) error
func (*ArchiveTracking) Get ¶
func (at *ArchiveTracking) Get(ctx context.Context, jid string) (*TrackedJob, error)
func (*ArchiveTracking) GetReadyToCheck ¶
func (at *ArchiveTracking) GetReadyToCheck(ctx context.Context, n int64) ([]*TrackedJob, error)
func (*ArchiveTracking) Reschedule ¶
type BucketArchive ¶
type BucketArchive struct {
BucketKey string `bson:"_id"`
Archives Archives `bson:"archives"`
DefaultArchiveConfig *ArchiveConfig `bson:"default_archive_config"`
}
type BucketArchives ¶
type BucketArchives struct {
// contains filtered or unexported fields
}
func NewBucketArchives ¶
func (*BucketArchives) Create ¶
func (k *BucketArchives) Create(ctx context.Context, bucketKey string) (*BucketArchive, error)
func (*BucketArchives) GetOrCreate ¶
func (k *BucketArchives) GetOrCreate(ctx context.Context, bucketKey string) (*BucketArchive, error)
func (*BucketArchives) Replace ¶
func (k *BucketArchives) Replace(ctx context.Context, ba *BucketArchive) error
type Collections ¶
type Collections struct {
Sessions *Sessions
Accounts *Accounts
Invites *Invites
Threads *Threads
APIKeys *APIKeys
IPNSKeys *IPNSKeys
BucketArchives *BucketArchives
ArchiveTracking *ArchiveTracking
// contains filtered or unexported fields
}
func NewCollections ¶
NewCollections gets or create store instances for active collections.
func (*Collections) Close ¶
func (c *Collections) Close() error
type DealInfo ¶ added in v2.2.0
type DealInfo struct {
ProposalCid string `bson:"proposal_cid"`
StateID uint64 `bson:"state_id"`
StateName string `bson:"state_name"`
Miner string `bson:"miner"`
PieceCID string `bson:"piece_cid"`
Size uint64 `bson:"size"`
PricePerEpoch uint64 `bson:"price_per_epoch"`
StartEpoch uint64 `bson:"start_epoch"`
Duration uint64 `bson:"duration"`
DealID uint64 `bson:"deal_id"`
ActivationEpoch int64 `bson:"activation_epoch"`
Message string `bson:"message"`
}
type IPNSKeys ¶
type IPNSKeys struct {
// contains filtered or unexported fields
}
func (*IPNSKeys) ListByThreadID ¶
type Invites ¶
type Invites struct {
// contains filtered or unexported fields
}
func (*Invites) DeleteByFrom ¶
func (*Invites) DeleteByFromAndOrg ¶
type Sessions ¶
type Sessions struct {
// contains filtered or unexported fields
}
func (*Sessions) DeleteByOwner ¶
type Threads ¶
type Threads struct {
// contains filtered or unexported fields
}
func (*Threads) DeleteByOwner ¶
type TrackedJob ¶ added in v2.6.0
type TrackedJob struct {
JID string
Type archive.TrackedJobType
ReadyAt time.Time
Cause string
Active bool
// Set by TrackedJobTypeArchive type.
DbID thread.ID
DbToken thread.Token
BucketKey string
BucketRoot cid.Cid
Owner thread.PubKey
// Set by TrackedJobTypeRetrieval type.
PowToken string
AccKey string
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.