Skip to content

Commit b4aadaa

Browse files
committed
multi: rename ActionsDB to ActionsListDB
To better represent the interface and to free up the use of the ActionsDB name as this will be used to represent the full Actions DB in an upcoming commit.
1 parent 412b4f0 commit b4aadaa

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

firewalldb/actions.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,19 @@ type RuleAction struct {
109109
PerformedAt time.Time
110110
}
111111

112-
// ActionsDB represents a DB backend that contains Action entries that can
112+
// ActionsListDB represents a DB backend that contains Action entries that can
113113
// be queried. It allows us to abstract away the details of the data storage
114114
// method.
115-
type ActionsDB interface {
115+
type ActionsListDB interface {
116116
// ListActions returns a list of past Action items.
117117
ListActions(ctx context.Context) ([]*RuleAction, error)
118118
}
119119

120120
// ActionsReadDB is an abstraction gives a caller access to either a group
121121
// specific or group and feature specific rules.ActionDB.
122122
type ActionsReadDB interface {
123-
GroupActionsDB() ActionsDB
124-
GroupFeatureActionsDB() ActionsDB
123+
GroupActionsDB() ActionsListDB
124+
GroupFeatureActionsDB() ActionsListDB
125125
}
126126

127127
// ActionReadDBGetter represents a function that can be used to construct
@@ -150,25 +150,25 @@ type allActionsReadDB struct {
150150

151151
var _ ActionsReadDB = (*allActionsReadDB)(nil)
152152

153-
// GroupActionsDB returns a rules.ActionsDB that will give the caller access
153+
// GroupActionsDB returns a rules.ActionsListDB that will give the caller access
154154
// to all of a groups Actions.
155-
func (a *allActionsReadDB) GroupActionsDB() ActionsDB {
155+
func (a *allActionsReadDB) GroupActionsDB() ActionsListDB {
156156
return &groupActionsReadDB{a}
157157
}
158158

159-
// GroupFeatureActionsDB returns a rules.ActionsDB that will give the caller
159+
// GroupFeatureActionsDB returns a rules.ActionsListDB that will give the caller
160160
// access to only a specific features Actions in a specific group.
161-
func (a *allActionsReadDB) GroupFeatureActionsDB() ActionsDB {
161+
func (a *allActionsReadDB) GroupFeatureActionsDB() ActionsListDB {
162162
return &groupFeatureActionsReadDB{a}
163163
}
164164

165-
// groupActionsReadDB is an implementation of the rules.ActionsDB that will
165+
// groupActionsReadDB is an implementation of the rules.ActionsListDB that will
166166
// provide read access to all the Actions of a particular group.
167167
type groupActionsReadDB struct {
168168
*allActionsReadDB
169169
}
170170

171-
var _ ActionsDB = (*groupActionsReadDB)(nil)
171+
var _ ActionsListDB = (*groupActionsReadDB)(nil)
172172

173173
// ListActions will return all the Actions for a particular group.
174174
func (s *groupActionsReadDB) ListActions(ctx context.Context) ([]*RuleAction,
@@ -191,14 +191,14 @@ func (s *groupActionsReadDB) ListActions(ctx context.Context) ([]*RuleAction,
191191
return actions, nil
192192
}
193193

194-
// groupFeatureActionsReadDB is an implementation of the rules.ActionsDB that
194+
// groupFeatureActionsReadDB is an implementation of the rules.ActionsListDB that
195195
// will provide read access to all the Actions of a feature within a particular
196196
// group.
197197
type groupFeatureActionsReadDB struct {
198198
*allActionsReadDB
199199
}
200200

201-
var _ ActionsDB = (*groupFeatureActionsReadDB)(nil)
201+
var _ ActionsListDB = (*groupFeatureActionsReadDB)(nil)
202202

203203
// ListActions will return all the Actions for a particular group that were
204204
// executed by a particular feature.

firewalldb/actions_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var (
3939
}
4040
)
4141

42-
// TestActionStorage tests that the ActionsDB CRUD logic.
42+
// TestActionStorage tests that the ActionsListDB CRUD logic.
4343
func TestActionStorage(t *testing.T) {
4444
tmpDir := t.TempDir()
4545

rules/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type Config interface {
1616

1717
// GetActionsDB can be used by rules to list any past actions that were
1818
// made for the specific session or feature.
19-
GetActionsDB() firewalldb.ActionsDB
19+
GetActionsDB() firewalldb.ActionsListDB
2020

2121
// GetMethodPerms returns a map that contains URIs and the permissions
2222
// required to use them.
@@ -48,7 +48,7 @@ type ConfigImpl struct {
4848

4949
// ActionsDB can be used by rules to list any past actions that were
5050
// made for the specific session or feature.
51-
ActionsDB firewalldb.ActionsDB
51+
ActionsDB firewalldb.ActionsListDB
5252

5353
// MethodPerms is a function that can be used to fetch the permissions
5454
// required for a URI.
@@ -76,7 +76,7 @@ func (c *ConfigImpl) GetStores() firewalldb.KVStores {
7676
}
7777

7878
// GetActionsDB returns the list of past actions.
79-
func (c *ConfigImpl) GetActionsDB() firewalldb.ActionsDB {
79+
func (c *ConfigImpl) GetActionsDB() firewalldb.ActionsListDB {
8080
return c.ActionsDB
8181
}
8282

rules/rate_limit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func (r *RateLimitMgr) EmptyValue() Values {
8787
// rateLimitConfig is the config required by RateLimitMgr. It can be derived
8888
// from the main rules Config struct.
8989
type rateLimitConfig interface {
90-
GetActionsDB() firewalldb.ActionsDB
90+
GetActionsDB() firewalldb.ActionsListDB
9191
GetMethodPerms() func(string) ([]bakery.Op, bool)
9292
}
9393

rules/rate_limit_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ type mockRateLimitCfg struct {
216216

217217
var _ rateLimitConfig = (*mockRateLimitCfg)(nil)
218218

219-
func (m *mockRateLimitCfg) GetActionsDB() firewalldb.ActionsDB {
219+
func (m *mockRateLimitCfg) GetActionsDB() firewalldb.ActionsListDB {
220220
return m.db
221221
}
222222

@@ -233,7 +233,7 @@ type mockActionsDB struct {
233233
actions []*firewalldb.RuleAction
234234
}
235235

236-
var _ firewalldb.ActionsDB = (*mockActionsDB)(nil)
236+
var _ firewalldb.ActionsListDB = (*mockActionsDB)(nil)
237237

238238
func (m *mockActionsDB) addAction(uri string, timestamp time.Time) {
239239
m.actions = append(m.actions, &firewalldb.RuleAction{

0 commit comments

Comments
 (0)