@@ -13,11 +13,11 @@ the `perm` and `temp` buckets are identical in structure. The only difference is
1313that the `temp` bucket is cleared on restart of the db.
1414
1515rules -> perm -> rule-name -> global -> {k:v}
16- -> sessions -> sessionID -> session-kv-store -> {k:v}
16+ -> sessions -> group ID -> session-kv-store -> {k:v}
1717 -> feature-kv-stores -> feature-name -> {k:v}
1818
1919 -> temp -> rule-name -> global -> {k:v}
20- -> sessions -> sessionID -> session-kv-store -> {k:v}
20+ -> sessions -> group ID -> session-kv-store -> {k:v}
2121 -> feature-kv-stores -> feature-name -> {k:v}
2222*/
2323
4444 sessKVStoreBucketKey = []byte ("session-kv-store" )
4545
4646 // featureKVStoreBucketKey is the kye under which a kv store specific
47- // the session id and feature name is stored.
47+ // the group id and feature name is stored.
4848 featureKVStoreBucketKey = []byte ("feature-kv-store" )
4949)
5050
@@ -72,12 +72,12 @@ type KVStores interface {
7272type KVStoreTx interface {
7373 // Global returns a persisted global, rule-name indexed, kv store. A
7474 // rule with a given name will have access to this store independent of
75- // session ID or feature.
75+ // group ID or feature.
7676 Global () KVStore
7777
7878 // Local returns a persisted local kv store for the rule. Depending on
7979 // how the implementation is initialised, this will either be under the
80- // session ID namespace or the session ID _and_ feature name namespace.
80+ // group ID namespace or the group ID _and_ feature name namespace.
8181 Local () KVStore
8282
8383 // GlobalTemp is similar to the Global store except that its contents
@@ -105,17 +105,17 @@ type KVStore interface {
105105
106106// RulesDB can be used to initialise a new rules.KVStores.
107107type RulesDB interface {
108- GetKVStores (rule string , sessionID session.ID , feature string ) KVStores
108+ GetKVStores (rule string , groupID session.ID , feature string ) KVStores
109109}
110110
111111// GetKVStores constructs a new rules.KVStores backed by a bbolt db.
112- func (db * DB ) GetKVStores (rule string , sessionID session.ID ,
112+ func (db * DB ) GetKVStores (rule string , groupID session.ID ,
113113 feature string ) KVStores {
114114
115115 return & kvStores {
116116 DB : db ,
117117 ruleName : rule ,
118- sessionID : sessionID ,
118+ groupID : groupID ,
119119 featureName : feature ,
120120 }
121121}
@@ -124,7 +124,7 @@ func (db *DB) GetKVStores(rule string, sessionID session.ID,
124124type kvStores struct {
125125 * DB
126126 ruleName string
127- sessionID session.ID
127+ groupID session.ID
128128 featureName string
129129}
130130
@@ -237,10 +237,10 @@ func (tx *kvStoreTx) Global() KVStore {
237237//
238238// NOTE: this is part of the KVStoreTx interface.
239239func (tx * kvStoreTx ) Local () KVStore {
240- fn := getSessionRuleBucket (true , tx .ruleName , tx .sessionID )
240+ fn := getSessionRuleBucket (true , tx .ruleName , tx .groupID )
241241 if tx .featureName != "" {
242242 fn = getSessionFeatureRuleBucket (
243- true , tx .ruleName , tx .sessionID , tx .featureName ,
243+ true , tx .ruleName , tx .groupID , tx .featureName ,
244244 )
245245 }
246246
@@ -268,10 +268,10 @@ func (tx *kvStoreTx) GlobalTemp() KVStore {
268268//
269269// NOTE: this is part of the KVStoreTx interface.
270270func (tx * kvStoreTx ) LocalTemp () KVStore {
271- fn := getSessionRuleBucket (true , tx .ruleName , tx .sessionID )
271+ fn := getSessionRuleBucket (true , tx .ruleName , tx .groupID )
272272 if tx .featureName != "" {
273273 fn = getSessionFeatureRuleBucket (
274- false , tx .ruleName , tx .sessionID , tx .featureName ,
274+ false , tx .ruleName , tx .groupID , tx .featureName ,
275275 )
276276 }
277277
@@ -390,11 +390,11 @@ func getGlobalRuleBucket(perm bool, ruleName string) getBucketFunc {
390390}
391391
392392// getSessionRuleBucket returns a function that can be used to fetch the
393- // bucket under which a kv store for a specific rule-name and session ID is
393+ // bucket under which a kv store for a specific rule-name and group ID is
394394// stored. The `perm` param determines if the temporary or permanent store is
395395// used.
396396func getSessionRuleBucket (perm bool , ruleName string ,
397- sessionID session.ID ) getBucketFunc {
397+ groupID session.ID ) getBucketFunc {
398398
399399 return func (tx * bbolt.Tx , create bool ) (* bbolt.Bucket , error ) {
400400 ruleBucket , err := getRuleBucket (perm , ruleName )(tx , create )
@@ -414,27 +414,28 @@ func getSessionRuleBucket(perm bool, ruleName string,
414414 return nil , err
415415 }
416416
417- return sessBucket .CreateBucketIfNotExists (sessionID [:])
417+ return sessBucket .CreateBucketIfNotExists (groupID [:])
418418 }
419419
420420 sessBucket := ruleBucket .Bucket (sessKVStoreBucketKey )
421421 if sessBucket == nil {
422422 return nil , nil
423423 }
424- return sessBucket .Bucket (sessionID [:]), nil
424+ return sessBucket .Bucket (groupID [:]), nil
425425 }
426426}
427427
428428// getSessionFeatureRuleBucket returns a function that can be used to fetch the
429- // bucket under which a kv store for a specific rule-name, session ID and
429+ // bucket under which a kv store for a specific rule-name, group ID and
430430// feature name is stored. The `perm` param determines if the temporary or
431431// permanent store is used.
432432func getSessionFeatureRuleBucket (perm bool , ruleName string ,
433- sessionID session.ID , featureName string ) getBucketFunc {
433+ groupID session.ID , featureName string ) getBucketFunc {
434434
435435 return func (tx * bbolt.Tx , create bool ) (* bbolt.Bucket , error ) {
436436 sessBucket , err := getSessionRuleBucket (
437- perm , ruleName , sessionID )(tx , create )
437+ perm , ruleName , groupID ,
438+ )(tx , create )
438439 if err != nil {
439440 return nil , err
440441 }
0 commit comments