Documentation
¶
Index ¶
- Constants
- func FindCOSEVerifier(ks signer.Keys, kid []byte) key.Verifier
- func TxFrom(obj *Object, verify bool) (*ld.Transaction, error)
- func TxsFrom(os Objects, verify bool) (ld.Txs, error)
- type Chain
- type MemStorage
- func (m *MemStorage) BatchAccept(ctx context.Context, bucket string, height uint64, ...) error
- func (m *MemStorage) BatchAcquire(ctx context.Context, bucket string, hashList ids.IDList[ids.ID32]) error
- func (m *MemStorage) GetObject(ctx context.Context, bucket string, hash ids.ID32) (*Object, error)
- func (m *MemStorage) ListUnaccept(ctx context.Context, bucket, token string) (hashList ids.IDList[ids.ID32], nextToken string, err error)
- func (m *MemStorage) PutObject(ctx context.Context, bucket string, objectRaw []byte) error
- func (m *MemStorage) RemoveObject(ctx context.Context, bucket string, hash ids.ID32) error
- type Object
- type Objects
- type POS
- type RequestParams
- type TxOrBatch
- type TxPool
- type TxPoolOptions
- type TxsBuildStatus
Constants ¶
View Source
const ( TxsBucket = "txs" BatchBucket = "txs:batch" )
View Source
const AcquireRemainingLife = int64(time.Minute * 10)
View Source
const MaxObjectSize = 1 << 20 // 1MB
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Chain ¶
type Chain interface {
GetGenesisTxs(context.Context) (ld.Txs, error)
GetAccount(context.Context, ids.Address) (*ld.Account, error)
PreVerifyTxs(context.Context, ld.Txs) error
}
Chain is Chain's tx interface.
func NewChainAPI ¶
func NewChainAPI(endpoint string, opts *httprpc.CBORClientOptions) Chain
type MemStorage ¶
type MemStorage struct {
// contains filtered or unexported fields
}
MemStorage is in-memory POS for testing.
func (*MemStorage) BatchAccept ¶
func (*MemStorage) BatchAcquire ¶
func (*MemStorage) ListUnaccept ¶
func (*MemStorage) RemoveObject ¶
type Object ¶
type Object struct {
Raw []byte
// -2: rejected, will be remove at expiration time
// -1: wait for build, will be remove if not accepted before expiration time
// 0: processing, will be remove if not accepted before expiration time, except genesis tx objects;
// > 0: accepted, the height of block, the object is permanently stored.
Height int64
}
Object represents a data with LDC's block height in the POS.
type Objects ¶
type Objects []*Object
func (Objects) ToRawList ¶
func (os Objects) ToRawList() []cbor.RawMessage
type POS ¶
type POS interface {
GetObject(ctx context.Context, bucket string, hash ids.ID32) (*Object, error)
PutObject(ctx context.Context, bucket string, objectRaw []byte) error
RemoveObject(ctx context.Context, bucket string, hash ids.ID32) error
BatchAcquire(ctx context.Context, bucket string, hashList ids.IDList[ids.ID32]) error
BatchAccept(ctx context.Context, bucket string, height uint64, hashList ids.IDList[ids.ID32]) error
ListUnaccept(ctx context.Context, bucket, token string) (hashList ids.IDList[ids.ID32], nextToken string, err error)
}
POS is permanent object storage interface.
func NewMemStorage ¶
type RequestParams ¶
type RequestParams struct {
Payload cbor.RawMessage `cbor:"p,omitempty"`
CWT *cose.Sign1Message[cwt.Claims] `cbor:"t,omitempty"`
}
type TxOrBatch ¶
type TxOrBatch struct {
Tx *ld.TxData `cbor:"tx,omitempty"`
Signatures signer.Sigs `cbor:"ss,omitempty"`
ExSignatures signer.Sigs `cbor:"es,omitempty"`
Batch ld.Txs `cbor:"ba,omitempty"`
}
func (*TxOrBatch) ToTransaction ¶
func (t *TxOrBatch) ToTransaction() (*ld.Transaction, error)
type TxPool ¶
type TxPool struct {
// contains filtered or unexported fields
}
TxPool contains all currently known transactions.
func NewTxPool ¶
func NewTxPool(pos POS, chain Chain, opts TxPoolOptions) *TxPool
NewTxPool creates a new transaction pool.
type TxPoolOptions ¶
Click to show internal directories.
Click to hide internal directories.