signer

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: Apache-2.0 Imports: 8 Imported by: 6

Documentation

Overview

Package signer is a sample implementation of a commit-log based signer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeDatabase

type FakeDatabase struct {
	// contains filtered or unexported fields
}

FakeDatabase simulates a local database

func (*FakeDatabase) AddLeaves

func (f *FakeDatabase) AddLeaves(when int64, offset int, leaves []string) STH

AddLeaves simulates adding leaves to the local database. It returns the STH in the database.

func (*FakeDatabase) Size

func (f *FakeDatabase) Size() int

Size returns the tree size of the local database

type STH

type STH struct {
	TreeSize  int   `json:"sz"`
	TimeStamp int64 `json:"tm"`
	// Store the offset that the STH is supposed to appear at.  Entries where this
	// does not match the actual offset should be ignored.
	Offset int `json:"off"`
}

STH is a signed tree head.

func (*STH) String

func (s *STH) String() string

type STHInfo

type STHInfo struct {
	// contains filtered or unexported fields
}

STHInfo holds information about an STH stored in the STH topic.

type Signer

type Signer struct {
	Name string
	// contains filtered or unexported fields
}

Signer is a simulated signer instance.

func New

func New(name string, election *simelection.Election, epoch int64) *Signer

New creates a simulated signer that uses the provided election.

func (*Signer) IsMaster

func (s *Signer) IsMaster() bool

IsMaster indicates if this signer is master.

func (*Signer) LatestSTHInfo

func (s *Signer) LatestSTHInfo() STHInfo

LatestSTHInfo returns the most recent STHInfo known about by the signer

func (*Signer) Run

func (s *Signer) Run()

Run performs a single signing run.

func (*Signer) StoreSTHInfo

func (s *Signer) StoreSTHInfo(info STHInfo)

StoreSTHInfo updates the STHInfo known about by the signer.

func (*Signer) String

func (s *Signer) String() string

Jump to

Keyboard shortcuts

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