compress

package
v1.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2019 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

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 BlockFormatter(writer io.Writer, getter blocksGetter) error

func BlockParser

func BlockParser(reader io.Reader, blockNum uint64, processor blockProcessor)

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 (c *Compressor) BlockParser(reader io.Reader, blockNum uint64, processFunc func(block ledger.Block, err error))

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 NewIndexer(dir string, chainInstance Chain) *Indexer

func (*Indexer) Add

func (indexer *Indexer) Add(ti *taskInfo, tmpFile string, blockNumbers uint64) error

func (*Indexer) CheckAndRepair added in v1.3.0

func (indexer *Indexer) CheckAndRepair()

func (*Indexer) Clear

func (indexer *Indexer) Clear()

func (*Indexer) Delete

func (indexer *Indexer) Delete(toHeight uint64)

func (*Indexer) Get

func (indexer *Indexer) Get(startBlockHeight uint64, endBlockHeight uint64) []*ledger.CompressedFileMeta

func (*Indexer) LatestHeight

func (indexer *Indexer) LatestHeight() uint64

type TaskRunResult

type TaskRunResult struct {
	Ti           *taskInfo
	IsSuccess    bool
	BlockNumbers uint64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL