forked from couchbase/gocb
/
bucket_token.go
85 lines (64 loc) · 2.62 KB
/
bucket_token.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package gocb
// RemoveMt performs a Remove operation and includes MutationToken in the results.
func (b *Bucket) RemoveMt(key string, cas Cas) (Cas, MutationToken, error) {
if !b.mtEnabled {
panic("You must use OpenBucketMt with Mt operation variants.")
}
span := b.startKvOpTrace("RemoveMt")
defer span.Finish()
return b.remove(span.Context(), key, cas)
}
// UpsertMt performs a Upsert operation and includes MutationToken in the results.
func (b *Bucket) UpsertMt(key string, value interface{}, expiry uint32) (Cas, MutationToken, error) {
if !b.mtEnabled {
panic("You must use OpenBucketMt with Mt operation variants.")
}
span := b.startKvOpTrace("UpsertMt")
defer span.Finish()
return b.upsert(span.Context(), key, value, expiry)
}
// InsertMt performs a Insert operation and includes MutationToken in the results.
func (b *Bucket) InsertMt(key string, value interface{}, expiry uint32) (Cas, MutationToken, error) {
if !b.mtEnabled {
panic("You must use OpenBucketMt with Mt operation variants.")
}
span := b.startKvOpTrace("InsertMt")
defer span.Finish()
return b.insert(span.Context(), key, value, expiry)
}
// ReplaceMt performs a Replace operation and includes MutationToken in the results.
func (b *Bucket) ReplaceMt(key string, value interface{}, cas Cas, expiry uint32) (Cas, MutationToken, error) {
if !b.mtEnabled {
panic("You must use OpenBucketMt with Mt operation variants.")
}
span := b.startKvOpTrace("ReplaceMt")
defer span.Finish()
return b.replace(span.Context(), key, value, cas, expiry)
}
// AppendMt performs a Append operation and includes MutationToken in the results.
func (b *Bucket) AppendMt(key, value string) (Cas, MutationToken, error) {
if !b.mtEnabled {
panic("You must use OpenBucketMt with Mt operation variants.")
}
span := b.startKvOpTrace("AppendMt")
defer span.Finish()
return b.append(span.Context(), key, value)
}
// PrependMt performs a Prepend operation and includes MutationToken in the results.
func (b *Bucket) PrependMt(key, value string) (Cas, MutationToken, error) {
if !b.mtEnabled {
panic("You must use OpenBucketMt with Mt operation variants.")
}
span := b.startKvOpTrace("PrependMt")
defer span.Finish()
return b.prepend(span.Context(), key, value)
}
// CounterMt performs a Counter operation and includes MutationToken in the results.
func (b *Bucket) CounterMt(key string, delta, initial int64, expiry uint32) (uint64, Cas, MutationToken, error) {
if !b.mtEnabled {
panic("You must use OpenBucketMt with Mt operation variants.")
}
span := b.startKvOpTrace("CounterMt")
defer span.Finish()
return b.counter(span.Context(), key, delta, initial, expiry)
}