-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathstore.go
29 lines (21 loc) · 1.15 KB
/
store.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package timelock
import (
"context"
"github.com/code-payments/code-server/pkg/database/query"
timelock_token "github.com/code-payments/code-server/pkg/solana/timelock/v1"
)
type Store interface {
// Save saves a timelock account's state
Save(ctx context.Context, record *Record) error
// GetByAddress gets a timelock account's state by the state address
GetByAddress(ctx context.Context, address string) (*Record, error)
// GetByVault gets a timelock account's state by the vault address it's locking
GetByVault(ctx context.Context, vault string) (*Record, error)
// GetByVaultBatch is like GetByVault, but for multiple accounts. If any one account
// is missing, ErrTimelockNotFound is returned.
GetByVaultBatch(ctx context.Context, vaults ...string) (map[string]*Record, error)
// GetAllByState gets all timelock accounts in the provided state
GetAllByState(ctx context.Context, state timelock_token.TimelockState, cursor query.Cursor, limit uint64, direction query.Ordering) ([]*Record, error)
// GetCountByState gets the count of records in the provided state
GetCountByState(ctx context.Context, state timelock_token.TimelockState) (uint64, error)
}