diff --git a/firewalldb/actions.go b/firewalldb/actions.go index 62b85fee..9ca1e9a5 100644 --- a/firewalldb/actions.go +++ b/firewalldb/actions.go @@ -109,10 +109,10 @@ type RuleAction struct { PerformedAt time.Time } -// ActionsDB represents a DB backend that contains Action entries that can +// ActionsListDB represents a DB backend that contains Action entries that can // be queried. It allows us to abstract away the details of the data storage // method. -type ActionsDB interface { +type ActionsListDB interface { // ListActions returns a list of past Action items. ListActions(ctx context.Context) ([]*RuleAction, error) } @@ -120,8 +120,8 @@ type ActionsDB interface { // ActionsReadDB is an abstraction gives a caller access to either a group // specific or group and feature specific rules.ActionDB. type ActionsReadDB interface { - GroupActionsDB() ActionsDB - GroupFeatureActionsDB() ActionsDB + GroupActionsDB() ActionsListDB + GroupFeatureActionsDB() ActionsListDB } // ActionReadDBGetter represents a function that can be used to construct @@ -150,25 +150,25 @@ type allActionsReadDB struct { var _ ActionsReadDB = (*allActionsReadDB)(nil) -// GroupActionsDB returns a rules.ActionsDB that will give the caller access +// GroupActionsDB returns a rules.ActionsListDB that will give the caller access // to all of a groups Actions. -func (a *allActionsReadDB) GroupActionsDB() ActionsDB { +func (a *allActionsReadDB) GroupActionsDB() ActionsListDB { return &groupActionsReadDB{a} } -// GroupFeatureActionsDB returns a rules.ActionsDB that will give the caller +// GroupFeatureActionsDB returns a rules.ActionsListDB that will give the caller // access to only a specific features Actions in a specific group. -func (a *allActionsReadDB) GroupFeatureActionsDB() ActionsDB { +func (a *allActionsReadDB) GroupFeatureActionsDB() ActionsListDB { return &groupFeatureActionsReadDB{a} } -// groupActionsReadDB is an implementation of the rules.ActionsDB that will +// groupActionsReadDB is an implementation of the rules.ActionsListDB that will // provide read access to all the Actions of a particular group. type groupActionsReadDB struct { *allActionsReadDB } -var _ ActionsDB = (*groupActionsReadDB)(nil) +var _ ActionsListDB = (*groupActionsReadDB)(nil) // ListActions will return all the Actions for a particular group. func (s *groupActionsReadDB) ListActions(ctx context.Context) ([]*RuleAction, @@ -191,14 +191,14 @@ func (s *groupActionsReadDB) ListActions(ctx context.Context) ([]*RuleAction, return actions, nil } -// groupFeatureActionsReadDB is an implementation of the rules.ActionsDB that +// groupFeatureActionsReadDB is an implementation of the rules.ActionsListDB that // will provide read access to all the Actions of a feature within a particular // group. type groupFeatureActionsReadDB struct { *allActionsReadDB } -var _ ActionsDB = (*groupFeatureActionsReadDB)(nil) +var _ ActionsListDB = (*groupFeatureActionsReadDB)(nil) // ListActions will return all the Actions for a particular group that were // executed by a particular feature. diff --git a/firewalldb/actions_test.go b/firewalldb/actions_test.go index 63a77ec4..5d9328e6 100644 --- a/firewalldb/actions_test.go +++ b/firewalldb/actions_test.go @@ -39,7 +39,7 @@ var ( } ) -// TestActionStorage tests that the ActionsDB CRUD logic. +// TestActionStorage tests that the ActionsListDB CRUD logic. func TestActionStorage(t *testing.T) { tmpDir := t.TempDir() diff --git a/rules/config.go b/rules/config.go index a109c351..2bd92f01 100644 --- a/rules/config.go +++ b/rules/config.go @@ -16,7 +16,7 @@ type Config interface { // GetActionsDB can be used by rules to list any past actions that were // made for the specific session or feature. - GetActionsDB() firewalldb.ActionsDB + GetActionsDB() firewalldb.ActionsListDB // GetMethodPerms returns a map that contains URIs and the permissions // required to use them. @@ -48,7 +48,7 @@ type ConfigImpl struct { // ActionsDB can be used by rules to list any past actions that were // made for the specific session or feature. - ActionsDB firewalldb.ActionsDB + ActionsDB firewalldb.ActionsListDB // MethodPerms is a function that can be used to fetch the permissions // required for a URI. @@ -76,7 +76,7 @@ func (c *ConfigImpl) GetStores() firewalldb.KVStores { } // GetActionsDB returns the list of past actions. -func (c *ConfigImpl) GetActionsDB() firewalldb.ActionsDB { +func (c *ConfigImpl) GetActionsDB() firewalldb.ActionsListDB { return c.ActionsDB } diff --git a/rules/rate_limit.go b/rules/rate_limit.go index f324721a..df2302bf 100644 --- a/rules/rate_limit.go +++ b/rules/rate_limit.go @@ -87,7 +87,7 @@ func (r *RateLimitMgr) EmptyValue() Values { // rateLimitConfig is the config required by RateLimitMgr. It can be derived // from the main rules Config struct. type rateLimitConfig interface { - GetActionsDB() firewalldb.ActionsDB + GetActionsDB() firewalldb.ActionsListDB GetMethodPerms() func(string) ([]bakery.Op, bool) } diff --git a/rules/rate_limit_test.go b/rules/rate_limit_test.go index 257232b6..1f291d29 100644 --- a/rules/rate_limit_test.go +++ b/rules/rate_limit_test.go @@ -216,7 +216,7 @@ type mockRateLimitCfg struct { var _ rateLimitConfig = (*mockRateLimitCfg)(nil) -func (m *mockRateLimitCfg) GetActionsDB() firewalldb.ActionsDB { +func (m *mockRateLimitCfg) GetActionsDB() firewalldb.ActionsListDB { return m.db } @@ -233,7 +233,7 @@ type mockActionsDB struct { actions []*firewalldb.RuleAction } -var _ firewalldb.ActionsDB = (*mockActionsDB)(nil) +var _ firewalldb.ActionsListDB = (*mockActionsDB)(nil) func (m *mockActionsDB) addAction(uri string, timestamp time.Time) { m.actions = append(m.actions, &firewalldb.RuleAction{