Documentation
¶
Index ¶
- type StateManager
- type StateManagerSingle
- func (sm *StateManagerSingle) AddCosignature(ctx context.Context, pub *types.PublicKey, sig *types.Signature) error
- func (sm *StateManagerSingle) CosignedTreeHead(_ context.Context) (*types.CosignedTreeHead, error)
- func (sm *StateManagerSingle) Run(ctx context.Context)
- func (sm *StateManagerSingle) ToCosignTreeHead() *types.SignedTreeHead
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StateManager ¶
type StateManager interface { // ToCosignTreeHead returns the node's to-cosign tree head ToCosignTreeHead() *types.SignedTreeHead // CosignedTreeHead returns the node'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 node's to-cosign and cosigned tree heads Run(context.Context) }
StateManager coordinates access to a nodes tree heads and (co)signatures.
type StateManagerSingle ¶
type StateManagerSingle struct { // Lock-protected access to pointers. A write lock is only obtained once // per interval when doing pointer rotation. All endpoints are readers. sync.RWMutex // contains filtered or unexported fields }
StateManagerSingle implements a single-instance StateManagerPrimary for primary nodes
func NewStateManagerSingle ¶
func NewStateManagerSingle(dbcli db.Client, signer crypto.Signer, interval, deadline time.Duration, secondary client.Client, sthFile *os.File) (*StateManagerSingle, error)
NewStateManagerSingle() sets up a new state manager, in particular its signedTreeHead. An optional secondary node can be used to ensure that a newer primary tree is not signed unless it has been replicated.
func (*StateManagerSingle) AddCosignature ¶
func (*StateManagerSingle) CosignedTreeHead ¶
func (sm *StateManagerSingle) CosignedTreeHead(_ context.Context) (*types.CosignedTreeHead, error)
func (*StateManagerSingle) Run ¶
func (sm *StateManagerSingle) Run(ctx context.Context)
func (*StateManagerSingle) ToCosignTreeHead ¶
func (sm *StateManagerSingle) ToCosignTreeHead() *types.SignedTreeHead
Click to show internal directories.
Click to hide internal directories.