Documentation ¶
Index ¶
- func AddBlockToBlockchain(log *ipfsLog.ZapEventLogger, b *block.Block, db *BlockchainDB) bool
- type BlockchainDB
- func (pdb *BlockchainDB) Close(log *ipfsLog.ZapEventLogger) error
- func (pdb *BlockchainDB) GetBlock(log *ipfsLog.ZapEventLogger, key []byte) (*block.Block, error)
- func (pdb *BlockchainDB) GetLastBlock(log *ipfsLog.ZapEventLogger) *block.Block
- func (pdb *BlockchainDB) SaveBlock(log *ipfsLog.ZapEventLogger, key []byte, b *block.Block) error
- func (pdb *BlockchainDB) VerifyIntegrity(log *ipfsLog.ZapEventLogger) bool
- type BlockchainStorage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddBlockToBlockchain ¶
func AddBlockToBlockchain(log *ipfsLog.ZapEventLogger, b *block.Block, db *BlockchainDB) bool
AddBlockToBlockchain adds a block to the blockchain db.
Types ¶
type BlockchainDB ¶
type BlockchainDB struct {
// contains filtered or unexported fields
}
BlockchainDB wraps a Pebble database instance to store blockchain data.
func NewBlockchainDB ¶
func NewBlockchainDB(log *ipfsLog.ZapEventLogger, dbPath string) (*BlockchainDB, error)
BlockchainDB wraps a Pebble database instance to store blockchain data.
func (*BlockchainDB) Close ¶
func (pdb *BlockchainDB) Close(log *ipfsLog.ZapEventLogger) error
Close closes the database connection.
func (*BlockchainDB) GetBlock ¶
func (pdb *BlockchainDB) GetBlock(log *ipfsLog.ZapEventLogger, key []byte) (*block.Block, error)
GetBlock retrieves a block from the database using its key.
func (*BlockchainDB) GetLastBlock ¶
func (pdb *BlockchainDB) GetLastBlock(log *ipfsLog.ZapEventLogger) *block.Block
GetLastBlock retrieves the most recently added block from the database.
func (*BlockchainDB) SaveBlock ¶
func (pdb *BlockchainDB) SaveBlock(log *ipfsLog.ZapEventLogger, key []byte, b *block.Block) error
SaveBlock serializes and stores a given block in the database.
func (*BlockchainDB) VerifyIntegrity ¶
func (pdb *BlockchainDB) VerifyIntegrity(log *ipfsLog.ZapEventLogger) bool
VerifyIntegrity verifies the integrity of the blockchain stored in the BlockchainDB based on the last block.
type BlockchainStorage ¶
type BlockchainStorage interface { SaveBlock(log *ipfsLog.ZapEventLogger, key []byte, b *block.Block) error GetBlock(log *ipfsLog.ZapEventLogger, key []byte) (*block.Block, error) VerifyIntegrity(log *ipfsLog.ZapEventLogger) (bool, error) GetLastBlock(log *ipfsLog.ZapEventLogger) *block.Block Close(log *ipfsLog.ZapEventLogger) error }
BlockchainStorage defines an interface for interacting with the blockchain storage.
Click to show internal directories.
Click to hide internal directories.