Documentation
¶
Index ¶
- type NodeDB
- func (ndb *NodeDB) Close() error
- func (ndb *NodeDB) Count() int
- func (ndb *NodeDB) Delete(id node.ID) error
- func (ndb *NodeDB) GetStats() NodeDBStats
- func (ndb *NodeDB) List() []*node.Node
- func (ndb *NodeDB) Load(id node.ID) (*node.Node, error)
- func (ndb *NodeDB) LoadInactiveNodes(n int) []*node.Node
- func (ndb *NodeDB) LoadLocalENR() ([]byte, error)
- func (ndb *NodeDB) LoadRandomNodes(n int) []*node.Node
- func (ndb *NodeDB) NodeExists(id node.ID) (bool, uint64)
- func (ndb *NodeDB) StoreLocalENR(enrBytes []byte) error
- func (ndb *NodeDB) UpdateLastActive(id node.ID, timestamp time.Time) error
- func (ndb *NodeDB) UpdateLastSeen(id node.ID, timestamp time.Time) error
- func (ndb *NodeDB) UpdateNodeENR(n *node.Node) error
- func (ndb *NodeDB) UpdateNodeFull(n *node.Node) error
- type NodeDBStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NodeDB ¶
type NodeDB struct {
// contains filtered or unexported fields
}
NodeDB wraps the Database and provides node storage with async updates.
func (*NodeDB) Close ¶
Close waits for pending updates to complete. The context cancellation signals shutdown.
func (*NodeDB) GetStats ¶
func (ndb *NodeDB) GetStats() NodeDBStats
GetStats returns current database statistics.
func (*NodeDB) LoadInactiveNodes ¶
LoadInactiveNodes loads up to N inactive nodes from the database. Returns nodes ordered by oldest last_active time (NULL first).
func (*NodeDB) LoadLocalENR ¶
LoadLocalENR retrieves the local node's ENR.
func (*NodeDB) LoadRandomNodes ¶
LoadRandomNodes loads up to N random nodes from the database.
func (*NodeDB) NodeExists ¶
NodeExists checks if a node exists in the database.
func (*NodeDB) StoreLocalENR ¶
StoreLocalENR stores the local node's ENR.
func (*NodeDB) UpdateLastActive ¶
UpdateLastActive queues a last_active timestamp update.
func (*NodeDB) UpdateLastSeen ¶
UpdateLastSeen queues a last_seen timestamp update.
func (*NodeDB) UpdateNodeENR ¶
UpdateNodeENR queues an ENR update (seq+enr+ip only, preserves stats & timestamps). Use this when receiving nodes from discovery (FINDNODE responses).
type NodeDBStats ¶
type NodeDBStats struct {
QueueSize int // Current number of pending updates in queue
ProcessedUpdates int64 // Total updates processed
MergedUpdates int64 // Total updates merged with existing pending
FailedUpdates int64 // Total updates that failed
Transactions int64 // Total database transactions executed
TotalQueries int64 // Total database queries executed
OpenConnections int // Current number of open DB connections
}
NodeDBStats contains statistics about database operations.