nodedata

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2023 License: MIT Imports: 23 Imported by: 0

README

Node Data

Performs two jobs:

  1. Gathers Nodeinfo is an abstraction to gather data similar to lncli getnodeinfo periodically from nodes. Agent uses that only if you allow access to private data (--private flag). We need it to have a consistent state of the node because it could have unannounced channels. Without this we fallback to public data from the lightning network gossip.

  2. Fetches channel balances and reports them. It is used as part of various agents and also other internal tools.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelCache

type ChannelCache interface {
	// Lock - acquire lock
	Lock()
	// Unlock - release lock
	Unlock()
	// Get - get channel cache
	Get(name string) (string, bool)
	// Set - set channel cache
	Set(name string, value string)
	// DeferredSet - set channel cache but do not commit it yet
	DeferredSet(name, old, new string)
	// DeferredCommit - commit channel cache from DeferredSet
	DeferredCommit() bool
	// DeferredRevert - revert channel cache from DeferredSet
	DeferredRevert() bool
}

ChannelCache struct

type InMemoryChannelCache

type InMemoryChannelCache struct {
	// contains filtered or unexported fields
}

InMemoryChannelCache - ChannelCache implementation that stores data in memory

func NewInMemoryChannelCache

func NewInMemoryChannelCache() *InMemoryChannelCache

NewInMemoryChannelCache - construct new InMemoryChannelCache

func (*InMemoryChannelCache) DeferredCommit

func (c *InMemoryChannelCache) DeferredCommit() bool

DeferredCommit - commit channel cache from DeferredSet

func (*InMemoryChannelCache) DeferredRevert

func (c *InMemoryChannelCache) DeferredRevert() bool

DeferredRevert - revert channel cache from DeferredSet

func (*InMemoryChannelCache) DeferredSet

func (c *InMemoryChannelCache) DeferredSet(name, old, new string)

DeferredSet - set channel cache but do not commit it yet

func (*InMemoryChannelCache) Get

func (c *InMemoryChannelCache) Get(name string) (string, bool)

Get - get channel cache

func (*InMemoryChannelCache) Lock

func (c *InMemoryChannelCache) Lock()

Lock - acquire lock

func (*InMemoryChannelCache) Set

func (c *InMemoryChannelCache) Set(name string, value string)

Set - set channel cache

func (*InMemoryChannelCache) Unlock

func (c *InMemoryChannelCache) Unlock()

Unlock - release lock

type NodeData

type NodeData struct {
	// contains filtered or unexported fields
}

NodeData struct

func NewDefaultNodeData

func NewDefaultNodeData(ctx context.Context, keepAlive time.Duration, smooth bool, checkGraph bool, noOnChainBalance bool, monitoring *checkermonitoring.CheckerMonitoring) *NodeData

NewDefaultNodeData constructs a new NodeData

func NewNodeData

func NewNodeData(ctx context.Context, cache ChannelCache, keepAlive time.Duration, smooth bool, checkGraph bool, noOnChainBalance bool, monitoring *checkermonitoring.CheckerMonitoring) *NodeData

NewNodeData constructs a new NodeData

func (*NodeData) EventLoop

func (c *NodeData) EventLoop()

EventLoop - invoke the event loop

func (*NodeData) GetState

func (c *NodeData) GetState(
	pubKey string,
	uniqueID string,
	getAPI api.NewAPICall,
	settings entities.ReportingSettings,
	optCallback entities.NodeDataReportCallback) (*entities.NodeDataReport, error)

GetState - get current state (settings.pollInterval is ignored)

func (*NodeData) Invalidate added in v0.0.49

func (c *NodeData) Invalidate() error

Invalidate when data was last reported

func (*NodeData) IsSubscribed

func (c *NodeData) IsSubscribed(pubKey, uniqueID string) bool

IsSubscribed - check if we are subscribed for a certain public key

func (*NodeData) OverrideLoopInterval

func (c *NodeData) OverrideLoopInterval(duration time.Duration)

OverrideLoopInterval - WARNING: this should not be used except for unit testing

func (*NodeData) Subscribe

func (c *NodeData) Subscribe(
	nodeDataCallback entities.NodeDataReportCallback,
	getAPI api.NewAPICall,
	pubKey string,
	settings entities.ReportingSettings,
	uniqueID string) error

Subscribe - subscribe to notifications about node changes (if already subscribed this will force a callback, use IsSubscribed to check)

func (*NodeData) Unsubscribe

func (c *NodeData) Unsubscribe(pubkey, uniqueID string) error

Unsubscribe - unsubscribe from a pubkey

type OldNewVal

type OldNewVal struct {
	OldValue string
	NewValue string
}

OldNewVal struct

type PerNodeSettings

type PerNodeSettings struct {
	// contains filtered or unexported fields
}

PerNodeSettings struct

func NewPerNodeSettings

func NewPerNodeSettings() *PerNodeSettings

NewPerNodeSettings creates PerNodeSettings

func (*PerNodeSettings) Delete

func (s *PerNodeSettings) Delete(key string)

Delete - delete settings for one key

func (*PerNodeSettings) Get

func (s *PerNodeSettings) Get(key string) Settings

Get - get settings for one key

func (*PerNodeSettings) GetKeys

func (s *PerNodeSettings) GetKeys() []string

GetKeys - get all keys

func (*PerNodeSettings) Set

func (s *PerNodeSettings) Set(key string, value Settings)

Set - set settings for one key

type RedisChannelCache

type RedisChannelCache struct {
	// contains filtered or unexported fields
}

RedisChannelCache - ChannelCache implementation that stores data in redis

func NewRedisChannelCache

func NewRedisChannelCache() *RedisChannelCache

NewRedisChannelCache - construct new RedisChannelCache

func (*RedisChannelCache) DeferredCommit

func (c *RedisChannelCache) DeferredCommit() bool

DeferredCommit - commit channel cache from DeferredSet

func (*RedisChannelCache) DeferredRevert

func (c *RedisChannelCache) DeferredRevert() bool

DeferredRevert - revert channel cache from DeferredSet

func (*RedisChannelCache) DeferredSet

func (c *RedisChannelCache) DeferredSet(name, old, new string)

DeferredSet - set channel cache but do not commit it yet

func (*RedisChannelCache) Get

func (c *RedisChannelCache) Get(name string) (string, bool)

Get - get channel cache

func (*RedisChannelCache) Lock

func (c *RedisChannelCache) Lock()

Lock - acquire lock

func (*RedisChannelCache) Set

func (c *RedisChannelCache) Set(name string, value string)

Set - set channel cache

func (*RedisChannelCache) Unlock

func (c *RedisChannelCache) Unlock()

Unlock - release lock

type SetOfChanIds

type SetOfChanIds map[uint64]struct{}

SetOfChanIds is a set of channel IDs

type Settings

type Settings struct {
	// contains filtered or unexported fields
}

Settings struct

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL