summaryrefslogtreecommitdiffstats
path: root/aclk/aclk-schemas/proto/chart/v1/stream.proto
blob: 9473538f25512e014b63f8a79f9d5a0c1e7342c8 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
syntax = "proto3";

package chart.v1;

import "google/protobuf/timestamp.proto";

import "proto/chart/v1/instance.proto";
import "proto/chart/v1/dimension.proto";

option go_package = "chart/stream/v1;chartstream";

// StreamChartsAndDimensions is a Command produced by the Cloud, consumed by the Agent.
//
// It instructs the Agent to start sending ChartsAndDimensionsUpdated messages for a NodeInstance
// after the last sequence_id that the Cloud has successfully ingested.
message StreamChartsAndDimensions {
  // claim_id, node_id pair is used to identify the Node Instance
  string claim_id = 1;
  string node_id = 2;

  // sequence_id last verified sequence sent by the Agent
  uint64 sequence_id = 3;
  // batch_id identifies the stream_id and gets incremented every time the Cloud sends a new StreamChartsAndDimensions command
  uint64 batch_id = 4;
  // seq_id_created_at autogenerated timestamp in Agent's DB upon sequence_id creation
  google.protobuf.Timestamp seq_id_created_at = 5;
}


// ChartsAndDimensionsAck is an Event produced by the Cloud, consumed by the Agent.
//
// This Event is an acknowledgment from the Cloud side that Chart messages up to a specific last_sequence_id
// have been successfully ingested, and could be potentially deleted from the Agent's DB.
message ChartsAndDimensionsAck {
  string claim_id = 1;
  string node_id = 2;
  // the last verified stored message's seq_id
  uint64 last_sequence_id = 3;
}

// ResetChartMessages is a Command produced by the Agent, consumed by the Cloud.
//
// This Command instructs the Cloud to clear its Chart state for a specific NodeInstance and re-sync
// because of a ResetReason.
message ResetChartMessages {
  // claim_id, node_id pair is used to identify the Node Instance
  string claim_id = 1;
  string node_id = 2;

  ResetReason reason = 3;
}

enum ResetReason {
  DB_EMPTY = 0;
  SEQ_ID_NOT_EXISTS = 1;
  TIMESTAMP_MISMATCH = 2;
}

// ChartsAndDimensionsUpdated is a wrapper Event (`fat` message) produced by the Agent, consumed by the Cloud.
//
// It potentially includes a collection of ChartInstanceUpdated messages and|or a collection of ChartDimensionUpdated messages.
message ChartsAndDimensionsUpdated {
  repeated chart.v1.ChartInstanceUpdated charts = 1;
  repeated chart.v1.ChartDimensionUpdated dimensions = 2;
  uint64 batch_id = 3;
}

// RetentionUpdated includes the available retentions (in seconds) of the dimensions - of a specific node instance and memory-mode -
// on a per update_every level.
// This message is sent over upon Agent Database rotation events to inform the Cloud in total about the newly updated data retentions
// of a node instance's dimensions.
message RetentionUpdated {
  // claim_id, node_id pair is used to identify the Node Instance
  string claim_id = 1;
  string node_id = 2;
  // the memory_mode used by the node instance's chart instances
  chart.v1.MemoryMode memory_mode = 3;
  // this mapping identifies the newly updated available retention (in seconds) of the node instance's dimensions
  // the keys are the update_every categories of various dimensions (1, 2, 4, 10 etc.),
  // and the values are the available retention (in seconds) of each dimension belonging to the update_every category
  // denoted by the key
  map<uint32, uint32> interval_durations = 4;
  // the timestamp when the db rotation event took place. Can be used in conjunction with the interval_durations
  // to compute the beginning of each `updated_every` group's retention
  google.protobuf.Timestamp rotation_timestamp = 5;
}