Skip to content

Commit

Permalink
Add machine manager proxy for test purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
kthomas committed Feb 6, 2024
1 parent a7ca4f1 commit 2cb918a
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions internal/node/nodeproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"log/slog"

"github.com/nats-io/nats-server/v2/server"
"github.com/nats-io/nats.go"
)

// Use this proxy object with extreme care, as it exposes
Expand Down Expand Up @@ -38,6 +39,43 @@ func (n *NodeProxy) InternalNATS() *server.Server {
return n.n.natsint
}

func (n *NodeProxy) InternalNATSConn() *nats.Conn {
return n.n.ncint
}

func (n *NodeProxy) Telemetry() *Telemetry {
return n.n.telemetry
}

type MachineManagerProxy struct {
m *MachineManager
}

func NewMachineManagerProxyWith(manager *MachineManager) *MachineManagerProxy {
return &MachineManagerProxy{m: manager}
}

func (m *MachineManagerProxy) Log() *slog.Logger {
return m.m.log
}

func (m *MachineManagerProxy) NodeConfiguration() *NodeConfiguration {
return m.m.config
}

func (m *MachineManagerProxy) InternalNATSConn() *nats.Conn {
return m.m.ncInternal
}

func (m *MachineManagerProxy) Telemetry() *Telemetry {
return m.m.t
}

func (m *MachineManagerProxy) VMs() map[string]*runningFirecracker {
return m.m.allVms
}

func (m *MachineManagerProxy) PoolVMs() chan *runningFirecracker {
return m.m.warmVms
}

0 comments on commit 2cb918a

Please sign in to comment.