Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BLog ¶
BLog is an external append only log of the blocks. Blocks should only be written
- to the log after they're irreversible as the log is append only. There is a secondary
- index file of only block positions that enables O(1) random access lookup by block number. *
- A block data in the BLog is formatted as len+payload, len is a uint32 *
- +---------+----------------+---------+----------------+-----+------------+-------------------+
- | Block 1 | Pos of Block 1 | Block 2 | Pos of Block 2 | ... | Head Block | Pos of Head Block |
- +---------+----------------+---------+----------------+-----+------------+-------------------+ *
- +----------------+----------------+-----+-------------------+
- | Pos of Block 1 | Pos of Block 2 | ... | Pos of Head Block |
- +----------------+----------------+-----+-------------------+ * *
- Blocks can be accessed at random via block number through the index file. Seek to 8 * (block_num - 1)
- to find the position of the block in the main file. *
- The main file is the only file that needs to persist. The index file can be reconstructed during a
- linear scan of the main file.
func (*BLog) Append ¶
func (bl *BLog) Append(sb common.ISignedBlock) error
Append appends a common.SignedBlock to the BLog
Click to show internal directories.
Click to hide internal directories.