verify

package
v0.0.0-...-01ee8fb Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Verify

func Verify(
	ctx context.Context,
	readFiles bool,
	rootScores []blob.Score,
	allScores []blob.Score,
	knownStructure map[Node][]Node,
	records chan<- Record,
	blobStore blob.Store) (err error)

Read all blobs necessary for verifying the directory structure rooted at a set of backup root scores, ensuring that the entire directory structure is intact in GCS.

Optionally, all file content is also read and verified. This is less important than verifying directory connectedness if we trust that GCS does not corrupt object metadata (where we store expected CRC32C and MD5) and does correctly report the object's CRC32C and MD5 sums in listings, verifying them periodically.

If work is to be preserved across runs, knownStructure should be filled in with parenthood information from previously-generated records (for both files and directories). Nodes that exist as keys in this map will not be re-verified, except to confirm that their content still exists in allScores.

It is expected that the blob store's Load method does score verification for us.

Types

type Node

type Node struct {
	Score blob.Score

	// If true, this node represents a directory listing that has zero or more
	// children. Otherwise, this is a file or a symlink.
	Dir bool
}

A node in the DAG of blobs in the supplied bucket.

func (*Node) String

func (n *Node) String() (s string)

Format the node as a standardized name that is guaranteed to be stable across invocations of the process.

type Record

type Record struct {
	Time time.Time

	// The node that was verified.
	//
	// For directory nodes, the record certifies that at Time we verified that a
	// piece of content with the given score was parseable as a directory listing
	// that referred to the given scores for its direct children.
	//
	// For file nodes, the record certifies that at Time we verified that a piece
	// of content with the given score was parseable as a piece of a file or
	// symlink. File nodes never have children.
	Node Node

	// Child nodes, present only for directories. See notes on Node above.
	Children []Node
}

A record certifying that a node was verified at a particular time.

func ParseRecord

func ParseRecord(s string) (r Record, err error)

Parse the output of Record.String.

func (*Record) String

func (r *Record) String() (s string)

Format the record in a manner that can later be parsed with ParseRecord. Guaranteed to not contain newlines.

Jump to

Keyboard shortcuts

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