Documentation ¶
Index ¶
- Constants
- func BlockFormatter(writer io.Writer, getter blocksGetter) error
- func BlockParser(reader io.Reader, blockNum uint64, processor blockProcessor)
- func NewFileReader(filename string) (io.ReadCloser, error)
- func NewFileWriter(filename string) io.WriteCloser
- type Chain
- type Compressor
- func (c *Compressor) BlockParser(reader io.Reader, blockNum uint64, ...)
- func (c *Compressor) ClearData() error
- func (c *Compressor) FileReader(filename string) (io.ReadCloser, error)
- func (c *Compressor) Indexer() *Indexer
- func (c *Compressor) RunTask()
- func (c *Compressor) Start() bool
- func (c *Compressor) Stop() bool
- type CompressorTask
- type Indexer
- func (indexer *Indexer) Add(ti *taskInfo, tmpFile string, blockNumbers uint64) error
- func (indexer *Indexer) CheckAndRepair()
- func (indexer *Indexer) Clear()
- func (indexer *Indexer) Delete(toHeight uint64)
- func (indexer *Indexer) Get(startBlockHeight uint64, endBlockHeight uint64) []*ledger.CompressedFileMeta
- func (indexer *Indexer) LatestHeight() uint64
- type TaskRunResult
Constants ¶
View Source
const ( BlockTypeUnknow = 1 BlockTypeAccountBlock = 2 BlockTypeSnapshotBlock = 3 )
View Source
const ( STOPPED = 0 RUNNING = 1 TASK_RUNNING = 2 )
View Source
const INDEX_SEP = ",,,"
Variables ¶
This section is empty.
Functions ¶
func BlockFormatter ¶
func BlockParser ¶
If blockNum is zero, finish when stream encounter io.EOF
func NewFileReader ¶
func NewFileReader(filename string) (io.ReadCloser, error)
func NewFileWriter ¶
func NewFileWriter(filename string) io.WriteCloser
Types ¶
type Chain ¶
type Chain interface { GetConfirmSubLedger(fromHeight uint64, toHeight uint64) ([]*ledger.SnapshotBlock, map[types.Address][]*ledger.AccountBlock, error) GetLatestSnapshotBlock() *ledger.SnapshotBlock }
type Compressor ¶
type Compressor struct {
// contains filtered or unexported fields
}
func NewCompressor ¶
func NewCompressor(chain Chain, dataDir string) *Compressor
func (*Compressor) BlockParser ¶
func (*Compressor) ClearData ¶
func (c *Compressor) ClearData() error
func (*Compressor) FileReader ¶
func (c *Compressor) FileReader(filename string) (io.ReadCloser, error)
func (*Compressor) Indexer ¶
func (c *Compressor) Indexer() *Indexer
func (*Compressor) RunTask ¶
func (c *Compressor) RunTask()
func (*Compressor) Start ¶
func (c *Compressor) Start() bool
func (*Compressor) Stop ¶
func (c *Compressor) Stop() bool
type CompressorTask ¶
type CompressorTask struct {
// contains filtered or unexported fields
}
func NewCompressorTask ¶
func NewCompressorTask(chain Chain, tmpFile string, indexerHeight uint64) *CompressorTask
func (*CompressorTask) Clear ¶
func (task *CompressorTask) Clear()
func (*CompressorTask) Run ¶
func (task *CompressorTask) Run() *TaskRunResult
type Indexer ¶
type Indexer struct {
// contains filtered or unexported fields
}
func NewIndexer ¶
func (*Indexer) CheckAndRepair ¶ added in v1.3.0
func (indexer *Indexer) CheckAndRepair()
func (*Indexer) Get ¶
func (indexer *Indexer) Get(startBlockHeight uint64, endBlockHeight uint64) []*ledger.CompressedFileMeta
func (*Indexer) LatestHeight ¶
type TaskRunResult ¶
Click to show internal directories.
Click to hide internal directories.