@@ -575,67 +575,67 @@ type ActionsDB interface {
575
575
ListActions (ctx context.Context ) ([]* RuleAction , error )
576
576
}
577
577
578
- // ActionsReadDB is an abstraction gives a caller access to either a session
579
- // specific or feature specific rules.ActionDB
578
+ // ActionsReadDB is an abstraction gives a caller access to either a group
579
+ // specific or group and feature specific rules.ActionDB.
580
580
type ActionsReadDB interface {
581
- SessionActionsDB () ActionsDB
582
- FeatureActionsDB () ActionsDB
581
+ GroupActionsDB () ActionsDB
582
+ GroupFeatureActionsDB () ActionsDB
583
583
}
584
584
585
585
// ActionReadDBGetter represents a function that can be used to construct
586
586
// an ActionsReadDB.
587
587
type ActionReadDBGetter interface {
588
- GetActionsReadDB (sessionID session.ID , featureName string ) ActionsReadDB
588
+ GetActionsReadDB (groupID session.ID , featureName string ) ActionsReadDB
589
589
}
590
590
591
591
// GetActionsReadDB is a method on DB that constructs an ActionsReadDB.
592
- func (db * DB ) GetActionsReadDB (sessionID session.ID ,
592
+ func (db * DB ) GetActionsReadDB (groupID session.ID ,
593
593
featureName string ) ActionsReadDB {
594
594
595
595
return & allActionsReadDB {
596
596
db : db ,
597
- sessionID : sessionID ,
597
+ groupID : groupID ,
598
598
featureName : featureName ,
599
599
}
600
600
}
601
601
602
602
// allActionsReadDb is an implementation of the ActionsReadDB.
603
603
type allActionsReadDB struct {
604
604
db * DB
605
- sessionID session.ID
605
+ groupID session.ID
606
606
featureName string
607
607
}
608
608
609
609
var _ ActionsReadDB = (* allActionsReadDB )(nil )
610
610
611
- // SessionActionsDB returns a rules.ActionsDB that will give the caller access
612
- // to all of a sessions Actions.
613
- func (a * allActionsReadDB ) SessionActionsDB () ActionsDB {
614
- return & sessionActionsReadDB {a }
611
+ // GroupActionsDB returns a rules.ActionsDB that will give the caller access
612
+ // to all of a groups Actions.
613
+ func (a * allActionsReadDB ) GroupActionsDB () ActionsDB {
614
+ return & groupActionsReadDB {a }
615
615
}
616
616
617
- // FeatureActionsDB returns an rules.ActionsDB that will give the caller access
618
- // to only a specific features Actions in a specific session .
619
- func (a * allActionsReadDB ) FeatureActionsDB () ActionsDB {
620
- return & featureActionsReadDB {a }
617
+ // GroupFeatureActionsDB returns a rules.ActionsDB that will give the caller
618
+ // access to only a specific features Actions in a specific group .
619
+ func (a * allActionsReadDB ) GroupFeatureActionsDB () ActionsDB {
620
+ return & groupFeatureActionsReadDB {a }
621
621
}
622
622
623
- // sessionActionReadDB is an implementation of the rules.ActionsDB that will
624
- // provide read access to all the Actions of a particular session .
625
- type sessionActionsReadDB struct {
623
+ // groupActionsReadDB is an implementation of the rules.ActionsDB that will
624
+ // provide read access to all the Actions of a particular group .
625
+ type groupActionsReadDB struct {
626
626
* allActionsReadDB
627
627
}
628
628
629
- var _ ActionsDB = (* sessionActionsReadDB )(nil )
629
+ var _ ActionsDB = (* groupActionsReadDB )(nil )
630
630
631
- // ListActions will return all the Actions for a particular session .
632
- func (s * sessionActionsReadDB ) ListActions (_ context.Context ) ([]* RuleAction ,
631
+ // ListActions will return all the Actions for a particular group .
632
+ func (s * groupActionsReadDB ) ListActions (_ context.Context ) ([]* RuleAction ,
633
633
error ) {
634
634
635
- sessionActions , _ , _ , err := s .db .ListSessionActions (
636
- s .sessionID , func (a * Action , _ bool ) (bool , bool ) {
635
+ sessionActions , err := s .db .ListGroupActions (
636
+ s .groupID , func (a * Action , _ bool ) (bool , bool ) {
637
637
return a .State == ActionStateDone , true
638
- }, nil ,
638
+ },
639
639
)
640
640
if err != nil {
641
641
return nil , err
@@ -649,25 +649,25 @@ func (s *sessionActionsReadDB) ListActions(_ context.Context) ([]*RuleAction,
649
649
return actions , nil
650
650
}
651
651
652
- // featureActionReadDB is an implementation of the rules.ActionsDB that will
653
- // provide read access to all the Actions of a feature within a particular
654
- // session .
655
- type featureActionsReadDB struct {
652
+ // groupFeatureActionsReadDB is an implementation of the rules.ActionsDB that
653
+ // will provide read access to all the Actions of a feature within a particular
654
+ // group .
655
+ type groupFeatureActionsReadDB struct {
656
656
* allActionsReadDB
657
657
}
658
658
659
- var _ ActionsDB = (* featureActionsReadDB )(nil )
659
+ var _ ActionsDB = (* groupFeatureActionsReadDB )(nil )
660
660
661
- // ListActions will return all the Actions for a particular session that were
661
+ // ListActions will return all the Actions for a particular group that were
662
662
// executed by a particular feature.
663
- func (a * featureActionsReadDB ) ListActions (_ context.Context ) ([] * RuleAction ,
664
- error ) {
663
+ func (a * groupFeatureActionsReadDB ) ListActions (_ context.Context ) (
664
+ [] * RuleAction , error ) {
665
665
666
- featureActions , _ , _ , err := a .db .ListSessionActions (
667
- a .sessionID , func (action * Action , _ bool ) (bool , bool ) {
666
+ featureActions , err := a .db .ListGroupActions (
667
+ a .groupID , func (action * Action , _ bool ) (bool , bool ) {
668
668
return action .State == ActionStateDone &&
669
669
action .FeatureName == a .featureName , true
670
- }, nil ,
670
+ },
671
671
)
672
672
if err != nil {
673
673
return nil , err
0 commit comments