... | ... | @@ -131,36 +131,40 @@ type KeaModule struct { |
|
|
func newKeaModule(manager Manager) *KeaModule
|
|
|
Creates new instance of the Kea configuration module.
|
|
|
|
|
|
func (kea *KeaModule) ApplyEdit(ctx context.Context, cfg keaconfig.Map) error
|
|
|
func (kea *KeaModule) ApplyEdit(ctx context.Context, cfg keaconfig.Map) (context.Context, error)
|
|
|
Applies configuration changes after editing daemon's configuration file. The
|
|
|
changes are queued must be confirmed by calling the Commit() or Schedule().
|
|
|
|
|
|
func (kea *KeaModule) ApplySubnetUpdate(ctx context.Context, subnet *dbmodel.Subnet) error
|
|
|
func (kea *KeaModule) ApplySubnetUpdate(ctx context.Context, subnet *dbmodel.Subnet) (context.Context, error)
|
|
|
Applies modified subnet to multiple Kea servers.
|
|
|
|
|
|
func (kea *KeaModule) BeginEdit(ctx context.Context, daemonID int64) (cfg keaconfig.Map, err error)
|
|
|
func (kea *KeaModule) BeginEdit(ctx context.Context, daemonID int64) (context.Context, error)
|
|
|
Begins editing specified daemon's configuration file.
|
|
|
|
|
|
func (kea *KeaModule) BeginSubnetUpdate(ctx context.Context, subnet *dbmodel.Subnet) (*dbmodel.Subnet, error)
|
|
|
func (kea *KeaModule) BeginSubnetUpdate(ctx context.Context, subnet *dbmodel.Subnet) (context.Context, error)
|
|
|
Begins an update of the existing subnet on multiple Kea servers.
|
|
|
|
|
|
func (kea *KeaModule) Commit(ctx context.Context) error
|
|
|
Sends the changes queued in the context to one or multiple daemons right
|
|
|
away.
|
|
|
|
|
|
func (kea *KeaModule) SaveConfig(c dbmodel.KeaConfig, daemonID int64) error
|
|
|
Saves the specified configuration as a current revision.
|
|
|
|
|
|
func (kea *KeaModule) Schedule(ctx context.Context, deadline time.Time) error
|
|
|
Schedules sending the changes queued in the context to one or multiple
|
|
|
daemons.
|
|
|
func (kea *KeaModule) commitEdit(ctx context.Context) (context.Context, error)
|
|
|
Commits daemon's configuration file edits.
|
|
|
|
|
|
func (kea *KeaModule) commitSubnetUpdate(ctx context.Context) (context.Context, error)
|
|
|
Commits subnet update.
|
|
|
|
|
|
type Lock struct {
|
|
|
key LockKey
|
|
|
user string
|
|
|
}
|
|
|
Represents a configuration lock.
|
|
|
|
|
|
type LockKey int64
|
|
|
Represents a configuration lock key.
|
|
|
|
|
|
type Manager interface {
|
|
|
GetKeaModule() *KeaModule
|
|
|
Lock(context.Context, string, ...int64) error
|
|
|
Lock(context.Context, string, ...int64) (context.Context, error)
|
|
|
Unlock(context.Context, ...int64)
|
|
|
}
|
|
|
Common Configuration Manager Interface. It exposes functions for locking and
|
... | ... | @@ -170,28 +174,50 @@ type Manager interface { |
|
|
func NewManager() Manager
|
|
|
Creates new Configuration Manager instance.
|
|
|
|
|
|
type lock struct {
|
|
|
key LockKey
|
|
|
user string
|
|
|
type PendingUpdate struct {
|
|
|
Tool string
|
|
|
Operation string
|
|
|
DaemonIDs []int64
|
|
|
Applied bool
|
|
|
Algorithm interface{}
|
|
|
}
|
|
|
Represents a configuration lock.
|
|
|
A structure describing a single configuration update that may be applied to
|
|
|
multiple daemons. An example of such an update is a new update creation.
|
|
|
|
|
|
type TransactionState struct {
|
|
|
LockKey LockKey
|
|
|
PendingUpdates []PendingUpdate
|
|
|
}
|
|
|
A structure describing a configuration update transaction. It includes a
|
|
|
configuration lock key and a set of updates to be applied.
|
|
|
|
|
|
type managerImpl struct {
|
|
|
locks map[int64]lock
|
|
|
locks map[int64]Lock
|
|
|
key LockKey
|
|
|
kea *KeaModule
|
|
|
}
|
|
|
Configuration Manager implementation.
|
|
|
|
|
|
func (manager *managerImpl) Commit(ctx context.Context) (context.Context, error)
|
|
|
Sends the changes queued in the context to one or multiple daemons right
|
|
|
away.
|
|
|
|
|
|
func (manager *managerImpl) CommitDue() (err error)
|
|
|
Commit all updates in the database which are due.
|
|
|
|
|
|
func (manager *managerImpl) GetKeaModule() *KeaModule
|
|
|
Returns CM's Kea configuration module.
|
|
|
|
|
|
func (manager *managerImpl) Lock(ctx context.Context, user string, daemonIDs ...int64) error
|
|
|
func (manager *managerImpl) Lock(ctx context.Context, user string, daemonIDs ...int64) (context.Context, error)
|
|
|
Attempts to lock configurations of the specified daemons for update.
|
|
|
Internally it generates a new lock key and stores it in the context. If an
|
|
|
attempt to lock any of the configurations fails, it will remove already
|
|
|
acquired locks and return an error.
|
|
|
|
|
|
func (manager *managerImpl) Schedule(ctx context.Context, deadline time.Time) (context.Context, error)
|
|
|
Schedules sending the changes queued in the context to one or multiple
|
|
|
daemons.
|
|
|
|
|
|
func (manager *managerImpl) Unlock(ctx context.Context, daemonIDs ...int64)
|
|
|
Removes locks from the specified daemons' configurations if the key stored
|
|
|
in the context matches.
|
... | ... | |