core

package
v0.0.0-...-d52c0f3 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2018 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package core provides transport-agnostic implementation of Migrillian tool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfigFromFile

func LoadConfigFromFile(filename string) (*configpb.MigrationConfig, error)

LoadConfigFromFile reads MigrationConfig from the given filename, which should contain text-protobuf encoded configuration data.

func ValidateConfig

func ValidateConfig(cfg *configpb.MigrationConfig) error

ValidateConfig verifies that the config is sane.

Types

type Controller

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

Controller coordinates migration from a CT log to a Trillian tree.

TODO(pavelkalinnikov): - Coordinate multiple trees. - Schedule a distributed fetch to increase throughput. - Store CT STHs in Trillian or make this tool stateful on its own. - Make fetching stateful to reduce master resigning aftermath.

func NewController

func NewController(opts Options, ctClient *client.LogClient,
	plClient *PreorderedLogClient, ef election.Factory,
) *Controller

NewController creates a Controller configured by the passed in options, CT and Trillian clients, and a master election factory.

func (*Controller) Run

func (c *Controller) Run(ctx context.Context) error

Run transfers CT log entries obtained via the CT log client to a Trillian pre-ordered log via Trillian client. If Options.Continuous is true then the migration process runs continuously trying to keep up with the target CT log. Returns if an error occurs, the context is canceled, or all the entries have been transferred (in non-Continuous mode).

func (*Controller) RunWhenMaster

func (c *Controller) RunWhenMaster(ctx context.Context) error

RunWhenMaster is a master-elected version of Run method. It executes Run whenever this instance captures mastership of the tree ID. As soon as the instance stops being the master, Run is canceled. The method returns if a severe error occurs, the passed in context is canceled, or fetching is completed (in non-Continuous mode). Releases mastership when terminates.

type Options

type Options struct {
	scanner.FetcherOptions
	Submitters          int
	BatchesPerSubmitter int
}

Options holds configuration for a Controller.

type PreorderedLogClient

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

PreorderedLogClient is a means of communicating with a single Trillian pre-ordered log tree.

func NewPreorderedLogClient

func NewPreorderedLogClient(
	cli trillian.TrillianLogClient, tree *trillian.Tree, prefix string,
) (*PreorderedLogClient, error)

NewPreorderedLogClient creates and initializes a pre-ordered log client.

Jump to

Keyboard shortcuts

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