summaryrefslogtreecommitdiff
path: root/event.proto
blob: 1c9d2a5b43f023ae98c4fae8784cb6528d27624c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
syntax = "proto3";
package virtpb;

import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp
import "google/protobuf/any.proto"; // Import the well-known type for Timestamp
import "droplet.proto";

// global settings for autogenpb `autogenpb:no-sort` `autogenpb:mutex`

message Events {                                             // `autogenpb:marshal` `autogenpb:gui`
        string                      uuid               = 1;  // `autogenpb:uuid:1e3a50c7-5916-4423-b33c-f0b977a7e446`
        string                      version            = 2;  // `autogenpb:version:v0.0.1`
        repeated Event              events             = 3;  // all the events
        string                      filename           = 4;  // `autogenpb:save` -- this enables autogenerated pb.Load() and pb.Save()
        int64                       eventSize          = 5;  // max events to store in a single
}

// this information leans towards being human readable not programatic
// in other words, it's better to just have the droplet name here rather than the uuid
// at least for now in the early days. but maybe forever.
// homelab clouds normally don't have many events.
// we are talking less than 1 a minute. even 1 an hour is often a lot
message Event {                                              // `autogenpb:marshal`
        enum status {
                DONE    = 0;
                FAIL    = 1;
                RUNNING = 2;
        }
        int32                       id                 = 1;  // `autogenpb:unique` // should be unique across the cluster
        EventType                   etype              = 2;
        string                      dropletName        = 3;  // name of the droplet
        string                      dropletUuid        = 4;  // uuid of the droplet
        string                      hypervisor         = 5;  // name of the hypervisor
        string                      hypervisorUuid     = 6;  // uuid of the hypervisor
        google.protobuf.Timestamp   start              = 7;  // start time
        google.protobuf.Timestamp   end                = 8;  // end time
        string                      fieldName          = 9;  // the field name that changed
        string                      origVal            = 10; // original value
        string                      newVal             = 11; // new value
        google.protobuf.Any         origAny            = 12; // anypb format. probably overkill
        google.protobuf.Any         newAny             = 13; // anypb format
        string                      error              = 14; // what went wrong
        status                      state              = 15; // state of the event
        Droplet                     droplet            = 16; // droplet
}
enum EventType {
        ADD	= 0;
        DELETE = 1;
        POWERON = 2;
        POWEROFF = 3;   // should indicate a "normal" shutdown
        HIBERNATE = 4;
        MIGRATE = 5;
        DEMO	= 6;
        GET	= 7;	// request something
        LOGIN	= 8;	// attempt to login
        OK	= 9;	// everything is ok
        FAIL	= 10;	// everything failed
        CRASH   = 11;   // droplet hard crashed
        CHANGE  = 12;   // droplet or hypervisor config change
        EDIT    = 13;   // edit droplet settings
}