aboutsummaryrefslogtreecommitdiff
path: root/pkg/monitor/messages.go
blob: 717aae6f207270b42b069ee96bd7873457bb2633 (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
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
}