Documentation
¶
Index ¶
Constants ¶
View Source
const (
CName = "common.net.pool"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool interface {
// Get lookups to peer in existing connections or creates and outgoing new one
Get(ctx context.Context, id string) (peer.Peer, error)
// GetOneOf searches at least one existing connection in outgoing or creates a new one from a randomly selected id from given list
GetOneOf(ctx context.Context, peerIds []string) (peer.Peer, error)
// AddPeer adds incoming peer to the pool
AddPeer(ctx context.Context, p peer.Peer) (err error)
// Pick checks if a connection with the peer exists, without dialing.
// For a peer whose last dial failed it returns the cached dial error.
Pick(ctx context.Context, id string) (pr peer.Peer, err error)
// Flush removes all connections from the pool
Flush(ctx context.Context) error
}
Pool creates and caches outgoing connection
Click to show internal directories.
Click to hide internal directories.