virtbuf

package module
v0.2.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2024 License: GPL-3.0 Imports: 22 Imported by: 8

README

these are .proto files. first stab. may be inaccurate writes out config files as protojson and prototext todo: lots of stuff

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigWriteJSON

func ConfigWriteJSON(a any, filename string) error

func ConfigWriteTEXT

func ConfigWriteTEXT(a any, filename string) error

func FormatDuration added in v0.2.1

func FormatDuration(d time.Duration) string

func HumanFormatBytes

func HumanFormatBytes(b int64) string

This isn't for the marketing department so this isn't going to use 'MiB' and 'GiB'

func SetGB

func SetGB(gb int) int64

can the json protobuf output use a string and have a type handler to convert it back to int64?

func SetMB

func SetMB(mb int) int64

Types

type Cluster added in v0.2.5

type Cluster struct {
	sync.RWMutex

	Dirs []string

	H *Hypervisors

	Unstable        *timestamppb.Timestamp
	UnstableTimeout *durationpb.Duration
	// contains filtered or unexported fields
}

func CreateSampleCluster added in v0.2.1

func CreateSampleCluster(total int) *Cluster

func InitCluster added in v0.2.1

func InitCluster() *Cluster

func (*Cluster) AddDroplet added in v0.2.5

func (c *Cluster) AddDroplet(newd *Droplet) bool

adds a new droplet. enforce unique hostnames

func (*Cluster) AddDropletLocal added in v0.2.5

func (c *Cluster) AddDropletLocal(name string, hypername string) *Droplet

This isn't for the marketing department

func (*Cluster) AddDropletSimple added in v0.2.5

func (c *Cluster) AddDropletSimple(uuid string, hostname string, cpus int, mem int) *Droplet

func (*Cluster) AddEvent added in v0.2.5

func (c *Cluster) AddEvent(e *Event)

func (*Cluster) AddHypervisor added in v0.2.5

func (c *Cluster) AddHypervisor(hostname string, cpus int, mem int) *Hypervisor

func (*Cluster) BlankFields added in v0.2.5

func (c *Cluster) BlankFields()

func (*Cluster) ChangeDropletState added in v0.2.5

func (c *Cluster) ChangeDropletState(d *Droplet, newState DropletState) error

records an event that the droplet changed state (aka turned on, turned off, etc)

func (*Cluster) ClusterStable added in v0.2.5

func (c *Cluster) ClusterStable() (bool, string)

func (*Cluster) ConfigLoad added in v0.2.5

func (c *Cluster) ConfigLoad() error

func (*Cluster) ConfigSave added in v0.2.5

func (c *Cluster) ConfigSave() error

writes out the cluster information it seperate files to make it humanly possible to hand edit things as needed

func (*Cluster) DropletMoved added in v0.2.5

func (c *Cluster) DropletMoved(d *Droplet, newh *Hypervisor) error

records an event that the droplet migrated to another hypervisor

func (*Cluster) DropletReady added in v0.2.5

func (c *Cluster) DropletReady(d *Droplet) (bool, string)

check the cluster and droplet to make sure it's ready to start

func (*Cluster) DropletsAll added in v0.2.5

func (c *Cluster) DropletsAll() *DropletIterator

func (*Cluster) DumpDroplet added in v0.2.5

func (c *Cluster) DumpDroplet(w http.ResponseWriter, r *http.Request) (string, error)

func (*Cluster) FindDropletByName added in v0.2.5

func (c *Cluster) FindDropletByName(name string) *Droplet

func (*Cluster) FindHypervisorByName added in v0.2.5

func (c *Cluster) FindHypervisorByName(name string) *Hypervisor

func (*Cluster) GetDropletIterator added in v0.2.5

func (c *Cluster) GetDropletIterator() *DropletIterator

Use Scan() in a loop, similar to a while loop

for iterator.Scan() {
	d := iterator.Droplet()
	fmt.Println("Droplet UUID:", d.Uuid)
}

func (*Cluster) SelectDropletAll added in v0.2.5

func (c *Cluster) SelectDropletAll() []*Droplet

SelectDropletPointers safely returns a slice of pointers to Droplet records.

func (*Cluster) SelectDropletPointers added in v0.2.5

func (c *Cluster) SelectDropletPointers() []*Droplet

SelectDropletPointers safely returns a slice of pointers to Droplet records.

type DropletIterator added in v0.2.1

type DropletIterator struct {
	// contains filtered or unexported fields
}

func NewDropletIterator added in v0.2.1

func NewDropletIterator(droplets []*Droplet) *DropletIterator

NewDropletIterator initializes a new iterator.

func (*DropletIterator) Droplet added in v0.2.1

func (it *DropletIterator) Droplet() *Droplet

Droplet returns the current droplet.

func (*DropletIterator) Scan added in v0.2.1

func (it *DropletIterator) Scan() bool

Scan moves to the next element and returns false if there are no more droplets.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL