Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrProxyAlreadyConnected = errors.New("proxy already connected")
View Source
var ErrProxyClosed = errors.New("proxy closed")
View Source
var ErrProxyNotConnected = errors.New("proxy not connected")
Functions ¶
func NewDefaultPreparedCache ¶
func NewDefaultPreparedCache(size int) (proxycore.PreparedCache, error)
NewDefaultPreparedCache creates a new default prepared cache capping the max item capacity to `size`.
Types ¶
type Config ¶
type Config struct { Version primitive.ProtocolVersion MaxVersion primitive.ProtocolVersion Auth proxycore.Authenticator Resolver proxycore.EndpointResolver ReconnectPolicy proxycore.ReconnectPolicy RetryPolicy RetryPolicy IdempotentGraph bool NumConns int Logger *zap.Logger HeartBeatInterval time.Duration ConnectTimeout time.Duration IdleTimeout time.Duration RPCAddr string DC string Tokens []string Peers []PeerConfig // PreparedCache a cache that stores prepared queries. If not set it uses the default implementation with a max // capacity of ~100MB. PreparedCache proxycore.PreparedCache }
type PeerConfig ¶ added in v0.1.2
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
func (*Proxy) OutageDuration ¶ added in v0.1.0
type RetryDecision ¶ added in v0.1.0
type RetryDecision int
RetryDecision is a type used for deciding what to do when a request has failed.
const ( // RetrySame should be returned when a request should be retried on the same host. RetrySame RetryDecision = iota // RetryNext should be returned when a request should be retried on the next host according to the request's query // plan. RetryNext // ReturnError should be returned when a request's original error should be forwarded along to the client. ReturnError )
func (RetryDecision) String ¶ added in v0.1.0
func (r RetryDecision) String() string
type RetryPolicy ¶ added in v0.1.0
type RetryPolicy interface { // OnReadTimeout handles the retry decision for a server-side read timeout error (Read_timeout = 0x1200). // This occurs when a replica read request times out during a read query. OnReadTimeout(msg *message.ReadTimeout, retryCount int) RetryDecision // OnWriteTimeout handles the retry decision for a server-side write timeout error (Write_timeout = 0x1100). // This occurs when a replica write request times out during a write query. OnWriteTimeout(msg *message.WriteTimeout, retryCount int) RetryDecision // This occurs when a coordinator determines that there are not enough replicas to handle a query at the requested // consistency level. OnUnavailable(msg *message.Unavailable, retryCount int) RetryDecision // OnErrorResponse handles the retry decision for other potentially recoverable errors. // This can be called for the following error types: server error (ServerError = 0x0000), // overloaded (Overloaded = 0x1001), truncate error (Truncate_error = 0x1003), read failure (Read_failure = 0x1300), // and write failure (Write_failure = 0x1500). OnErrorResponse(msg message.Error, retryCount int) RetryDecision }
RetryPolicy is an interface for defining retry behavior when a server-side error occurs.
func NewDefaultRetryPolicy ¶ added in v0.1.0
func NewDefaultRetryPolicy() RetryPolicy
NewDefaultRetryPolicy creates a new default retry policy. The default retry policy takes a conservative approach to retrying requests. In most cases it retries only once in cases where a retry is likely to succeed.
Click to show internal directories.
Click to hide internal directories.