Documentation ¶
Index ¶
- Constants
- type Block
- type Coin
- type Coins
- type CosmosTx
- type Fee
- type RawLog
- type SyncCosmosTask
- func (d *SyncCosmosTask) GetExecutableTask(maxWorkerSleepTime int64) ([]SyncCosmosTask, error)
- func (d *SyncCosmosTask) GetMaxBlockHeight() (int64, error)
- func (d *SyncCosmosTask) GetTaskById(id bson.ObjectId) (SyncCosmosTask, error)
- func (d *SyncCosmosTask) GetTaskByIdAndWorker(id bson.ObjectId, worker string) (SyncCosmosTask, error)
- func (d *SyncCosmosTask) Name() string
- func (d *SyncCosmosTask) PkKvPair() map[string]interface{}
- func (d *SyncCosmosTask) QueryAll(status []string, taskType string) ([]SyncCosmosTask, error)
- func (d *SyncCosmosTask) TakeOverTask(task SyncCosmosTask, workerId string) error
- func (d *SyncCosmosTask) UpdateLastUpdateTime(task SyncCosmosTask) error
- type Tag
- type WorkerLog
Constants ¶
View Source
const (
CollectionNameBlock = "sync_cosmos_block"
)
View Source
const (
CollectionNameCosmosTx = "sync_cosmos_tx"
)
View Source
const (
CollectionNameSyncCosmosTask = "sync_cosmos_task"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CosmosTx ¶
type CosmosTx struct { Time time.Time `bson:"time"` Height int64 `bson:"height"` TxHash string `bson:"tx_hash"` From string `bson:"from"` To string `bson:"to"` Initiator string `bson:"initiator"` Amount []*Coin `bson:"amount"` Type string `bson:"type"` Fee *Fee `bson:"fee"` Memo string `bson:"memo"` Status string `bson:"status"` Code uint32 `bson:"code"` Tags map[string]string `bson:"tags"` }
type SyncCosmosTask ¶
type SyncCosmosTask struct { ID bson.ObjectId `bson:"_id"` StartHeight int64 `bson:"start_height"` // task start height EndHeight int64 `bson:"end_height"` // task end height CurrentHeight int64 `bson:"current_height"` // task current height Status string `bson:"status"` // task status WorkerId string `bson:"worker_id"` // worker id WorkerLogs []WorkerLog `bson:"worker_logs"` // worker logs LastUpdateTime int64 `bson:"last_update_time"` // unix timestamp }
func (*SyncCosmosTask) GetExecutableTask ¶
func (d *SyncCosmosTask) GetExecutableTask(maxWorkerSleepTime int64) ([]SyncCosmosTask, error)
func (*SyncCosmosTask) GetMaxBlockHeight ¶
func (d *SyncCosmosTask) GetMaxBlockHeight() (int64, error)
get max block height in sync task
func (*SyncCosmosTask) GetTaskById ¶
func (d *SyncCosmosTask) GetTaskById(id bson.ObjectId) (SyncCosmosTask, error)
func (*SyncCosmosTask) GetTaskByIdAndWorker ¶
func (d *SyncCosmosTask) GetTaskByIdAndWorker(id bson.ObjectId, worker string) (SyncCosmosTask, error)
func (*SyncCosmosTask) Name ¶
func (d *SyncCosmosTask) Name() string
func (*SyncCosmosTask) PkKvPair ¶
func (d *SyncCosmosTask) PkKvPair() map[string]interface{}
func (*SyncCosmosTask) QueryAll ¶
func (d *SyncCosmosTask) QueryAll(status []string, taskType string) ([]SyncCosmosTask, error)
query record by status
func (*SyncCosmosTask) TakeOverTask ¶
func (d *SyncCosmosTask) TakeOverTask(task SyncCosmosTask, workerId string) error
take over a task update status, worker_id, worker_logs and last_update_time
func (*SyncCosmosTask) UpdateLastUpdateTime ¶
func (d *SyncCosmosTask) UpdateLastUpdateTime(task SyncCosmosTask) error
update task last update time
Click to show internal directories.
Click to hide internal directories.