summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--droplet.proto13
-rw-r--r--events.proto7
-rw-r--r--helpers.go7
-rw-r--r--sampleData.go24
4 files changed, 32 insertions, 19 deletions
diff --git a/droplet.proto b/droplet.proto
index 60af988..c3b7bd1 100644
--- a/droplet.proto
+++ b/droplet.proto
@@ -23,13 +23,10 @@ message Droplet {
int64 spice_port = 11; // preferred port to use for spice
repeated Network networks = 12; // really just mac addresses. should be unique across cluster
- repeated Disk disks = 13; // disks to attach
+ repeated Disk disks = 13; // disks to attach
- DropletState state = 14; // if the droplet is on, off, etc
-
- // trying to figure out how this stuff should work
- google.protobuf.Any testany = 15;
- StorageInfo humantest = 16;
+ DropletState state = 14; // if the droplet is on, off, etc
+ string image_url = 15; // url to the image
}
enum DropletState {
@@ -48,7 +45,3 @@ message Disk {
string filename = 1;
int64 size = 2;
}
-
-message StorageInfo {
- int64 capacity = 1; // Stores the storage capacity in bytes.
-}
diff --git a/events.proto b/events.proto
index 69e6d46..0cb3fea 100644
--- a/events.proto
+++ b/events.proto
@@ -9,6 +9,9 @@ message Events {
string version = 2; // maybe can be used for protobuf schema change violations
int64 event_size = 3; // max events to store in a single
repeated Event events = 4; // all the events
+
+ // is it possible to have custom formatting in JSON and TEXT marshal/unmarshal ?
+ StorageInfo humantest = 5;
}
@@ -40,3 +43,7 @@ enum EventType {
CRASH = 11; // droplet hard crashed
CHANGE = 12; // droplet or hypervisor config change
}
+
+message StorageInfo {
+ int64 capacity = 1; // Stores the storage capacity in bytes.
+}
diff --git a/helpers.go b/helpers.go
index eb54261..e9864ae 100644
--- a/helpers.go
+++ b/helpers.go
@@ -107,13 +107,6 @@ func (c *Cluster) AddDroplet(uuid string, hostname string, cpus int, mem int) *D
d.Cpus = 1
}
d.Memory = SetGB(mem * 32)
- if d.Humantest == nil {
- var newInfo StorageInfo
- newInfo = StorageInfo{Capacity: 64}
- d.Humantest = &newInfo
- } else {
- d.Humantest.Capacity = SetGB(mem * 32)
- }
c.Droplets = append(c.Droplets, d)
return d
}
diff --git a/sampleData.go b/sampleData.go
index c87fcd0..d0388aa 100644
--- a/sampleData.go
+++ b/sampleData.go
@@ -40,6 +40,28 @@ func CreateSampleHypervisor(hostname string, mem int) *Hypervisor {
return h
}
+func CreateSampleEvents(total int) *Events {
+ var e *Events
+ e = new(Events)
+
+ // info := StorageInfo{Capacity: 64}
+ // e.Humantest = &info
+ if e.Humantest == nil {
+ var newInfo StorageInfo
+ newInfo = StorageInfo{Capacity: 64}
+ e.Humantest = &newInfo
+ } else {
+ e.Humantest.Capacity = SetGB(total * 32)
+ }
+
+ for i := 0; i < total; i++ {
+ var newe *Event
+ newe = new(Event)
+ e.Events = append(e.Events, newe)
+ }
+ return e
+}
+
func CreateSampleCluster(total int) *Cluster {
var c *Cluster
c = new(Cluster)
@@ -53,8 +75,6 @@ func CreateSampleCluster(total int) *Cluster {
d.Cpus = 16
d.Memory = SetGB(256)
}
- info := StorageInfo{Capacity: 64}
- d.Humantest = &info
c.Droplets = append(c.Droplets, d)
}