Documentation
¶
Index ¶
- Variables
- type ChainService
- type ChainStatus
- type Contract
- type Infrastructure
- type Instance
- type Registry
- type Repository
- type Status
- type TraceService
- func (t *TraceService) AddUnconfirmedTx(tx *types.Tx)
- func (t *TraceService) ApplyBlock(block *types.Block) error
- func (t *TraceService) BestHash() bc.Hash
- func (t *TraceService) BestHeight() uint64
- func (t *TraceService) CreateInstance(txHash, blockHash bc.Hash) ([]string, error)
- func (t *TraceService) DetachBlock(block *types.Block) error
- func (t *TraceService) GetInstance(traceID string) (*Instance, error)
- func (t *TraceService) RemoveInstance(traceID string) error
- type TraceStore
- func (t *TraceStore) GetChainStatus() *ChainStatus
- func (t *TraceStore) GetInstance(traceID string) (*Instance, error)
- func (t *TraceStore) LoadInstances() ([]*Instance, error)
- func (t *TraceStore) RemoveInstance(traceID string)
- func (t *TraceStore) SaveChainStatus(chainStatus *ChainStatus) error
- func (t *TraceStore) SaveInstances(instances []*Instance) error
- func (t *TraceStore) SaveInstancesWithStatus(instances []*Instance, blockHeight uint64, blockHash bc.Hash) error
- type TraceUpdater
- type TreeNode
- type UTXO
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrContractDuplicated = errors.New("contract is duplicated") ErrContractNotFound = errors.New("contract not found") )
pre-define errors for supporting bytom errorFormatter
Functions ¶
This section is empty.
Types ¶
type ChainService ¶
type ChainStatus ¶
type Contract ¶
type Contract struct {
Hash chainjson.HexBytes `json:"id"`
Alias string `json:"alias"`
Contract chainjson.HexBytes `json:"contract"`
CallProgram chainjson.HexBytes `json:"call_program"`
RegisterProgram chainjson.HexBytes `json:"register_program"`
}
Contract describe user contract
type Infrastructure ¶
type Infrastructure struct {
Chain ChainService
Repository Repository
}
func NewInfrastructure ¶
func NewInfrastructure(chain ChainService, repository Repository) *Infrastructure
type Instance ¶
type Instance struct {
TraceID string `json:"trace_id"`
UTXOs []*UTXO `json:"utxos"`
TxHash *bc.Hash `json:"tx_hash"`
Status Status `json:"status"`
EndedHeight uint64 `json:"ended_height"`
ScannedHash bc.Hash `json:"scanned_hash"`
ScannedHeight uint64 `json:"scanned_height"`
Unconfirmed []*TreeNode
}
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry tracks and stores all user contract.
func (*Registry) GetContract ¶
GetContract get user contract
func (*Registry) ListContracts ¶
ListContracts returns user contracts
func (*Registry) SaveContract ¶
SaveContract save user contract
type Repository ¶
type Repository interface {
GetInstance(traceID string) (*Instance, error)
LoadInstances() ([]*Instance, error)
SaveInstances(instances []*Instance) error
SaveInstancesWithStatus(instances []*Instance, blockHeight uint64, blockHash bc.Hash) error
RemoveInstance(traceID string)
GetChainStatus() *ChainStatus
SaveChainStatus(status *ChainStatus) error
}
type TraceService ¶
func NewTraceService ¶
func NewTraceService(infra *Infrastructure) *TraceService
func (*TraceService) AddUnconfirmedTx ¶
func (t *TraceService) AddUnconfirmedTx(tx *types.Tx)
func (*TraceService) ApplyBlock ¶
func (t *TraceService) ApplyBlock(block *types.Block) error
func (*TraceService) BestHash ¶
func (t *TraceService) BestHash() bc.Hash
func (*TraceService) BestHeight ¶
func (t *TraceService) BestHeight() uint64
func (*TraceService) CreateInstance ¶
func (t *TraceService) CreateInstance(txHash, blockHash bc.Hash) ([]string, error)
func (*TraceService) DetachBlock ¶
func (t *TraceService) DetachBlock(block *types.Block) error
func (*TraceService) GetInstance ¶
func (t *TraceService) GetInstance(traceID string) (*Instance, error)
func (*TraceService) RemoveInstance ¶
func (t *TraceService) RemoveInstance(traceID string) error
type TraceStore ¶
type TraceStore struct {
// contains filtered or unexported fields
}
func NewTraceStore ¶
func NewTraceStore(db dbm.DB) *TraceStore
func (*TraceStore) GetChainStatus ¶
func (t *TraceStore) GetChainStatus() *ChainStatus
GetChainStatus return the current chain status
func (*TraceStore) GetInstance ¶
func (t *TraceStore) GetInstance(traceID string) (*Instance, error)
GetInstance return instance by given trace id
func (*TraceStore) LoadInstances ¶
func (t *TraceStore) LoadInstances() ([]*Instance, error)
LoadInstances used to load all instances in db
func (*TraceStore) RemoveInstance ¶
func (t *TraceStore) RemoveInstance(traceID string)
RemoveInstance delete a instance by given trace id
func (*TraceStore) SaveChainStatus ¶
func (t *TraceStore) SaveChainStatus(chainStatus *ChainStatus) error
SaveChainStatus save the chain status
func (*TraceStore) SaveInstances ¶
func (t *TraceStore) SaveInstances(instances []*Instance) error
SaveInstances used to batch save multiple instances
func (*TraceStore) SaveInstancesWithStatus ¶
func (t *TraceStore) SaveInstancesWithStatus(instances []*Instance, blockHeight uint64, blockHash bc.Hash) error
SaveInstancesWithStatus batch save the instances and chain status
type TraceUpdater ¶
type TraceUpdater struct {
*TraceService
// contains filtered or unexported fields
}
func NewTraceUpdater ¶
func NewTraceUpdater(traceService *TraceService, chain ChainService) *TraceUpdater
func (*TraceUpdater) Sync ¶
func (t *TraceUpdater) Sync()
Click to show internal directories.
Click to hide internal directories.