htlcswitch: add new ticker in switch to batch log forwarding events
In this commit, we extend the switch as is, to record details concerning settled payment circuits. To do this, we introduce a new interface to the package: the ForwardingLog. This is a tiny interface that simply lets us abstract away the details of the storage backing of the forwarding log. Each time we receive a successful HTLC settle, we’ll log the full details (chans, fees, time) as a pending forwarding log entry. Every 15 seconds, we’ll then batch flush out these entries to disk. When we’re exiting, we’ll try to flush out all entries to ensure everything gets recorded to disk.
This commit is contained in:
3 files changed
+130
-9
No files matched your search
@@ -121,3 +121,15 @@ type Peer interface {
|
||||
// properly handle.
|
||||
Disconnect(reason error)
|
||||
}
|
||||
|
||||
// ForwardingLog is an interface that represents a time series database which
|
||||
// keep track of all successfully completed payment circuits. Every few
|
||||
// seconds, the switch will collate and flush out all the successful payment
|
||||
// circuits during the last interval.
|
||||
type ForwardingLog interface {
|
||||
// AddForwardingEvents is a method that should write out the set of
|
||||
// forwarding events in a batch to persistent storage. Outside
|
||||
// sub-systems can then query the contents of the log for analysis,
|
||||
// visualizations, etc.
|
||||
AddForwardingEvents([]channeldb.ForwardingEvent) error
|
||||
}
|
||||
Reference in new issue
Block a user