@@ -11,11 +11,12 @@ import (
1111 dbmodel "isc.org/stork/server/database/model"
1212)
1313
14- // Uniquely identifies a cb_cmds config-backend target. Two daemons that share
15- // the same config database will have the same configBackendKey and therefore
16- // receive only one remote-subnet*-set command with multiple
17- // server tags, instead of one command per daemon.
18- type configBackendKey struct {
14+ // Uniquely identifies a configuration target (the Config Backend database or
15+ // daemon configuration). Two daemons that share the same CB database will
16+ // have the same configTargetKey and therefore receive only one
17+ // remote-subnet*-set command with multiple server tags, instead of one command
18+ // per daemon.
19+ type configTargetKey struct {
1920 // These fields should be filled for daemons using cb_cmds hook. Otherwise,
2021 // they must be left empty.
2122 DBName string
@@ -26,20 +27,20 @@ type configBackendKey struct {
2627 DaemonID int64
2728}
2829
29- // Constructs a configBackendKey for a local subnet's cb_cmds daemon.
30+ // Constructs a configTargetKey for a local subnet's cb_cmds daemon.
3031// The daemon's config databases list must not be empty.
31- func buildConfigBackendKey (daemon * dbmodel.Daemon ) (configBackendKey , error ) {
32+ func buildConfigTargetKey (daemon * dbmodel.Daemon ) (configTargetKey , error ) {
3233 config := daemon .KeaDaemon .Config
3334
3435 dbs := config .GetAllDatabases ().Config
3536 if len (dbs ) == 0 {
36- return configBackendKey {}, errors .Errorf (
37+ return configTargetKey {}, errors .Errorf (
3738 "daemon [%d] has libdhcp_cb_cmds loaded but no config databases configured" ,
3839 daemon .ID ,
3940 )
4041 }
4142 db := dbs [0 ]
42- return configBackendKey {
43+ return configTargetKey {
4344 DBName : db .Name ,
4445 DBHost : db .Host ,
4546 DBPort : db .Port ,
@@ -66,18 +67,18 @@ func forEachUniqueConfigSource(
6667 localSubnets []* dbmodel.LocalSubnet ,
6768 fn func (localSubnets []* dbmodel.LocalSubnet ) error ,
6869) error {
69- localSubnetsByBackend := map [configBackendKey ][]* dbmodel.LocalSubnet {}
70+ localSubnetsByBackend := map [configTargetKey ][]* dbmodel.LocalSubnet {}
7071
7172 for _ , ls := range localSubnets {
7273 hook := ls .Daemon .KeaDaemon .Config .GetHookLibraries ().GetSubnetAndSharedNetworkAlteringHookLibrary ()
7374 switch hook {
7475 case keaconfig .SubnetAndSharedNetworkAlteringHookLibrarySubnetCmds :
75- // For non-cb_cmds daemons, the config source is the daemon config,
76+ // For non-cb_cmds daemons, the config target is the daemon config,
7677 // they are not grouped.
77- key := configBackendKey {DaemonID : ls .DaemonID }
78+ key := configTargetKey {DaemonID : ls .DaemonID }
7879 localSubnetsByBackend [key ] = []* dbmodel.LocalSubnet {ls }
7980 case keaconfig .SubnetAndSharedNetworkAlteringHookLibraryCBCmds :
80- key , err := buildConfigBackendKey (ls .Daemon )
81+ key , err := buildConfigTargetKey (ls .Daemon )
8182 if err != nil {
8283 log .WithError (err ).Warnf (
8384 "Skipping local subnet [%d] " +
0 commit comments