Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type ByActionId ¶
type ByActionId []*Record
func (ByActionId) Len ¶
func (a ByActionId) Len() int
func (ByActionId) Less ¶
func (a ByActionId) Less(i, j int) bool
func (ByActionId) Swap ¶
func (a ByActionId) Swap(i, j int)
type Record ¶
type Record struct { Id uint64 Intent string IntentType intent.Type ActionId uint32 ActionType Type Source string // Source token account involved Destination *string // Destination token account involved, when it makes sense // Kin quark amount involved, when it makes sense. This must be set for actions // that make balance changes across Code accounts! For deferred actions that are // initially in the unknown state, the balance may be nil and updated at a later // time. Store implementations will enforce which actions will allow quantity updates. // // todo: We have some options of how to handle balance calculations for actions in // the unknown state. For now, remain in the most flexible state (ie. set quantity // as needed and include everything in the calculation). We'll wait for more // use cases before forming a firm opinion. Quantity *uint64 InitiatorPhoneNumber *string State State CreatedAt time.Time }
type Store ¶
type Store interface { // PutAll creates all actions in one transaction PutAll(ctx context.Context, records ...*Record) error // Update updates an existing action record Update(ctx context.Context, record *Record) error // GetById gets an action by its ID GetById(ctx context.Context, intent string, actionId uint32) (*Record, error) // GetAllByIntent gets all actions for a given intent GetAllByIntent(ctx context.Context, intent string) ([]*Record, error) // GetAllByAddress gets all actions for a given address as a source or destination. // // todo: Support paging for accounts that might have many actions when a use case emerges GetAllByAddress(ctx context.Context, address string) ([]*Record, error) // GetNetBalance gets the net balance of Kin in quarks after appying actions // that operate on balances. GetNetBalance(ctx context.Context, account string) (int64, error) // GetNetBalanceBatch is like GetNetBalance, but for a batch of accounts. GetNetBalanceBatch(ctx context.Context, accounts ...string) (map[string]int64, error) // GetGiftCardClaimedAction gets the action where the gift card was claimed, // which is a NoPrivacyWithdraw with the giftCardVault as a source. This DB // cannot validate the account type, so that must be done prior to making this // call elsewhere. GetGiftCardClaimedAction(ctx context.Context, giftCardVault string) (*Record, error) // GetGiftCardAutoReturnAction gets the action where the gift card will be // auto-returned, which is a CloseDormantAccount action with the giftCardVault // as a source. This DB cannot validate the account type, so that must be done // prior to making this call elsewhere. GetGiftCardAutoReturnAction(ctx context.Context, giftCardVault string) (*Record, error) }
Click to show internal directories.
Click to hide internal directories.