behavior

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package behavior holds the runtime constants every Grvt SDK shares, and the write and retry decisions made with them.

Index

Constants

View Source
const CallTimeout = 30000 * time.Millisecond

CallTimeout: Default bound on one whole call, including preparation and retries.

View Source
const ClientOrderIDCounterBits = 31

ClientOrderIDCounterBits: Width of the per-process counter in the low bits of a generated client order ID.

View Source
const ClientOrderIDCounterMask = 0x7FFFFFFF

ClientOrderIDCounterMask: (1 << CLIENT_ORDER_ID_COUNTER_BITS) - 1.

View Source
const ClientOrderIDSecondsBits = 32

ClientOrderIDSecondsBits: Generated client order IDs are 1<<63 | seconds<<counter_bits | counter; seconds is the Unix time masked to this many bits.

View Source
const ClientOrderIDSecondsMask = 0xFFFFFFFF

ClientOrderIDSecondsMask: (1 << CLIENT_ORDER_ID_SECONDS_BITS) - 1.

View Source
const CountdownMaxSeconds = 300

CountdownMaxSeconds: Largest countdown the cancel-on-disconnect helper accepts.

View Source
const CountdownMinSeconds = 1

CountdownMinSeconds: Smallest countdown the cancel-on-disconnect helper accepts.

View Source
const HTTPAttemptTimeout = 10000 * time.Millisecond

HTTPAttemptTimeout: Default bound on one HTTP attempt, including login.

View Source
const QueueSize = 4096

QueueSize: Default bound on each subscription's queue.

View Source
const RateLimitCode = 1006

RateLimitCode: The rate-limit error code. A read always retries on it.

View Source
const ReadAttempts = 3

ReadAttempts: Tries in total for a read that keeps failing with a retryable error. Writes are sent once.

View Source
const ReadBackoffBase = 100 * time.Millisecond

ReadBackoffBase: Full-jitter backoff between read retries: wait uniform(0, min(cap, base * 2^attempt)).

View Source
const ReadBackoffCap = 2000 * time.Millisecond

ReadBackoffCap: Largest wait between read retries.

View Source
const ReconnectBackoffBase = 250 * time.Millisecond

ReconnectBackoffBase: Full-jitter backoff between WebSocket reconnects, same formula as reads.

View Source
const ReconnectBackoffCap = 30000 * time.Millisecond

ReconnectBackoffCap: Largest wait between WebSocket reconnects.

View Source
const ResyncTimeout = 5000 * time.Millisecond

ResyncTimeout: Default wait for a fresh snapshot after a gap re-subscribe before reconnecting.

View Source
const SessionDefaultLifetime = 3600000 * time.Millisecond

SessionDefaultLifetime: Session lifetime assumed when the cookie carries no expiry.

View Source
const SessionRenewAt = 0.8

SessionRenewAt: Log in again once this share of the session cookie's lifetime has passed.

View Source
const SessionRetryDelay = 5000 * time.Millisecond

SessionRetryDelay: Wait before trying a failed session renewal again.

View Source
const WSRequestTimeout = 5000 * time.Millisecond

WSRequestTimeout: Default wait for the reply to one WebSocket request.

View Source
const WriteRejectedStatusMax = 499

WriteRejectedStatusMax: Upper end of WRITE_REJECTED_STATUS_MIN's range.

View Source
const WriteRejectedStatusMin = 400

WriteRejectedStatusMin: Inclusive range. A write error is a definite rejection only if its HTTP status (when there is one) and its code's contract status are in it and the code is in the contract; otherwise the outcome is unknown.

Variables

This section is empty.

Functions

func ReadRetryStatuses

func ReadRetryStatuses() []int

ReadRetryStatuses: HTTP statuses a read retries on, whatever the error code. Codes the contract marks retryable retry too.

func ReadRetryable

func ReadRetryable(code, status int, codeRetryable bool) bool

ReadRetryable reports whether a read that failed with this error may be tried again. status is 0 when there is none; codeRetryable: the contract says so.

func RetryRead

func RetryRead(retryable bool, attempt int) bool

RetryRead reports whether to try a read again after its attempt-th try (from 1) failed; retryable as for the error.

func WriteOutcomeUnknown

func WriteOutcomeUnknown(status, codeStatus int) bool

WriteOutcomeUnknown reports whether a failed write whose request may have left this process may have reached the exchange. status is the reply's HTTP status and codeStatus the contract's HTTP status for the reply's error code; 0 when there is none (no reply, a reply that did not decode, a code the contract does not list).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL