github.com/decred/dcrlnd@v0.7.6/chanfitness/interface.go (about)

     1  package chanfitness
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/decred/dcrd/wire"
     7  )
     8  
     9  // peerMonitor is an interface implemented by entities that monitor our peers
    10  // online events and the channels we currently have open with them.
    11  type peerMonitor interface {
    12  	// event adds an online or offline event.
    13  	onlineEvent(online bool)
    14  
    15  	// addChannel adds a new channel.
    16  	addChannel(channelPoint wire.OutPoint) error
    17  
    18  	// removeChannel removes a channel.
    19  	removeChannel(channelPoint wire.OutPoint) error
    20  
    21  	// channelCount returns the number of channels that we currently have
    22  	// with the peer.
    23  	channelCount() int
    24  
    25  	// channelUptime looks up a channel and returns the amount of time that
    26  	// the channel has been monitored for and its uptime over this period.
    27  	channelUptime(channelPoint wire.OutPoint) (time.Duration,
    28  		time.Duration, error)
    29  
    30  	// getFlapCount returns the peer's flap count and the timestamp that we
    31  	// last recorded a flap, which may be nil if we have never recorded a
    32  	// flap for this peer.
    33  	getFlapCount() (int, *time.Time)
    34  }