From e4345c8ad6584f4fc5393c7844bb1967d6564d63 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 24 Mar 2025 21:54:13 -0500 Subject: moving to a cluster.proto config file --- cluster.go | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) delete mode 100644 cluster.go (limited to 'cluster.go') diff --git a/cluster.go b/cluster.go deleted file mode 100644 index 94f9ff2..0000000 --- a/cluster.go +++ /dev/null @@ -1,48 +0,0 @@ -package virtpb - -import ( - sync "sync" - - durationpb "google.golang.org/protobuf/types/known/durationpb" - "google.golang.org/protobuf/types/known/timestamppb" -) - -type Cluster struct { - sync.RWMutex - - Dirs []string - d *Droplets - H *Hypervisors - e *Events - Unstable *timestamppb.Timestamp - UnstableTimeout *durationpb.Duration -} - -func (c *Cluster) GetDropletsPB() *Droplets { - return c.d -} - -func (c *Cluster) GetHypervisorsPB() *Hypervisors { - return c.H -} - -func (c *Cluster) GetEventsPB() *Events { - return c.e -} - -// adds a new droplet. enforce unique hostnames -func (c *Cluster) AddDroplet(newd *Droplet) bool { - c.Lock() - defer c.Unlock() - - for _, d := range c.d.Droplets { - if newd.Hostname == d.Hostname { - // boo. that one is already here - return false - } - } - - // everything is ok, this hostname is new - c.d.Droplets = append(c.d.Droplets, newd) - return true -} -- cgit v1.2.3