Documentation ¶
Overview ¶
Package distributor contains a DB-backed object that persists witnessed checkpoints of verifiable logs and allows them to be queried to allow efficient lookup by-witness, and by number of signatures.
Index ¶
- type Distributor
- func (d *Distributor) Distribute(ctx context.Context, logID, witID string, nextRaw []byte) error
- func (d *Distributor) GetCheckpointN(ctx context.Context, logID string, n uint32) ([]byte, error)
- func (d *Distributor) GetCheckpointWitness(ctx context.Context, logID, witID string) ([]byte, error)
- func (d *Distributor) GetLogs(ctx context.Context) ([]string, error)
- func (d *Distributor) GetWitnesses(ctx context.Context) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Distributor ¶
type Distributor struct {
// contains filtered or unexported fields
}
Distributor persists witnessed checkpoints and allows querying of them.
func NewDistributor ¶
func NewDistributor(ws map[string]note.Verifier, ls map[string]config.LogInfo, db *sql.DB) (*Distributor, error)
NewDistributor returns a distributor that will accept checkpoints from the given witnesses, for the given logs, and persist its state in the database provided. Callers must call Init() on the returned distributor. `ws` is a map from witness raw verifier string to the note verifier. `ls` is a map from log ID (github.com/transparency-dev/formats/log.ID) to log info.
func (*Distributor) Distribute ¶
Distribute adds a new witnessed checkpoint to be distributed. This checkpoint must be signed by both the log and the witness specified, and be larger than any previous checkpoint distributed for this pair.
func (*Distributor) GetCheckpointN ¶
GetCheckpointN gets the largest checkpoint for a given log that has at least `n` signatures.
func (*Distributor) GetCheckpointWitness ¶
func (d *Distributor) GetCheckpointWitness(ctx context.Context, logID, witID string) ([]byte, error)
GetCheckpointWitness gets the largest checkpoint for the log that was witnessed by the given witness.
func (*Distributor) GetLogs ¶
func (d *Distributor) GetLogs(ctx context.Context) ([]string, error)
GetLogs returns a list of all log IDs the distributor is aware of, sorted by the ID.
func (*Distributor) GetWitnesses ¶ added in v0.1.1
func (d *Distributor) GetWitnesses(ctx context.Context) ([]string, error)
GetLogs returns a list of all witness verifier keys that the distributor is aware of, sorted by the key.