Documentation ¶
Index ¶
- Constants
- Variables
- type BlockDB
- func (bDB *BlockDB) AfterCommit()
- func (bDB *BlockDB) AfterRecover()
- func (bDB *BlockDB) BeforeRecover(redoLog []byte)
- func (bDB *BlockDB) CancelPrepare()
- func (bDB *BlockDB) Close() error
- func (bDB *BlockDB) Commit() error
- func (bDB *BlockDB) FileSize() int64
- func (bDB *BlockDB) GetAccountBlock(location *chain_file_manager.Location) (*ledger.AccountBlock, error)
- func (bDB *BlockDB) GetNextLocation(location *chain_file_manager.Location) (*chain_file_manager.Location, error)
- func (bDB *BlockDB) GetSnapshotBlock(location *chain_file_manager.Location) (*ledger.SnapshotBlock, error)
- func (bDB *BlockDB) GetSnapshotHeader(location *chain_file_manager.Location) (*ledger.SnapshotBlock, error)
- func (bDB *BlockDB) GetStatus() []interfaces.DBStatus
- func (bDB *BlockDB) Id() types.Hash
- func (bDB *BlockDB) PatchRedoLog(redoLog []byte) error
- func (bDB *BlockDB) Prepare()
- func (bDB *BlockDB) PrepareRollback(location *chain_file_manager.Location) ([]*ledger.SnapshotChunk, error)
- func (bDB *BlockDB) Read(location *chain_file_manager.Location) ([]byte, error)
- func (bDB *BlockDB) ReadChunk(location chain_file_manager.Location) (*ledger.SnapshotChunk, *chain_file_manager.Location, error)
- func (bDB *BlockDB) ReadRange(startLocation *chain_file_manager.Location, ...) ([]*ledger.SnapshotChunk, error)
- func (bDB *BlockDB) ReadRaw(startLocation *chain_file_manager.Location, buf []byte) (*chain_file_manager.Location, int, error)
- func (bDB *BlockDB) ReadUnit(location *chain_file_manager.Location) (*ledger.SnapshotBlock, *ledger.AccountBlock, *chain_file_manager.Location, ...)
- func (bDB *BlockDB) ReadUnitBytes(location *chain_file_manager.Location) ([]byte, *chain_file_manager.Location, error)
- func (bDB *BlockDB) RedoLog() ([]byte, error)
- func (bDB *BlockDB) Rollback(location *chain_file_manager.Location) error
- func (bDB *BlockDB) SetLog(h log15.Handler)
- func (bDB *BlockDB) Write(ss *ledger.SnapshotChunk) (map[types.Hash]*chain_file_manager.Location, *chain_file_manager.Location, ...)
- type BufWriter
Constants ¶
View Source
const ( BlockTypeUnknown = byte(0) BlockTypeAccountBlock = byte(1) BlockTypeSnapshotBlock = byte(2) )
Variables ¶
View Source
var ClosedErr = errors.New("blockFileParser is closed")
View Source
var (
FixFileSize = int64(10 * 1024 * 1024)
)
Functions ¶
This section is empty.
Types ¶
type BlockDB ¶
type BlockDB struct {
// contains filtered or unexported fields
}
BlockDB append all blocks to file
func NewBlockDB ¶
NewBlockDB instance for BlocksDB
func NewBlockDBFixedSize ¶
NewBlockDB instance for BlocksDB
func (*BlockDB) AfterRecover ¶
func (bDB *BlockDB) AfterRecover()
func (*BlockDB) BeforeRecover ¶
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) GetAccountBlock ¶
func (bDB *BlockDB) GetAccountBlock(location *chain_file_manager.Location) (*ledger.AccountBlock, error)
GetAccountBlock by location
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)
GetSnapshotBlock by location
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) PatchRedoLog ¶
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) ReadChunk ¶
func (bDB *BlockDB) ReadChunk(location chain_file_manager.Location) (*ledger.SnapshotChunk, *chain_file_manager.Location, 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) ReadUnit ¶
func (bDB *BlockDB) ReadUnit(location *chain_file_manager.Location) (*ledger.SnapshotBlock, *ledger.AccountBlock, *chain_file_manager.Location, error)
func (*BlockDB) ReadUnitBytes ¶
func (bDB *BlockDB) ReadUnitBytes(location *chain_file_manager.Location) ([]byte, *chain_file_manager.Location, error)
func (*BlockDB) Rollback ¶
func (bDB *BlockDB) Rollback(location *chain_file_manager.Location) error
func (*BlockDB) Write ¶
func (bDB *BlockDB) Write(ss *ledger.SnapshotChunk) (map[types.Hash]*chain_file_manager.Location, *chain_file_manager.Location, error)
Click to show internal directories.
Click to hide internal directories.