Documentation
¶
Index ¶
- Constants
- func EncodeAcks(acks []Ack, data []byte) (n uint32, err error)
- type Ack
- type Adapter
- type Buffer
- type Closer
- type Instrument
- func NewInstrument(name string, config map[string]interface{}) (i Instrument, err error)
- func NewMetricsInstrument(config map[string]interface{}) (Instrument, error)
- func NewMetricsInstrumentNoCf(path string, snapshotMs int, enabled bool) (Instrument, error)
- func NewNilInstrument() Instrument
- func NewTraceInstrument(config map[string]interface{}) (Instrument, error)
- type InstrumentInstance
- type MetricsInstrument
- type MetricsInstrumentConfig
- type NilInstrumentInstance
- func (n NilInstrumentInstance) Allocate(id string)
- func (n NilInstrumentInstance) Closed(Adapter)
- func (n NilInstrumentInstance) DuplicateAck(ack int32)
- func (n NilInstrumentInstance) DuplicateRx(wm *WireMessage)
- func (n NilInstrumentInstance) NewRetxMs(retxMs int)
- func (n NilInstrumentInstance) NewRetxScale(retxScale float64)
- func (n NilInstrumentInstance) ReadError(err error)
- func (n NilInstrumentInstance) RxAck(wm *WireMessage)
- func (n NilInstrumentInstance) RxKeepalive(wm *WireMessage)
- func (n NilInstrumentInstance) RxPortalSzChanged(capacity int)
- func (n NilInstrumentInstance) Shutdown()
- func (n NilInstrumentInstance) TxAck(wm *WireMessage)
- func (n NilInstrumentInstance) TxKeepalive(wm *WireMessage)
- func (n NilInstrumentInstance) TxPortalCapacityChanged(capacity int)
- func (n NilInstrumentInstance) TxPortalRxSzChanged(sz int)
- func (n NilInstrumentInstance) TxPortalSzChanged(capacity int)
- func (n NilInstrumentInstance) UnexpectedMessageType(mt messageType)
- func (n NilInstrumentInstance) WireMessageRetx(wm *WireMessage)
- func (n NilInstrumentInstance) WireMessageRx(wm *WireMessage)
- func (n NilInstrumentInstance) WireMessageTx(wm *WireMessage)
- func (n NilInstrumentInstance) WriteError(err error)
- type Pool
- type ReadSinkAdapter
- type RxPortal
- type RxRead
- type Sink
- type TxAlgorithm
- type TxAlgorithmProfile
- type TxMonitor
- type TxPortal
- type TxProfile
- type WestworldAlgorithm
- func (wa *WestworldAlgorithm) DuplicateAck()
- func (wa *WestworldAlgorithm) ProbeRTT() bool
- func (wa *WestworldAlgorithm) Profile() *TxProfile
- func (wa *WestworldAlgorithm) Retransmission(_ int)
- func (wa *WestworldAlgorithm) RetxMs() int
- func (wa *WestworldAlgorithm) RxPortalPacing(oldSize, newSize int) bool
- func (wa *WestworldAlgorithm) RxPortalSize() int
- func (wa *WestworldAlgorithm) SetLock(lock *sync.Mutex)
- func (wa *WestworldAlgorithm) Success(segmentSize int)
- func (wa *WestworldAlgorithm) Tx(segmentSize int)
- func (wa *WestworldAlgorithm) UpdateRTT(rttMs int)
- func (wa *WestworldAlgorithm) UpdateRxPortalSize(rxPortalSize int)
- type WestworldProfile
- type WireMessage
Constants ¶
const ( // 0x0 ... 0x7 HELLO messageType = iota ACK DATA KEEPALIVE CLOSE )
const ( // 0x8 ... 0x80 RTT messageFlag = 0x8 INLINE_ACK messageFlag = 0x10 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adapter ¶
Adapter abstracts the underlying communication mechanism that dilithium is managing. Implementations are free to manage whatever state is necessary, and need to provide a basic `Read`, `Write`, and `Close` facility.
type Buffer ¶
type Closer ¶
type Closer struct {
// contains filtered or unexported fields
}
Closer manages the state machine for the shutdown of a TxPortal and RxPortal pair (one side of a communication).
func (*Closer) EmergencyStop ¶
func (c *Closer) EmergencyStop()
type Instrument ¶
type Instrument interface {
NewInstance(id string) InstrumentInstance
}
func NewInstrument ¶
func NewInstrument(name string, config map[string]interface{}) (i Instrument, err error)
func NewMetricsInstrument ¶
func NewMetricsInstrument(config map[string]interface{}) (Instrument, error)
func NewMetricsInstrumentNoCf ¶
func NewMetricsInstrumentNoCf(path string, snapshotMs int, enabled bool) (Instrument, error)
func NewNilInstrument ¶
func NewNilInstrument() Instrument
func NewTraceInstrument ¶
func NewTraceInstrument(config map[string]interface{}) (Instrument, error)
type InstrumentInstance ¶
type InstrumentInstance interface {
// connection
//Listener(adapter Adapter)
//Hello(adapter Adapter)
//Connected(adapter Adapter)
//ConnectionError(adapter Adapter, err error)
Closed(adapter Adapter)
// wire
WireMessageTx(wm *WireMessage)
WireMessageRetx(wm *WireMessage)
WireMessageRx(wm *WireMessage)
// UnknownPeer(peer *net.UDPAddr)
ReadError(err error)
WriteError(err error)
UnexpectedMessageType(mt messageType)
// control
TxAck(wm *WireMessage)
RxAck(wm *WireMessage)
TxKeepalive(wm *WireMessage)
RxKeepalive(wm *WireMessage)
// txPortal
TxPortalCapacityChanged(capacity int)
TxPortalSzChanged(capacity int)
TxPortalRxSzChanged(sz int)
NewRetxMs(retxMs int)
NewRetxScale(retxScale float64)
DuplicateAck(ack int32)
// rxPortal
RxPortalSzChanged(capacity int)
DuplicateRx(wm *WireMessage)
// allocation
Allocate(id string)
// instrument lifecycle
Shutdown()
}
type MetricsInstrument ¶
type MetricsInstrument struct {
Config *MetricsInstrumentConfig
// contains filtered or unexported fields
}
func (*MetricsInstrument) NewInstance ¶
func (self *MetricsInstrument) NewInstance(id string) InstrumentInstance
func (*MetricsInstrument) WriteAllSamples ¶
func (self *MetricsInstrument) WriteAllSamples() error
type MetricsInstrumentConfig ¶
type NilInstrumentInstance ¶
type NilInstrumentInstance struct{}
func (NilInstrumentInstance) Allocate ¶
func (n NilInstrumentInstance) Allocate(id string)
func (NilInstrumentInstance) Closed ¶
func (n NilInstrumentInstance) Closed(Adapter)
func (NilInstrumentInstance) DuplicateAck ¶
func (n NilInstrumentInstance) DuplicateAck(ack int32)
func (NilInstrumentInstance) DuplicateRx ¶
func (n NilInstrumentInstance) DuplicateRx(wm *WireMessage)
func (NilInstrumentInstance) NewRetxMs ¶
func (n NilInstrumentInstance) NewRetxMs(retxMs int)
func (NilInstrumentInstance) NewRetxScale ¶
func (n NilInstrumentInstance) NewRetxScale(retxScale float64)
func (NilInstrumentInstance) ReadError ¶
func (n NilInstrumentInstance) ReadError(err error)
func (NilInstrumentInstance) RxAck ¶
func (n NilInstrumentInstance) RxAck(wm *WireMessage)
func (NilInstrumentInstance) RxKeepalive ¶
func (n NilInstrumentInstance) RxKeepalive(wm *WireMessage)
func (NilInstrumentInstance) RxPortalSzChanged ¶
func (n NilInstrumentInstance) RxPortalSzChanged(capacity int)
func (NilInstrumentInstance) Shutdown ¶
func (n NilInstrumentInstance) Shutdown()
func (NilInstrumentInstance) TxAck ¶
func (n NilInstrumentInstance) TxAck(wm *WireMessage)
func (NilInstrumentInstance) TxKeepalive ¶
func (n NilInstrumentInstance) TxKeepalive(wm *WireMessage)
func (NilInstrumentInstance) TxPortalCapacityChanged ¶
func (n NilInstrumentInstance) TxPortalCapacityChanged(capacity int)
func (NilInstrumentInstance) TxPortalRxSzChanged ¶
func (n NilInstrumentInstance) TxPortalRxSzChanged(sz int)
func (NilInstrumentInstance) TxPortalSzChanged ¶
func (n NilInstrumentInstance) TxPortalSzChanged(capacity int)
func (NilInstrumentInstance) UnexpectedMessageType ¶
func (n NilInstrumentInstance) UnexpectedMessageType(mt messageType)
func (NilInstrumentInstance) WireMessageRetx ¶
func (n NilInstrumentInstance) WireMessageRetx(wm *WireMessage)
func (NilInstrumentInstance) WireMessageRx ¶
func (n NilInstrumentInstance) WireMessageRx(wm *WireMessage)
func (NilInstrumentInstance) WireMessageTx ¶
func (n NilInstrumentInstance) WireMessageTx(wm *WireMessage)
func (NilInstrumentInstance) WriteError ¶
func (n NilInstrumentInstance) WriteError(err error)
type ReadSinkAdapter ¶
type ReadSinkAdapter struct {
// contains filtered or unexported fields
}
func (*ReadSinkAdapter) Accept ¶
func (self *ReadSinkAdapter) Accept(data []byte) error
func (*ReadSinkAdapter) Close ¶
func (self *ReadSinkAdapter) Close()
type RxPortal ¶
type RxPortal struct {
// contains filtered or unexported fields
}
func NewRxPortal ¶
func (*RxPortal) Rx ¶
func (rxp *RxPortal) Rx(wm *WireMessage) (err error)
func (*RxPortal) SetAccepted ¶
type Sink ¶
func NewReadSinkAdapter ¶
func NewReadSinkAdapter(profile WestworldAlgorithm) Sink
type TxAlgorithm ¶
type TxAlgorithm interface {
// SetLock will receive the shared lock from TxPortal.
//
SetLock(lock *sync.Mutex)
// Tx will block the caller until there is sufficient space on the wire to enqueue the message.
//
Tx(int)
// Success will unblock Tx callers by freeing up space on the wire from a successfully received message.
//
Success(int)
// DuplicateAck is a signal that a duplicate transmission was received by the receiver.
//
DuplicateAck()
// Retransmission is a signal that an acknowledgement was not received from the receiver within the round-trip time
// window, and the transmitter sent another copy of the message.
//
Retransmission(int)
// ProbeRTT will return bool when the transmitter is due to probe round trip time. It will also record that true
// response and will not return true again until the algorithm wants another RTT probe.
//
ProbeRTT() bool
// UpdateRTT pushes a round-trip time probe result onto the algorithm, allowing it to adapt its RetxMs calculation
// accordingly.
//
UpdateRTT(rttMs int)
// RetxMs returns the current timeout value for retransmission events.
//
RetxMs() int
// RxPortalSize returns the currently observed size of the receiver's buffer.
//
RxPortalSize() int
// UpdateRxPortalSize updates the observed size of the receiver's buffer.
//
UpdateRxPortalSize(int)
// RxPortalPacing determines whether or not the RxPortal should send a keepalive in response to portal size changes.
//
RxPortalPacing(oldSize, newSize int) bool
// Profile returns the requested tunables for this algorithm.
//
Profile() *TxProfile
}
TxAlgorithm is an abstraction of an extensible flow-control implementation, which can be plugged into a TxPortal instance.
func NewWestworldAlgorithm ¶
func NewWestworldAlgorithm(pf *WestworldProfile, ii InstrumentInstance) TxAlgorithm
type TxAlgorithmProfile ¶
type TxAlgorithmProfile interface {
Create(ii InstrumentInstance) (TxAlgorithm, error)
}
type TxMonitor ¶
type TxMonitor struct {
// contains filtered or unexported fields
}
TxMonitor is responsible for managing in-flight payloads, retransmitting payloads when their timeout expires.
type TxPortal ¶
type TxPortal struct {
// contains filtered or unexported fields
}
TxPortal manages the outgoing data transmitted by a communication instance. It is one half of a TxPortal->RxPortal communication pair. TxPortal is primarily concerned with optimizing the transmission rate over lossy Adapter implementations, while ensuring reliability.
func NewTxPortal ¶
func NewTxPortal(adapter Adapter, alg TxAlgorithm, closer *Closer, ii InstrumentInstance) *TxPortal
type TxProfile ¶
type TxProfile struct {
MaxSegmentSize int
RetxBatchMs int
SendKeepalive bool
ConnectionTimeout time.Duration
MaxTreeSize int
ReadsQueueSize int
PoolBufferSize int
RxPortalPacingThreshold float64
CloseCheckMs int
}
TxProfile defines all of the configurable values that are requested by a flow control algorithm.
func DefaultTxProfile ¶
func DefaultTxProfile() *TxProfile
type WestworldAlgorithm ¶
type WestworldAlgorithm struct {
// contains filtered or unexported fields
}
WestworldAlgorithm implements the latest iteration of "westworld"-style flow control.
func (*WestworldAlgorithm) DuplicateAck ¶
func (wa *WestworldAlgorithm) DuplicateAck()
func (*WestworldAlgorithm) ProbeRTT ¶
func (wa *WestworldAlgorithm) ProbeRTT() bool
func (*WestworldAlgorithm) Profile ¶
func (wa *WestworldAlgorithm) Profile() *TxProfile
func (*WestworldAlgorithm) Retransmission ¶
func (wa *WestworldAlgorithm) Retransmission(_ int)
func (*WestworldAlgorithm) RetxMs ¶
func (wa *WestworldAlgorithm) RetxMs() int
func (*WestworldAlgorithm) RxPortalPacing ¶
func (wa *WestworldAlgorithm) RxPortalPacing(oldSize, newSize int) bool
func (*WestworldAlgorithm) RxPortalSize ¶
func (wa *WestworldAlgorithm) RxPortalSize() int
func (*WestworldAlgorithm) SetLock ¶
func (wa *WestworldAlgorithm) SetLock(lock *sync.Mutex)
func (*WestworldAlgorithm) Success ¶
func (wa *WestworldAlgorithm) Success(segmentSize int)
func (*WestworldAlgorithm) Tx ¶
func (wa *WestworldAlgorithm) Tx(segmentSize int)
func (*WestworldAlgorithm) UpdateRTT ¶
func (wa *WestworldAlgorithm) UpdateRTT(rttMs int)
func (*WestworldAlgorithm) UpdateRxPortalSize ¶
func (wa *WestworldAlgorithm) UpdateRxPortalSize(rxPortalSize int)
type WestworldProfile ¶
type WestworldProfile struct {
StartSize int
MinSize int
MaxSize int
SuccessThresh int
SuccessScale float64
DupAckThresh int
DupAckCapacityScale float64
DupAckSuccessScale float64
RetxStartMs int
RetxAddMs int
RetxThresh int
RetxCapacityScale float64
RetxSuccessScale float64
RxSizePressureScale float64
RttProbeMs int
RttProbeAvg int
Txpf *TxProfile
}
func NewBaselineWestworldProfile ¶
func NewBaselineWestworldProfile() *WestworldProfile
func (*WestworldProfile) Create ¶
func (wp *WestworldProfile) Create(ii InstrumentInstance) (TxAlgorithm, error)
type WireMessage ¶
type WireMessage struct {
Seq int32
Mt messageType
// contains filtered or unexported fields
}
