converge/pkg/models/state.go
2024-09-08 11:16:49 +02:00

19 lines
441 B
Go

package models
// State is a description of the current state of converge.
// Created by the server and used for updating the web client
// and prometheus metrics.
type State struct {
Agents []Agent
Clients []Client
}
func (state *State) Copy() *State {
c := State{}
c.Agents = make([]Agent, len(state.Agents))
c.Clients = make([]Client, len(state.Clients))
copy(c.Agents, state.Agents)
copy(c.Clients, state.Clients)
return &c
}