Skip to content

Commit 006a234

Browse files
committed
firewalldb: rename kvStoreTx receiver
In preparation for it clashing with a transaction tx variable in an upcoming commit.
1 parent 34a202f commit 006a234

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

firewalldb/kvstores_kvdb.go

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ type kvStoreTx struct {
116116
// Global gives the caller access to the global kv store of the rule.
117117
//
118118
// NOTE: this is part of the rules.KVStoreTx interface.
119-
func (tx *kvStoreTx) Global() KVStore {
119+
func (s *kvStoreTx) Global() KVStore {
120120
return &kvStoreTx{
121-
kvStores: tx.kvStores,
122-
boltTx: tx.boltTx,
123-
getBucket: getGlobalRuleBucket(true, tx.ruleName),
121+
kvStores: s.kvStores,
122+
boltTx: s.boltTx,
123+
getBucket: getGlobalRuleBucket(true, s.ruleName),
124124
}
125125
}
126126

@@ -129,17 +129,17 @@ func (tx *kvStoreTx) Global() KVStore {
129129
// how the kv store was initialised.
130130
//
131131
// NOTE: this is part of the KVStoreTx interface.
132-
func (tx *kvStoreTx) Local() KVStore {
133-
fn := getSessionRuleBucket(true, tx.ruleName, tx.groupID)
134-
if tx.featureName != "" {
132+
func (s *kvStoreTx) Local() KVStore {
133+
fn := getSessionRuleBucket(true, s.ruleName, s.groupID)
134+
if s.featureName != "" {
135135
fn = getSessionFeatureRuleBucket(
136-
true, tx.ruleName, tx.groupID, tx.featureName,
136+
true, s.ruleName, s.groupID, s.featureName,
137137
)
138138
}
139139

140140
return &kvStoreTx{
141-
kvStores: tx.kvStores,
142-
boltTx: tx.boltTx,
141+
kvStores: s.kvStores,
142+
boltTx: s.boltTx,
143143
getBucket: fn,
144144
}
145145
}
@@ -148,29 +148,29 @@ func (tx *kvStoreTx) Local() KVStore {
148148
// rule.
149149
//
150150
// NOTE: this is part of the KVStoreTx interface.
151-
func (tx *kvStoreTx) GlobalTemp() KVStore {
151+
func (s *kvStoreTx) GlobalTemp() KVStore {
152152
return &kvStoreTx{
153-
kvStores: tx.kvStores,
154-
boltTx: tx.boltTx,
155-
getBucket: getGlobalRuleBucket(false, tx.ruleName),
153+
kvStores: s.kvStores,
154+
boltTx: s.boltTx,
155+
getBucket: getGlobalRuleBucket(false, s.ruleName),
156156
}
157157
}
158158

159159
// LocalTemp gives the caller access to the temporary local kv store of the
160160
// rule.
161161
//
162162
// NOTE: this is part of the KVStoreTx interface.
163-
func (tx *kvStoreTx) LocalTemp() KVStore {
164-
fn := getSessionRuleBucket(false, tx.ruleName, tx.groupID)
165-
if tx.featureName != "" {
163+
func (s *kvStoreTx) LocalTemp() KVStore {
164+
fn := getSessionRuleBucket(false, s.ruleName, s.groupID)
165+
if s.featureName != "" {
166166
fn = getSessionFeatureRuleBucket(
167-
false, tx.ruleName, tx.groupID, tx.featureName,
167+
false, s.ruleName, s.groupID, s.featureName,
168168
)
169169
}
170170

171171
return &kvStoreTx{
172-
kvStores: tx.kvStores,
173-
boltTx: tx.boltTx,
172+
kvStores: s.kvStores,
173+
boltTx: s.boltTx,
174174
getBucket: fn,
175175
}
176176
}
@@ -179,8 +179,8 @@ func (tx *kvStoreTx) LocalTemp() KVStore {
179179
// If no value is found, nil is returned.
180180
//
181181
// NOTE: this is part of the KVStore interface.
182-
func (tx *kvStoreTx) Get(_ context.Context, key string) ([]byte, error) {
183-
bucket, err := tx.getBucket(tx.boltTx, false)
182+
func (s *kvStoreTx) Get(_ context.Context, key string) ([]byte, error) {
183+
bucket, err := s.getBucket(s.boltTx, false)
184184
if err != nil {
185185
return nil, err
186186
}
@@ -194,8 +194,8 @@ func (tx *kvStoreTx) Get(_ context.Context, key string) ([]byte, error) {
194194
// Set sets the given key-value pair in the underlying kv store.
195195
//
196196
// NOTE: this is part of the KVStore interface.
197-
func (tx *kvStoreTx) Set(_ context.Context, key string, value []byte) error {
198-
bucket, err := tx.getBucket(tx.boltTx, true)
197+
func (s *kvStoreTx) Set(_ context.Context, key string, value []byte) error {
198+
bucket, err := s.getBucket(s.boltTx, true)
199199
if err != nil {
200200
return err
201201
}
@@ -206,8 +206,8 @@ func (tx *kvStoreTx) Set(_ context.Context, key string, value []byte) error {
206206
// Del deletes the value under the given key in the underlying kv store.
207207
//
208208
// NOTE: this is part of the .KVStore interface.
209-
func (tx *kvStoreTx) Del(_ context.Context, key string) error {
210-
bucket, err := tx.getBucket(tx.boltTx, false)
209+
func (s *kvStoreTx) Del(_ context.Context, key string) error {
210+
bucket, err := s.getBucket(s.boltTx, false)
211211
if err != nil {
212212
return err
213213
}

0 commit comments

Comments
 (0)