aboutsummaryrefslogtreecommitdiff
path: root/pkg/state/state_manager.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus@mullvad.net>2022-01-25 01:04:09 +0100
committerRasmus Dahlberg <rasmus@mullvad.net>2022-01-26 00:33:44 +0100
commit72c2f39216d8d8e9bce589271b38c76d16ee2a36 (patch)
tree7bd93182471e9aa2fd06d695cb5dfda4efd42c1f /pkg/state/state_manager.go
parent1594b0830d8cd18ab158dfffb64dd3c219da8f10 (diff)
state: Refactor with new tree head endpoints
For details see doc/proposals/2022-01-no-quick-tree-head-endpoint.
Diffstat (limited to 'pkg/state/state_manager.go')
-rw-r--r--pkg/state/state_manager.go21
1 files changed, 17 insertions, 4 deletions
diff --git a/pkg/state/state_manager.go b/pkg/state/state_manager.go
index 5aa7609..ab0293c 100644
--- a/pkg/state/state_manager.go
+++ b/pkg/state/state_manager.go
@@ -6,11 +6,24 @@ import (
"git.sigsum.org/sigsum-lib-go/pkg/types"
)
-// StateManager coordinates access to a log's tree heads and (co)signatures
+// StateManager coordinates access to a log's tree heads and (co)signatures.
type StateManager interface {
- Latest(context.Context) (*types.SignedTreeHead, error)
- ToSign(context.Context) (*types.SignedTreeHead, error)
- Cosigned(context.Context) (*types.CosignedTreeHead, error)
+ // ToCosignTreeHead returns the log's to-cosign tree head
+ ToCosignTreeHead(context.Context) (*types.SignedTreeHead, error)
+
+ // CosignedTreeHead returns the log's cosigned tree head
+ CosignedTreeHead(context.Context) (*types.CosignedTreeHead, error)
+
+ // AddCosignature verifies that a cosignature is valid for the to-cosign
+ // tree head before adding it
AddCosignature(context.Context, *types.PublicKey, *types.Signature) error
+
+ // Run peridically rotates the log's to-cosign and cosigned tree heads
Run(context.Context)
}
+
+// event is a verified cosignature request
+type event struct {
+ keyHash *types.Hash
+ cosignature *types.Signature
+}