f-21: refactor: add dispatcher layer for MQTT migration
Introduce internal/dispatcher package with a Command interface and typed commands (CreateVPC, DeleteVPC, CreateSubnet, DeleteSubnet). The API handlers now call dispatcher.Dispatch() instead of enqueuing closures directly, decoupling transport (HTTP today, MQTT tomorrow) from execution. Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
40fa49d3a9
commit
064b90f5e4
9 changed files with 114 additions and 39 deletions
26
internal/dispatcher/subnet_commands.go
Normal file
26
internal/dispatcher/subnet_commands.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package dispatcher
|
||||
|
||||
import "github.com/dgraph-io/badger/v4"
|
||||
|
||||
type CreateSubnetCommand struct {
|
||||
Name string
|
||||
VPC string
|
||||
VxlanID int
|
||||
LocalIP string
|
||||
GatewayIP string
|
||||
CIDR string
|
||||
}
|
||||
|
||||
func (c CreateSubnetCommand) Execute(db *badger.DB) error {
|
||||
// TODO: brancher internal/subnet/create.go
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeleteSubnetCommand struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
func (c DeleteSubnetCommand) Execute(db *badger.DB) error {
|
||||
// TODO: brancher internal/subnet/delete.go
|
||||
return nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue