Documentation ¶
Index ¶
- Variables
- func InitMetrics()
- type Client
- func (hc *Client) CheckMissingTransactions(ctx context.Context, nv NetworkVersion, heightRange shared.HeightRange, ...) (missingBlocks, missingTransactions [][2]uint64, err error)
- func (hc *Client) GetMissingTransactions(ctx context.Context, nv NetworkVersion, heightRange shared.HeightRange, ...) (run *Run, err error)
- func (hc *Client) GetRunningTransactions(ctx context.Context) (run []Run, err error)
- func (hc *Client) GetTransaction(ctx context.Context, nv NetworkVersion, id string) ([]shared.Transaction, error)
- func (hc *Client) GetTransactions(ctx context.Context, nv NetworkVersion, heightRange shared.HeightRange, ...) ([]shared.Transaction, error)
- func (hc *Client) InsertTransactions(ctx context.Context, nv NetworkVersion, readr io.ReadCloser) error
- func (hc *Client) LinkSender(sender TaskSender)
- func (hc *Client) ScrapeLatest(ctx context.Context, ldr shared.LatestDataRequest) (ldResp shared.LatestDataResponse, er error)
- func (hc *Client) SearchTransactions(ctx context.Context, ts shared.TransactionSearch) ([]shared.Transaction, error)
- type ClientContractor
- type ControllContractor
- type NetworkVersion
- type Progresser
- type ReqOut
- type Run
- type RunProgress
- type RunReq
- type RunResp
- type Runner
- type SchedulerContractor
- type TaskSender
Constants ¶
This section is empty.
Variables ¶
var ErrIntegrityCheckFailed = errors.New("integrity check failed")
var SelfCheck = true
SelfCheck Flag describing should manager check anyway the latest version for network it has
Functions ¶
func InitMetrics ¶
func InitMetrics()
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CheckMissingTransactions ¶
func (hc *Client) CheckMissingTransactions(ctx context.Context, nv NetworkVersion, heightRange shared.HeightRange, window uint64) (missingBlocks, missingTransactions [][2]uint64, err error)
CheckMissingTransactions checks consistency of database if every transaction is written correctly (all blocks + correct transaction number from blocks)
func (*Client) GetMissingTransactions ¶
func (hc *Client) GetMissingTransactions(ctx context.Context, nv NetworkVersion, heightRange shared.HeightRange, window uint64, async bool, force bool) (run *Run, err error)
GetMissingTransactions gets missing transactions for given height range using CheckMissingTransactions. This may run very very long (aka synchronize entire chain). For that kind of operations async parameter got added and runner was created.
func (*Client) GetRunningTransactions ¶
GetRunningTransactions gets running transactions
func (*Client) GetTransaction ¶
func (hc *Client) GetTransaction(ctx context.Context, nv NetworkVersion, id string) ([]shared.Transaction, error)
func (*Client) GetTransactions ¶
func (hc *Client) GetTransactions(ctx context.Context, nv NetworkVersion, heightRange shared.HeightRange, batchLimit uint64, silent bool) ([]shared.Transaction, error)
GetTransactions gets transaction range and stores it in the database with respective blocks
func (*Client) InsertTransactions ¶
func (hc *Client) InsertTransactions(ctx context.Context, nv NetworkVersion, readr io.ReadCloser) error
InsertTransactions inserts external transactions batch
func (*Client) LinkSender ¶
func (hc *Client) LinkSender(sender TaskSender)
func (*Client) ScrapeLatest ¶
func (hc *Client) ScrapeLatest(ctx context.Context, ldr shared.LatestDataRequest) (ldResp shared.LatestDataResponse, er error)
ScrapeLatest scrapes latest data using the latest known block from database
func (*Client) SearchTransactions ¶
func (hc *Client) SearchTransactions(ctx context.Context, ts shared.TransactionSearch) ([]shared.Transaction, error)
SearchTransactions is the search
type ClientContractor ¶
type ClientContractor interface { SchedulerContractor ControllContractor SearchTransactions(ctx context.Context, ts shared.TransactionSearch) ([]shared.Transaction, error) GetTransaction(ctx context.Context, nv NetworkVersion, id string) ([]shared.Transaction, error) GetTransactions(ctx context.Context, nv NetworkVersion, heightRange shared.HeightRange, batchLimit uint64, silent bool) ([]shared.Transaction, error) }
ClientContractor a format agnostic
type ControllContractor ¶
type ControllContractor interface { InsertTransactions(ctx context.Context, nv NetworkVersion, read io.ReadCloser) error CheckMissingTransactions(ctx context.Context, nv NetworkVersion, heightRange shared.HeightRange, window uint64) (missingBlocks, missingTransactions [][2]uint64, err error) GetMissingTransactions(ctx context.Context, nv NetworkVersion, heightRange shared.HeightRange, window uint64, async bool, force bool) (run *Run, err error) GetRunningTransactions(ctx context.Context) (run []Run, err error) }
type NetworkVersion ¶
type Progresser ¶
type Progresser interface {
Report(done shared.HeightRange, duration time.Duration, err []error, finished bool)
}
Progresser is interface that allows to report progress
type Run ¶
type Run struct { sync.Mutex `json:"-"` NV NetworkVersion `json:"nv"` HeightRange shared.HeightRange `json:"height_range"` Ctx context.Context `json:"-"` Cancel context.CancelFunc `json:"-"` Progress []RunProgress `json:"run_progress"` Success bool `json:"success"` Finished bool `json:"finished"` StartedTime time.Time `json:"started_time"` FinishTime time.Time `json:"finished_time"` LastProgressTime time.Time `json:"last_progress_time"` }
Run is process handler
func NewRun ¶
func NewRun(ctx context.Context, nv NetworkVersion, heightRange shared.HeightRange) *Run
NewRun is Run constructor
type RunProgress ¶
type RunProgress struct { Done shared.HeightRange `json:"done"` D time.Duration `json:"duration"` T time.Time `json:"time"` Errors []error `json:"errors"` }
RunProgress info
type RunReq ¶
type RunReq struct { Kind string //Type NV NetworkVersion HeightRange shared.HeightRange Force bool Resp chan RunResp }
RunReq async task structure
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner is a runner for async long running process.
Sometimes there is a need to run process asynchronously. Runner serves as a simple manager for NetworkVersion pairs
func (*Runner) GetRunning ¶
func (*Runner) StartProcess ¶
func (r *Runner) StartProcess(nv NetworkVersion, heightRange shared.HeightRange, force bool) (bool, *Run, error)
StartProcess starts task waiting until task will be started then return it's reference.
func (*Runner) StopProcess ¶
func (r *Runner) StopProcess(nv NetworkVersion, heightRange shared.HeightRange) error
StopProcess stops task
type SchedulerContractor ¶
type SchedulerContractor interface {
ScrapeLatest(ctx context.Context, ldr shared.LatestDataRequest) (ldResp shared.LatestDataResponse, er error)
}
type TaskSender ¶
type TaskSender interface {
Send([]structs.TaskRequest) (*structs.Await, error)
}