aboutsummaryrefslogtreecommitdiff
path: root/pkg/monitor/messages.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus@rgdd.se>2023-12-09 17:08:45 +0100
committerRasmus Dahlberg <rasmus@rgdd.se>2023-12-10 20:38:21 +0100
commit895d5fea41177e444c18f4fdc820fffa5f67d5bf (patch)
tree42fd1e9507384abcd9c6e82f18ccca813f8b6296 /pkg/monitor/messages.go
parentf124940f75e1f49100fe5381019d2f65d6915304 (diff)
Add drafty skeleton
Diffstat (limited to 'pkg/monitor/messages.go')
-rw-r--r--pkg/monitor/messages.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/pkg/monitor/messages.go b/pkg/monitor/messages.go
new file mode 100644
index 0000000..717aae6
--- /dev/null
+++ b/pkg/monitor/messages.go
@@ -0,0 +1,40 @@
+package monitor
+
+import (
+ ct "github.com/google/certificate-transparency-go"
+ "gitlab.torproject.org/rgdd/ct/pkg/metadata"
+)
+
+// MessageLogConfig provides information about a log the monitor is downloading
+type MessageLogConfig struct {
+ Metadata metadata.Log
+ State MonitorState
+}
+
+// MessageLogProgress is the next log state and any encountered leaves that were
+// considered matching since the previous log state. Parse errors are included.
+type MessageLogProgress struct {
+ State MonitorState
+ Matches []LogEntry
+ Errors []error
+}
+
+// MonitorState describes the monitor's state for a particular log. The signed tree
+// head is the latest verified append-only state that was observed. The index
+// is the next leaf which will be downloaded and processed by the monitor.
+type MonitorState struct {
+ LogState
+ NextIndex uint64
+}
+
+// LogState describes the state of a log
+type LogState struct {
+ ct.SignedTreeHead
+}
+
+// LogEntry is a leaf in a log's Merkle tree
+type LogEntry struct {
+ LeafIndex uint64
+ LeafData []byte
+ ExtraData []byte
+}