Versions in this module Expand all Collapse all v0 v0.0.1 Nov 2, 2025 Changes in this version + type Database struct + ReaderDb *sqlx.DB + func NewDatabase(config *SqliteDatabaseConfig, logger logrus.FieldLogger) *Database + func (d *Database) ApplyEmbeddedDbSchema(version int64) error + func (d *Database) Close() error + func (d *Database) CountNodes() (int, error) + func (d *Database) DeleteNode(tx *sqlx.Tx, nodeID []byte) error + func (d *Database) DeleteNodesBefore(tx *sqlx.Tx, timestamp int64) (int64, error) + func (d *Database) DeleteState(tx *sqlx.Tx, key string) error + func (d *Database) GetInactiveNodes(n int) ([]*Node, error) + func (d *Database) GetNode(nodeID []byte) (*Node, error) + func (d *Database) GetNodes() ([]*Node, error) + func (d *Database) GetRandomNodes(n int) ([]*Node, error) + func (d *Database) GetState(key string) ([]byte, error) + func (d *Database) GetStats() DatabaseStats + func (d *Database) Init() error + func (d *Database) InsertNode(tx *sqlx.Tx, node *Node) error + func (d *Database) NodeExists(nodeID []byte) (bool, uint64, error) + func (d *Database) RunDBTransaction(handler func(tx *sqlx.Tx) error) error + func (d *Database) SetState(tx *sqlx.Tx, key string, value []byte) error + func (d *Database) UpdateNodeENR(tx *sqlx.Tx, nodeID []byte, ip []byte, ipv6 []byte, port int, seq uint64, ...) error + func (d *Database) UpdateNodeLastActive(tx *sqlx.Tx, nodeID []byte, timestamp int64) error + func (d *Database) UpdateNodeLastSeen(tx *sqlx.Tx, nodeID []byte, timestamp int64) error + func (d *Database) UpdateNodeSeq(tx *sqlx.Tx, nodeID []byte, seq uint64, enr []byte) error + func (d *Database) UpsertNode(tx *sqlx.Tx, node *Node) error + type DatabaseStats struct + Idle int + InUse int + MaxIdleClosed int64 + MaxLifetimeClosed int64 + OpenConnections int + TotalQueries int64 + Transactions int64 + WaitCount int64 + WaitDuration time.Duration + type Node struct + AvgRTT int + ENR []byte + FailureCount int + FirstSeen int64 + ForkDigest []byte + IP []byte + IPv6 []byte + LastActive sql.NullInt64 + LastSeen sql.NullInt64 + NodeID []byte + Port int + Seq uint64 + SuccessCount int + type SqliteDatabaseConfig struct + File string + MaxIdleConns int + MaxOpenConns int + type State struct + Key string + Value []byte