assertstate

package
v0.0.0-...-677ed08 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2016 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package assertstate implements the manager and state aspects responsible for the enforcement of assertions in the system and manages the system-wide assertion database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(s *state.State, a asserts.Assertion) error

Add the given assertion to the system assertion database.

func DB

DB returns a read-only view of system assertion database.

func RefreshSnapDeclarations

func RefreshSnapDeclarations(s *state.State, userID int) error

RefreshSnapDeclarations refetches all the current snap declarations and their prerequisites.

func ReplaceDB

func ReplaceDB(state *state.State, db *asserts.Database)

ReplaceDB replaces the assertion database used by the manager.

func ValidateRefreshes

func ValidateRefreshes(s *state.State, snapInfos []*snap.Info, userID int) (validated []*snap.Info, err error)

ValidateRefreshes validates the refresh candidate revisions represented by the snapInfos, looking for the needed refresh control validation assertions, it returns a validated subset in validated and a summary error if not all candidates validated.

Types

type AssertManager

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

AssertManager is responsible for the enforcement of assertions in system states. It manipulates the observed system state to ensure nothing in it violates existing assertions, or misses required ones.

func Manager

func Manager(s *state.State) (*AssertManager, error)

Manager returns a new assertion manager.

func (*AssertManager) Ensure

func (m *AssertManager) Ensure() error

Ensure implements StateManager.Ensure.

func (*AssertManager) Stop

func (m *AssertManager) Stop()

Stop implements StateManager.Stop.

func (*AssertManager) Wait

func (m *AssertManager) Wait()

Wait implements StateManager.Wait.

type Batch

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

Batch allows to accumulate a set of assertions possibly out of prerequisite order and then add them in one go to the system assertion database.

func NewBatch

func NewBatch() *Batch

NewBatch creates a new Batch to accumulate assertions to add in one go to the system assertion database.

func (*Batch) Add

func (b *Batch) Add(a asserts.Assertion) error

Add one assertion to the batch.

func (*Batch) AddStream

func (b *Batch) AddStream(r io.Reader) ([]*asserts.Ref, error)

AddStream adds a stream of assertions to the batch. Returns references to to the assertions effectively added.

func (*Batch) Commit

func (b *Batch) Commit(st *state.State) error

Commit adds the batch of assertions to the system assertion database.

Jump to

Keyboard shortcuts

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