Documentation
¶
Index ¶
- Variables
- func New(ctx *context.T, rid naming.RoutingID, dhcpPublisher *pubsub.Publisher, ...) flow.Manager
- func NewErrAcceptFailed(ctx *context.T, err error) error
- func NewErrCacheClosed(ctx *context.T) error
- func NewErrConnKilledToFreeResources(ctx *context.T) error
- func NewErrConnNotInCache(ctx *context.T, remote string) error
- func NewErrInvalidProxyResponse(ctx *context.T, typ string) error
- func NewErrListeningWithNullRid(ctx *context.T) error
- func NewErrManagerClosed(ctx *context.T) error
- func NewErrManagerDialingSelf(ctx *context.T) error
- func NewErrNoBlessingsForPeer(ctx *context.T, peerNames []string, rejected []security.RejectedBlessing, ...) error
- func NewErrProxyResponse(ctx *context.T, msg string) error
- func NewErrUnknownProtocol(ctx *context.T, protocol string) error
- type ConnCache
- func (c *ConnCache) Close(ctx *context.T)
- func (c *ConnCache) EnterLameDuckMode(ctx *context.T)
- func (c *ConnCache) Find(ctx *context.T, remote naming.Endpoint, network, address string, ...) (conn *conn.Conn, names []string, rejected []security.RejectedBlessing, ...)
- func (c *ConnCache) FindWithRoutingID(ctx *context.T, remote naming.Endpoint, auth flow.PeerAuthorizer) (conn *conn.Conn, names []string, rejected []security.RejectedBlessing, ...)
- func (c *ConnCache) Insert(conn *conn.Conn, proxy bool) error
- func (c *ConnCache) InsertWithRoutingID(conn *conn.Conn, proxy bool) error
- func (c *ConnCache) KillConnections(ctx *context.T, num int) error
- func (c *ConnCache) String() string
- func (c *ConnCache) Unreserve(protocol, address string)
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnknownProtocol = verror.Register("v.io/x/ref/runtime/internal/flow/manager.UnknownProtocol", verror.NoRetry, "{1:}{2:} unknown protocol{:3}") ErrManagerClosed = verror.Register("v.io/x/ref/runtime/internal/flow/manager.ManagerClosed", verror.NoRetry, "{1:}{2:} manager is already closed") ErrAcceptFailed = verror.Register("v.io/x/ref/runtime/internal/flow/manager.AcceptFailed", verror.NoRetry, "{1:}{2:} accept failed{:3}") ErrCacheClosed = verror.Register("v.io/x/ref/runtime/internal/flow/manager.CacheClosed", verror.NoRetry, "{1:}{2:} cache is closed") ErrConnKilledToFreeResources = verror.Register("v.io/x/ref/runtime/internal/flow/manager.ConnKilledToFreeResources", verror.NoRetry, "{1:}{2:} Connection killed to free resources.") ErrInvalidProxyResponse = verror.Register("v.io/x/ref/runtime/internal/flow/manager.InvalidProxyResponse", verror.NoRetry, "{1:}{2:} Invalid proxy response{:3}") ErrManagerDialingSelf = verror.Register("v.io/x/ref/runtime/internal/flow/manager.ManagerDialingSelf", verror.NoRetry, "{1:}{2:} manager cannot be used to dial itself") ErrListeningWithNullRid = verror.Register("v.io/x/ref/runtime/internal/flow/manager.ListeningWithNullRid", verror.NoRetry, "{1:}{2:} manager cannot listen when created with NullRoutingID") ErrProxyResponse = verror.Register("v.io/x/ref/runtime/internal/flow/manager.ProxyResponse", verror.NoRetry, "{1:}{2:} proxy returned{:3}") ErrNoBlessingsForPeer = verror.Register("v.io/x/ref/runtime/internal/flow/manager.NoBlessingsForPeer", verror.NoRetry, "{1:}{2:} no blessings tagged for peer {3}, rejected:{4}{:5}") ErrConnNotInCache = verror.Register("v.io/x/ref/runtime/internal/flow/manager.ConnNotInCache", verror.NoRetry, "{1:}{2:} connection to {3} not in cache") )
Functions ¶
func New ¶
func New( ctx *context.T, rid naming.RoutingID, dhcpPublisher *pubsub.Publisher, channelTimeout time.Duration, idleExpiry time.Duration, authorizedPeers []security.BlessingPattern) flow.Manager
New creates a new flow manager.
func NewErrAcceptFailed ¶
NewErrAcceptFailed returns an error with the ErrAcceptFailed ID.
func NewErrCacheClosed ¶
NewErrCacheClosed returns an error with the ErrCacheClosed ID.
func NewErrConnKilledToFreeResources ¶
NewErrConnKilledToFreeResources returns an error with the ErrConnKilledToFreeResources ID.
func NewErrConnNotInCache ¶
NewErrConnNotInCache returns an error with the ErrConnNotInCache ID.
func NewErrInvalidProxyResponse ¶
NewErrInvalidProxyResponse returns an error with the ErrInvalidProxyResponse ID.
func NewErrListeningWithNullRid ¶
NewErrListeningWithNullRid returns an error with the ErrListeningWithNullRid ID.
func NewErrManagerClosed ¶
NewErrManagerClosed returns an error with the ErrManagerClosed ID.
func NewErrManagerDialingSelf ¶
NewErrManagerDialingSelf returns an error with the ErrManagerDialingSelf ID.
func NewErrNoBlessingsForPeer ¶
func NewErrNoBlessingsForPeer(ctx *context.T, peerNames []string, rejected []security.RejectedBlessing, err error) error
NewErrNoBlessingsForPeer returns an error with the ErrNoBlessingsForPeer ID.
func NewErrProxyResponse ¶
NewErrProxyResponse returns an error with the ErrProxyResponse ID.
Types ¶
type ConnCache ¶
type ConnCache struct {
// contains filtered or unexported fields
}
ConnCache is a cache of Conns keyed by (protocol, address) and (routingID). Multiple goroutines can invoke methods on the ConnCache simultaneously.
func NewConnCache ¶
NewConnCache creates a conncache with and idleExpiry for connections. If idleExpiry is zero, connections will never expire.
func (*ConnCache) EnterLameDuckMode ¶
func (*ConnCache) Find ¶
func (c *ConnCache) Find(ctx *context.T, remote naming.Endpoint, network, address string, auth flow.PeerAuthorizer, p flow.Protocol) (conn *conn.Conn, names []string, rejected []security.RejectedBlessing, err error)
Find returns a Conn based on the input remoteEndpoint. nil is returned if there is no such Conn.
Find will return an error iff the cache is closed. If no error is returned, the caller is required to call Unreserve, to avoid deadlock. The (protocol, address) provided to Unreserve must be the same as the arguments provided to Find. All new Find calls for the (protocol, address) will Block until the corresponding Unreserve call is made. p is used to check the cache for resolved protocols.
func (*ConnCache) FindWithRoutingID ¶
func (c *ConnCache) FindWithRoutingID(ctx *context.T, remote naming.Endpoint, auth flow.PeerAuthorizer) (conn *conn.Conn, names []string, rejected []security.RejectedBlessing, err error)
Find returns a Conn based only on the RoutingID of remote.
func (*ConnCache) Insert ¶
Insert adds conn to the cache, keyed by both (protocol, address) and (routingID) An error will be returned iff the cache has been closed.
func (*ConnCache) InsertWithRoutingID ¶
InsertWithRoutingID adds conn to the cache keyed only by conn's RoutingID.
func (*ConnCache) KillConnections ¶
KillConnections will closes at least num Conns in the cache. This is useful when the manager is approaching system FD limits.
The policy is as follows: (1) Remove undialable conns from the cache, there is no point
in closing undialable connections to address a FD limit.
(2) Close and remove lameducked, expired connections from the cache,
counting non-proxied connections towards the removed FD count (num).
(3) LameDuck idle expired connections, killing them if num is still greater
than 0.
(4) Finally if 'num' hasn't been reached, remove the LRU remaining conns
until num is reached.
If num is greater than the number of connections in the cache, all cached connections will be closed and removed. KillConnections returns an error iff the cache is closed.