Documentation ¶
Index ¶
Constants ¶
const ( BoltTrimmedMetrics = iota + 1 PostgreSQLMetrics MemDBMetrics BoltUntrimmedMetrics )
Metrics values for reporting storage type used. Only append new values. Also, add new values to the DrandStorageBackend metric Help.
Variables ¶
This section is empty.
Functions ¶
func BytesToRound ¶
BytesToRound unserializes a round number from bytes (8 bytes fixed length big-endian) to uint64.
func GenesisBeacon ¶
GenesisBeacon returns the first beacon inserted in the chain
func RoundToBytes ¶
RoundToBytes serializes a round number to bytes (8 bytes fixed length big-endian).
Types ¶
type Cursor ¶
type Cursor interface { First(context.Context) (*common.Beacon, error) Next(context.Context) (*common.Beacon, error) Seek(ctx context.Context, round uint64) (*common.Beacon, error) Last(context.Context) (*common.Beacon, error) }
Cursor iterates over items in sorted key order. This starts from the first key/value pair and updates the k/v variables to the next key/value on each iteration.
The loop finishes at the end of the cursor when a nil key is returned.
for k, v := c.First(); k != nil; k, v = c.Next() { fmt.Printf("A %s is %s.\n", k, v) }
type StorageType ¶
type StorageType string
StorageType defines the supported storage engines
const ( // BoltDB uses the BoltDB engine for storing data BoltDB StorageType = "bolt" // PostgreSQL uses the PostgreSQL database for storing data PostgreSQL StorageType = "postgres" // MemDB uses the in-memory database to store data MemDB StorageType = "memdb" )
Storage engine types
type Store ¶
type Store interface { Len(context.Context) (int, error) Put(context.Context, *common.Beacon) error Last(context.Context) (*common.Beacon, error) Get(ctx context.Context, round uint64) (*common.Beacon, error) Cursor(context.Context, func(context.Context, Cursor) error) error Close() error Del(ctx context.Context, round uint64) error SaveTo(ctx context.Context, w io.Writer) error }
Store is an interface to store Beacons packets where they can also be retrieved to be delivered to end clients.
Directories ¶
Path | Synopsis |
---|---|
postgresdb
|
|
database
Package database provides support for access the database.
|
Package database provides support for access the database. |
schema
Package schema helps to keep the database up to date with schema.
|
Package schema helps to keep the database up to date with schema. |