distributor

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

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

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

func (d *Distributor) Distribute(ctx context.Context, logID, witID string, nextRaw []byte) error

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

func (d *Distributor) GetCheckpointN(ctx context.Context, logID string, n uint32) ([]byte, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL