Documentation ¶
Overview ¶
Package wsconncache caches workspace agent connections by UUID.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func New ¶
New creates a new workspace connection cache that closes connections after the inactive timeout provided.
Agent connections are cached due to WebRTC negotiation taking a few hundred milliseconds.
func (*Cache) Acquire ¶
Acquire gets or establishes a connection with the dialer using the ID provided. If a connection is in-progress, that connection or error will be returned.
The returned function is used to release a lock on the connection. Once zero locks exist on a connection, the inactive timeout will begin to tick down. After the time expires, the connection will be cleared from the cache.
type Conn ¶
Conn wraps an agent connection with a reusable HTTP transport.
func (*Conn) CloseWithError ¶
CloseWithError ends the HTTP transport if exists, and closes the agent.