-
Notifications
You must be signed in to change notification settings - Fork 104
/
stateblock.go
63 lines (46 loc) · 1.14 KB
/
stateblock.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package gocb
import (
"fmt"
"time"
)
type clientStateBlock struct {
BucketName string
}
func (sb *clientStateBlock) Hash() string {
return fmt.Sprintf("%s", sb.BucketName)
}
type stateBlock struct {
cachedClient client
clientStateBlock
ScopeName string
CollectionName string
UseServerDurations bool
ConnectTimeout time.Duration
KvTimeout time.Duration
DuraTimeout time.Duration
DuraPollTimeout time.Duration
PersistTo uint
ReplicateTo uint
QueryTimeout time.Duration
AnalyticsTimeout time.Duration
SearchTimeout time.Duration
ViewTimeout time.Duration
ManagementTimeout time.Duration
UseMutationTokens bool
Transcoder Transcoder
RetryStrategyWrapper *retryStrategyWrapper
OrphanLoggerEnabled bool
OrphanLoggerInterval time.Duration
OrphanLoggerSampleSize int
Tracer requestTracer
CircuitBreakerConfig CircuitBreakerConfig
}
func (sb *stateBlock) getCachedClient() client {
if sb.cachedClient == nil {
panic("attempted to fetch client from incomplete state block")
}
return sb.cachedClient
}
func (sb *stateBlock) cacheClient(cli client) {
sb.cachedClient = cli
}