Documentation ¶
Overview ¶
Package logdb contains read/write access to the locally cloned data.
Index ¶
- Variables
- type Database
- func (d *Database) GetLatestCheckpoint(ctx context.Context) (size uint64, checkpoint []byte, compactRange [][]byte, err error)
- func (d *Database) Head() (int64, error)
- func (d *Database) StreamLeaves(ctx context.Context, start, end uint64, out chan<- StreamResult)
- func (d *Database) WriteCheckpoint(ctx context.Context, size uint64, checkpoint []byte, compactRange [][]byte) error
- func (d *Database) WriteLeaves(ctx context.Context, start uint64, leaves [][]byte) error
- type StreamResult
Constants ¶
This section is empty.
Variables ¶
var ErrNoDataFound = errors.New("no data found")
ErrNoDataFound is returned when the DB appears valid but has no data in it.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database provides read/write access to the mirrored log.
func NewDatabase ¶
NewDatabase creates a Database using the given database connection string. This has been tested with sqlite and MariaDB.
func NewDatabaseDirect ¶
NewDatabaseDirect creates a Database using the given database connection.
func (*Database) GetLatestCheckpoint ¶
func (d *Database) GetLatestCheckpoint(ctx context.Context) (size uint64, checkpoint []byte, compactRange [][]byte, err error)
GetLatestCheckpoint gets the details of the latest checkpoint.
func (*Database) StreamLeaves ¶
func (d *Database) StreamLeaves(ctx context.Context, start, end uint64, out chan<- StreamResult)
StreamLeaves streams leaves in order starting at the given index, putting the leaf preimage values on the `out` channel. This takes ownership of the out channel and closes it when no more data will be returned.
type StreamResult ¶
StreamResult is the return type for StreamLeaves. It allows the leaves to be returned in the same channel as any errors. Only one of Leaf or Err will be populated in any StreamResult.