Skip to content

Commit ddd984c

Browse files
firewalldb: export FirewallDBs interface
In the upcoming migration of the firewall database to SQL, the helper functions that creates the test databases of different types, need to return a unified interface in order to not have to control the migration tests file by build tags. Therefore, we export the unified interface FirewallDBs, so that it can be returned public test DB creation functions
1 parent f88ba56 commit ddd984c

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

firewalldb/db.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,21 @@ var (
1414
ErrNoSuchKeyFound = fmt.Errorf("no such key found")
1515
)
1616

17-
// firewallDBs is an interface that groups the RulesDB and PrivacyMapper
18-
// interfaces.
19-
type firewallDBs interface {
20-
RulesDB
21-
PrivacyMapper
22-
ActionDB
23-
}
24-
2517
// DB manages the firewall rules database.
2618
type DB struct {
2719
started sync.Once
2820
stopped sync.Once
2921

30-
firewallDBs
22+
FirewallDBs
3123

3224
cancel fn.Option[context.CancelFunc]
3325
}
3426

3527
// NewDB creates a new firewall database. For now, it only contains the
3628
// underlying rules' and privacy mapper databases.
37-
func NewDB(dbs firewallDBs) *DB {
29+
func NewDB(dbs FirewallDBs) *DB {
3830
return &DB{
39-
firewallDBs: dbs,
31+
FirewallDBs: dbs,
4032
}
4133
}
4234

firewalldb/interface.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,11 @@ type ActionDB interface {
134134
// and feature name.
135135
GetActionsReadDB(groupID session.ID, featureName string) ActionsReadDB
136136
}
137+
138+
// FirewallDBs is an interface that groups the RulesDB, PrivacyMapper and
139+
// ActionDB interfaces.
140+
type FirewallDBs interface {
141+
RulesDB
142+
PrivacyMapper
143+
ActionDB
144+
}

0 commit comments

Comments
 (0)