File: api.go

package info (click to toggle)
sigsum-go 0.14.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,076 kB
  • sloc: sh: 809; makefile: 93
file content (34 lines) | stat: -rw-r--r-- 1,238 bytes parent folder | download | duplicates (6)
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
// The api package defines the abstract api between sigsum servers.
package api

import (
	"context"

	"sigsum.org/sigsum-go/pkg/checkpoint"
	"sigsum.org/sigsum-go/pkg/requests"
	"sigsum.org/sigsum-go/pkg/submit-token"
	"sigsum.org/sigsum-go/pkg/types"
)

// Interface for Sigsum's log api, corresponding to the end points of
// the HTTP wire protocol. Implementations of this interface are
// expected to support requests for trivial inclusion and consistency
// proofs, even though such requests are not allowed on the wire.
type Log interface {
	GetTreeHead(context.Context) (types.CosignedTreeHead, error)
	GetInclusionProof(context.Context, requests.InclusionProof) (types.InclusionProof, error)
	GetConsistencyProof(context.Context, requests.ConsistencyProof) (types.ConsistencyProof, error)
	GetLeaves(context.Context, requests.Leaves) ([]types.Leaf, error)

	AddLeaf(context.Context, requests.Leaf, *token.SubmitHeader) (bool, error)
}

// Interface for witness api.
type Witness interface {
	AddCheckpoint(context.Context, requests.AddCheckpoint) ([]checkpoint.CosignatureLine, error)
}

// Interface for the secondary node's api.
type Secondary interface {
	GetSecondaryTreeHead(context.Context) (types.SignedTreeHead, error)
}