chain_block

package
v0.0.0-...-96daba7 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2019 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockTypeUnknown       = byte(0)
	BlockTypeAccountBlock  = byte(1)
	BlockTypeSnapshotBlock = byte(2)
)

Variables

View Source
var ClosedErr = errors.New("blockFileParser is closed")

Functions

This section is empty.

Types

type BlockDB

type BlockDB struct {
	// contains filtered or unexported fields
}

func NewBlockDB

func NewBlockDB(chainDir string) (*BlockDB, error)

func (*BlockDB) AfterCommit

func (bDB *BlockDB) AfterCommit()

lock write

func (*BlockDB) AfterRecover

func (bDB *BlockDB) AfterRecover()

func (*BlockDB) BeforeRecover

func (bDB *BlockDB) BeforeRecover(redoLog []byte)

func (*BlockDB) CancelPrepare

func (bDB *BlockDB) CancelPrepare()

Assume locking writing (lock the insertion and deletion of account block and snapshot block) nextFlushStartLocation is the start location of the next flush. bDB.flushStartLocation is

func (*BlockDB) Close

func (bDB *BlockDB) Close() error

func (*BlockDB) Commit

func (bDB *BlockDB) Commit() error

func (*BlockDB) FileSize

func (bDB *BlockDB) FileSize() int64

func (*BlockDB) GetAccountBlock

func (bDB *BlockDB) GetAccountBlock(location *chain_file_manager.Location) (*ledger.AccountBlock, error)

func (*BlockDB) GetNextLocation

func (bDB *BlockDB) GetNextLocation(location *chain_file_manager.Location) (*chain_file_manager.Location, error)

func (*BlockDB) GetSnapshotBlock

func (bDB *BlockDB) GetSnapshotBlock(location *chain_file_manager.Location) (*ledger.SnapshotBlock, error)

func (*BlockDB) GetSnapshotHeader

func (bDB *BlockDB) GetSnapshotHeader(location *chain_file_manager.Location) (*ledger.SnapshotBlock, error)

TODO optimize

func (*BlockDB) GetStatus

func (bDB *BlockDB) GetStatus() []interfaces.DBStatus

func (*BlockDB) Id

func (bDB *BlockDB) Id() types.Hash

func (*BlockDB) PatchRedoLog

func (bDB *BlockDB) PatchRedoLog(redoLog []byte) error

func (*BlockDB) Prepare

func (bDB *BlockDB) Prepare()

lock write

func (*BlockDB) PrepareRollback

func (bDB *BlockDB) PrepareRollback(location *chain_file_manager.Location) ([]*ledger.SnapshotChunk, error)

func (*BlockDB) Read

func (bDB *BlockDB) Read(location *chain_file_manager.Location) ([]byte, error)

func (*BlockDB) ReadRange

func (bDB *BlockDB) ReadRange(startLocation *chain_file_manager.Location, endLocation *chain_file_manager.Location) ([]*ledger.SnapshotChunk, error)

func (*BlockDB) ReadRaw

func (bDB *BlockDB) ReadRaw(startLocation *chain_file_manager.Location, buf []byte) (*chain_file_manager.Location, int, error)

func (*BlockDB) RedoLog

func (bDB *BlockDB) RedoLog() ([]byte, error)

func (*BlockDB) Rollback

func (bDB *BlockDB) Rollback(location *chain_file_manager.Location) error

func (*BlockDB) SetLog

func (bDB *BlockDB) SetLog(h log15.Handler)

func (*BlockDB) Write

func (bDB *BlockDB) Write(ss *ledger.SnapshotChunk) ([]*chain_file_manager.Location, *chain_file_manager.Location, error)

type BufWriter

type BufWriter struct {
	Buffer *bytes.Buffer
	Err    error
}

func NewBufWriter

func NewBufWriter() *BufWriter

func (*BufWriter) Close

func (w *BufWriter) Close() error

func (*BufWriter) Release

func (w *BufWriter) Release()

func (*BufWriter) Write

func (w *BufWriter) Write(data []byte) error

func (*BufWriter) WriteError

func (w *BufWriter) WriteError(err error)

Jump to

Keyboard shortcuts

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