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:
GnomeZworc 2026-04-19 00:06:50 +02:00
commit 064b90f5e4
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
9 changed files with 114 additions and 39 deletions

View 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
}