...

Package csot

import "go.mongodb.org/mongo-driver/internal/csot"
Overview
Index

Overview ▾

func IsTimeoutContext

func IsTimeoutContext(ctx context.Context) bool

func MakeTimeoutContext

func MakeTimeoutContext(ctx context.Context, to time.Duration) (context.Context, context.CancelFunc)

MakeTimeoutContext returns a new context with Client-Side Operation Timeout (CSOT) feature-gated behavior and a Timeout set to the passed in Duration. Setting a Timeout on a single operation is not supported in public API.

TODO(GODRIVER-2348) We may be able to remove this function once CSOT feature-gated behavior becomes the TODO default behavior.

type ZeroRTTMonitor

ZeroRTTMonitor implements the RTTMonitor interface and is used internally for testing. It returns 0 for all RTT calculations and an empty string for RTT statistics.

type ZeroRTTMonitor struct{}

func (*ZeroRTTMonitor) EWMA

func (zrm *ZeroRTTMonitor) EWMA() time.Duration

EWMA implements the RTT monitor interface.

func (*ZeroRTTMonitor) Min

func (zrm *ZeroRTTMonitor) Min() time.Duration

Min implements the RTT monitor interface.

func (*ZeroRTTMonitor) P90

func (zrm *ZeroRTTMonitor) P90() time.Duration

P90 implements the RTT monitor interface.

func (*ZeroRTTMonitor) Stats

func (zrm *ZeroRTTMonitor) Stats() string

Stats implements the RTT monitor interface.