entities

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: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlogFlags = []cli.Flag{
	cli.IntFlag{
		Name: "verbosity", Value: 0, Usage: "log level for V logs", Hidden: false,
	},
	cli.BoolFlag{
		Name: "logtostderr", Usage: "log to standard error instead of files", Hidden: true,
	},
	cli.IntFlag{
		Name:  "stderrthreshold",
		Usage: "logs at or above this threshold go to stderr", Hidden: true,
	},
	cli.BoolFlag{
		Name: "alsologtostderr", Usage: "log to standard error as well as files", Hidden: true,
	},
	cli.StringFlag{
		Name:  "vmodule",
		Usage: "comma-separated list of pattern=N settings for file-filtered logging", Hidden: true,
	},
	cli.StringFlag{
		Name: "log_dir", Usage: "If non-empty, write log files in this directory", Hidden: true,
	},
	cli.StringFlag{
		Name:  "log_backtrace_at",
		Usage: "when logging hits line file:N, emit a stack trace", Hidden: true,
		Value: ":0",
	},
}

Functions

func CleanAndExpandPath added in v0.0.49

func CleanAndExpandPath(path string) string

CleanAndExpandPath expands environment variables and leading ~ in the passed path, cleans the result, and returns it. This function is taken from https://github.com/btcsuite/btcd

func GlogShim added in v0.2.0

func GlogShim(c *cli.Context)

func MkGetLndAPI added in v0.2.0

func MkGetLndAPI(cmdCtx *cli.Context) api.NewAPICall

Types

type ChannelBalance

type ChannelBalance struct {
	// Active - is channel active
	Active bool `json:"active"`
	// Private - is channel private
	Private bool `json:"private"`
	// Deprecated - ActivePrevious is whether channel was Active in previous run
	ActivePrevious bool `json:"active_previous"`

	// LocalPubkey is the local node pubkey
	LocalPubkey string `json:"local_pubkey"`
	// RemotePubkey is the remote node pubkey
	RemotePubkey string `json:"remote_pubkey"`
	// ChanID - short channel id
	ChanID uint64 `json:"chan_id"`
	// Capacity - capacity of channel in satoshis
	Capacity uint64 `json:"capacity"`

	// RemoteNominator - is the remote side nominator
	RemoteNominator uint64 `json:"remote_nominator"`
	// LocalNominator - is the local side nominator
	LocalNominator uint64 `json:"local_nominator"`
	// Denominator - is the denominator (with high entropy allowed this is more or less channnel capacity)
	Denominator uint64 `json:"denominator"`

	// Deprecated - RemoteNominatorDiff is the difference of RemoteNominator between now and previous run
	RemoteNominatorDiff int64 `json:"remote_nominator_diff"`
	// Deprecated - LocalNominatorDiff is the difference of LocalNominator between now and previous run
	LocalNominatorDiff int64 `json:"local_nominator_diff"`
	// Deprecated - DenominatorDiff is the difference of Denominator between now and previous run
	DenominatorDiff int64 `json:"denominator_diff"`

	// ActiveRemote - does other node specify channel as active
	ActiveRemote bool `json:"active_remote"`
	// Deprecated - ActiveRemotePrevious - ActiveRemote from previous run
	ActiveRemotePrevious bool `json:"active_remote_previous"`
	// ActiveLocal - does current node specify channel as active
	ActiveLocal bool `json:"active_local"`
	// Deprecated - ActiveLocalPrevious - ActiveLocal from previous run
	ActiveLocalPrevious bool `json:"active_local_previous"`
}

ChannelBalance struct

type ClosedChannel

type ClosedChannel struct {
	ChannelID uint64 `json:"channel_id"`
}

ClosedChannel struct

type InfoCallback added in v0.0.5

type InfoCallback func(ctx context.Context, report *InfoReport) bool

InfoCallback represents the info callback

type InfoReport added in v0.0.5

type InfoReport struct {
	UniqueID  string            `json:"uniqueId,omitempty"` // optional unique identifier
	Timestamp entities.JsonTime `json:"timestamp"`

	api.NodeInfoAPIExtended
}

InfoReport struct

type Interval

type Interval int

Interval represents the enum of possible intervals

const (
	// ManualRequest means just do it once
	ManualRequest Interval = iota
	// Second means once per second (useful just for testing)
	Second
	// TenSeconds means once every ten seconds
	TenSeconds
	// Minute means once every minute
	Minute
	// TenMinutes means once every ten minutes
	TenMinutes
	// Hour means once every hour
	Hour
)

func (Interval) Duration

func (i Interval) Duration() time.Duration

Duration converts the interval to a duration

func (*Interval) MarshalJSON

func (i *Interval) MarshalJSON() ([]byte, error)

MarshalJSON is used for JSON serialiazation of interval

func (*Interval) UnmarshalJSON

func (i *Interval) UnmarshalJSON(s []byte) (err error)

UnmarshalJSON is used for JSON deserialiazation of interval

type Invalidatable added in v0.0.49

type Invalidatable interface {
	Invalidate() error
}

Invalidatable interface.

type MessageCallback added in v0.0.49

type MessageCallback func(PluginMessage) error

MessageCallback is callback function which is called by plugin to send message to connector

type NodeDataReport added in v0.0.41

type NodeDataReport struct {
	ReportingSettings
	// Chain - should be bitcoin (bitcoin, litecoin)
	Chain string `json:"chain"`
	// Network - should be mainnet (regtest, testnet, mainnet)
	Network string `json:"network"`
	// Pubkey - node pubkey
	PubKey string `json:"pubkey"`
	// UniqueID is the optional unique identifier
	UniqueID string `json:"uniqueId,omitempty"`
	// Timestamp - timestamp of report
	Timestamp entities.JsonTime `json:"timestamp"`
	// ChangedChannels - contains all channels were balance has changed
	ChangedChannels []ChannelBalance `json:"changed_channels"`
	// ClosedChannels - contains all channels that were determined to be closed
	ClosedChannels []ClosedChannel `json:"closed_channels"`
	// Node Details
	NodeDetails *NodeDetails `json:"node_details,omitempty"`
}

NodeDataReport struct

type NodeDataReportCallback added in v0.0.41

type NodeDataReportCallback func(ctx context.Context, report *NodeDataReport) bool

NodeDataReportCallback represents the nodedata callback

type NodeDetails added in v0.0.41

type NodeDetails struct {
	NodeVersion               string `json:"node_version"`
	IsSyncedToChain           bool   `json:"is_synced_to_chain"`
	IsSyncedToGraph           bool   `json:"is_synced_to_graph"`
	AgentVersion              string `json:"agent_version"`                          // will be filled before sending
	OnChainBalanceNotReported bool   `json:"onchain_balance_not_reported,omitempty"` // or else we cannot distinguish 0 and disallowed to report
	OnChainBalanceConfirmed   uint64 `json:"onchain_balance_confirmed"`
	OnChainBalanceTotal       uint64 `json:"onchain_balance_total"`

	api.NodeInfoAPIExtended
}

NodeDetails struct

type NodeIdentifier

type NodeIdentifier struct {
	Identifier string `json:"identifier"`
	UniqueID   string `json:"unique_id"`
}

NodeIdentifier represents the pubkey and optional unique identifier

func (*NodeIdentifier) GetID added in v0.0.41

func (n *NodeIdentifier) GetID() string

GetID obtains the string representation of the node identifier

type Plugin added in v0.0.49

type Plugin interface {
	// Execute can be called multiple times for the same job
	// It's plugin responsibility to check if the job is already running and ignore such requests
	Execute(jobID int64, data []byte, msgCallback MessageCallback) error
}

Plugin is temporary interface for plugins. This will probably be replaced by gRPC interface

type PluginCommon added in v0.2.2

type PluginCommon struct {
	PluginName string
}

PluginCommon contains common plugin data

type PluginMessage added in v0.0.49

type PluginMessage struct {
	JobID      int64
	Message    string
	Data       []byte
	IsError    bool
	IsFinished bool
}

PluginMessage is structure of message sent from plugin to connector

type ReentrancyBlock added in v0.0.17

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

ReentrancyBlock is used to block reentrancy based on string ID

func NewReentrancyBlock added in v0.0.17

func NewReentrancyBlock() *ReentrancyBlock

NewReentrancyBlock constructs a new ReentrancyBlock

func (*ReentrancyBlock) Enter added in v0.0.17

func (r *ReentrancyBlock) Enter(id string) bool

Enter is the acquire lock method (opposite of Release)

func (*ReentrancyBlock) Release added in v0.0.17

func (r *ReentrancyBlock) Release(id string)

Release is the drop lock method (opposite of Enter)

type ReportingSettings

type ReportingSettings struct {
	// GraphPollInterval - interval for graph polling
	GraphPollInterval time.Duration `json:"-"`
	// NoopInterval - send keepalive also when no changes happened
	NoopInterval time.Duration `json:"-"`
	// Filter is used to filter specific channels
	Filter filter.FilteringInterface `json:"-"`
	// PollInterval - defines how often the polling happens
	PollInterval Interval `json:"poll_interval"`
	// AllowedEntropy - is user specified entropy that can be reported
	AllowedEntropy int `json:"allowed_entropy"` // 64 bits is the default
	// AllowPrivateChannels - whether private channels were allowed (fitering will set this to true too)
	AllowPrivateChannels bool `json:"allow_private_channels"` // default is false
	// NotSyncedToChainCoolDown - how long to wait before reporting node as not synced to chain
	NotSyncedToChainCoolDown time.Duration `json:"-"`
}

ReportingSettings struct

Jump to

Keyboard shortcuts

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