Debian Codegraph @

jetstream/kv_options.go

raw symbols SCIP
1 // Copyright 2024 The NATS Authors
2 // Licensed under the Apache License, Version 2.0 (the "License");
3 // you may not use this file except in compliance with the License.
4 // You may obtain a copy of the License at
5 //
6 // http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13
14 package jetstreamscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/
15
16 import (
17 "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/"
18 "timescip-go gomod github.com/golang/go/src go1.25.0 time/"
19 )
20
21 type watchOptFnscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOptFn# func(opts *watchOptsscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOpts#) error
22
23 func (opt watchOptFnscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOptFn#) configureWatcherscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOptFn#configureWatcher().(opts *watchOptsscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOpts#) error {
24 return opt(opts)
25 }
26
27 // IncludeHistory instructs the key watcher to include historical values as
28 // well (up to KeyValueMaxHistory).
29 func IncludeHistoryscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/IncludeHistory().() WatchOptscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/WatchOpt# {
30 return watchOptFnscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOptFn#(func(opts *watchOptsscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOpts#) error {
31 if opts.updatesOnlyscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOpts#updatesOnly. {
32 return fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("%w: include history cannot be used with updates only", ErrInvalidOptionscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/ErrInvalidOption.)
33 }
34 opts.includeHistoryscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOpts#includeHistory. = true
35 return nil
36 })
37 }
38
39 // UpdatesOnly instructs the key watcher to only include updates on values
40 // (without latest values when started).
41 func UpdatesOnlyscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/UpdatesOnly().() WatchOptscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/WatchOpt# {
42 return watchOptFnscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOptFn#(func(opts *watchOptsscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOpts#) error {
43 if opts.includeHistoryscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOpts#includeHistory. {
44 return fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("%w: updates only cannot be used with include history", ErrInvalidOptionscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/ErrInvalidOption.)
45 }
46 opts.updatesOnlyscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOpts#updatesOnly. = true
47 return nil
48 })
49 }
50
51 // IgnoreDeletes will prevent the key watcher from passing any deleted keys.
52 func IgnoreDeletesscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/IgnoreDeletes().() WatchOptscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/WatchOpt# {
53 return watchOptFnscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOptFn#(func(opts *watchOptsscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOpts#) error {
54 opts.ignoreDeletesscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOpts#ignoreDeletes. = true
55 return nil
56 })
57 }
58
59 // MetaOnly instructs the key watcher to retrieve only the entry metadata, not
60 // the entry value.
61 func MetaOnlyscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/MetaOnly().() WatchOptscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/WatchOpt# {
62 return watchOptFnscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOptFn#(func(opts *watchOptsscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOpts#) error {
63 opts.metaOnlyscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOpts#metaOnly. = true
64 return nil
65 })
66 }
67
68 // ResumeFromRevision instructs the key watcher to resume from a specific
69 // revision number.
70 func ResumeFromRevisionscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/ResumeFromRevision().(revision uint64) WatchOptscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/WatchOpt# {
71 return watchOptFnscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOptFn#(func(opts *watchOptsscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOpts#) error {
72 opts.resumeFromRevisionscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/watchOpts#resumeFromRevision. = revision
73 return nil
74 })
75 }
76
77 // DeleteMarkersOlderThan indicates that delete or purge markers older than that
78 // will be deleted as part of [KeyValue.PurgeDeletes] operation, otherwise, only the data
79 // will be removed but markers that are recent will be kept.
80 // Note that if no option is specified, the default is 30 minutes. You can set
81 // this option to a negative value to instruct to always remove the markers,
82 // regardless of their age.
83 type DeleteMarkersOlderThanscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/DeleteMarkersOlderThan# timescip-go gomod github.com/golang/go/src go1.25.0 time/.Durationscip-go gomod github.com/golang/go/src go1.25.0 time/Duration#
84
85 func (ttl DeleteMarkersOlderThanscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/DeleteMarkersOlderThan#) configurePurgescip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/DeleteMarkersOlderThan#configurePurge().(opts *purgeOptsscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/purgeOpts#) error {
86 opts.dmthrscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/purgeOpts#dmthr. = timescip-go gomod github.com/golang/go/src go1.25.0 time/.Durationscip-go gomod github.com/golang/go/src go1.25.0 time/Duration#(ttl)
87 return nil
88 }
89
90 type deleteOptFnscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/deleteOptFn# func(opts *deleteOptsscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/deleteOpts#) error
91
92 func (opt deleteOptFnscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/deleteOptFn#) configureDeletescip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/deleteOptFn#configureDelete().(opts *deleteOptsscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/deleteOpts#) error {
93 return opt(opts)
94 }
95
96 // LastRevision deletes if the latest revision matches the provided one. If the
97 // provided revision is not the latest, the delete will return an error.
98 func LastRevisionscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/LastRevision().(revision uint64) KVDeleteOptscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/KVDeleteOpt# {
99 return deleteOptFnscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/deleteOptFn#(func(opts *deleteOptsscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/deleteOpts#) error {
100 opts.revisionscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/deleteOpts#revision. = revision
101 return nil
102 })
103 }
104
105 // PurgeTTL sets the TTL for the purge operation.
106 // After the TTL expires, the delete markers will be removed.
107 // This requires LimitMarkerTTL to be enabled on the bucket.
108 // Note that this is not the same as the TTL for the key itself, which is set
109 // using the KeyTTL option when creating the key.
110 func PurgeTTLscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/PurgeTTL().(ttl timescip-go gomod github.com/golang/go/src go1.25.0 time/.Durationscip-go gomod github.com/golang/go/src go1.25.0 time/Duration#) KVDeleteOptscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/KVDeleteOpt# {
111 return deleteOptFnscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/deleteOptFn#(func(opts *deleteOptsscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/deleteOpts#) error {
112 opts.ttlscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/deleteOpts#ttl. = ttl
113 return nil
114 })
115 }
116
117 type createOptFnscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/createOptFn# func(opts *createOptsscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/createOpts#) error
118
119 func (opt createOptFnscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/createOptFn#) configureCreatescip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/createOptFn#configureCreate().(opts *createOptsscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/createOpts#) error {
120 return opt(opts)
121 }
122
123 // KeyTTL sets the TTL for the key. This is the time after which the key will be
124 // automatically deleted. The TTL is set when the key is created and cannot be
125 // changed later. This requires LimitMarkerTTL to be enabled on the bucket.
126 func KeyTTLscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/KeyTTL().(ttl timescip-go gomod github.com/golang/go/src go1.25.0 time/.Durationscip-go gomod github.com/golang/go/src go1.25.0 time/Duration#) KVCreateOptscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/KVCreateOpt# {
127 return createOptFnscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/createOptFn#(func(opts *createOptsscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/createOpts#) error {
128 opts.ttlscip-go gomod github.com/nats-io/nats.go . `github.com/nats-io/nats.go/jetstream`/createOpts#ttl. = ttl
129 return nil
130 })
131 }