MCPcopy
hub / github.com/olric-data/olric / Client

Struct Client

config/client.go:39–107  ·  view source on GitHub ↗

Client denotes configuration for TCP clients in Olric and the official Golang client.

Source from the content-addressed store, hash-verified

37
38// Client denotes configuration for TCP clients in Olric and the official Golang client.
39type Client struct {
40 Authentication *Authentication
41
42 // Dial timeout for establishing new connections.
43 // Default is 5 seconds.
44 DialTimeout time.Duration
45
46 // Timeout for socket reads. If reached, commands will fail
47 // with a timeout instead of blocking. Use value -1 for no timeout and 0 for default.
48 // Default is 3 seconds.
49 ReadTimeout time.Duration
50
51 // Timeout for socket writes. If reached, commands will fail
52 // with a timeout instead of blocking.
53 // Default is ReadTimeout.
54 WriteTimeout time.Duration
55
56 // Dialer creates new network connection and has priority over
57 // Network and Addr options.
58 Dialer func(ctx context.Context, network, addr string) (net.Conn, error)
59
60 // Hook that is called when new connection is established.
61 OnConnect func(ctx context.Context, cn *redis.Conn) error
62
63 // Maximum number of retries before giving up.
64 // Default is 3 retries; -1 (not 0) disables retries.
65 MaxRetries int
66
67 // Minimum backoff between each retry.
68 // Default is 8 milliseconds; -1 disables backoff.
69 MinRetryBackoff time.Duration
70
71 // Maximum backoff between each retry.
72 // Default is 512 milliseconds; -1 disables backoff.
73 MaxRetryBackoff time.Duration
74
75 // Type of connection pool.
76 // true for FIFO pool, false for LIFO pool.
77 // Note that fifo has higher overhead compared to lifo.
78 PoolFIFO bool
79
80 // Maximum number of socket connections.
81 // Default is 10 connections per every available CPU as reported by runtime.GOMAXPROCS.
82 PoolSize int
83
84 // Minimum number of idle connections which is useful when establishing
85 // new connection is slow.
86 MinIdleConns int
87
88 // Connection age at which client retires (closes) the connection.
89 // Default is to not close aged connections.
90 MaxConnAge time.Duration
91
92 // Amount of time client waits for connection if all connections
93 // are busy before returning an error.
94 // Default is ReadTimeout + 1 second.
95 PoolTimeout time.Duration
96

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected