state

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: 10 Imported by: 0

Documentation

Overview

Package state contains code for saving state between comeback runs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveState

func SaveState(w io.Writer, state State) (err error)

Types

type ScoreMap

type ScoreMap interface {
	// Set a list of scores for a particular key.
	Set(key ScoreMapKey, scores []blob.Score)

	// Get the list of scores previously set for a key, or nil if no list has
	// been set.
	Get(key ScoreMapKey) (scores []blob.Score)
}

A map from stat info for a file to a set of scores that represented that file's contents at the time the stat info was collected. (This of course is not atomic, so it's more like "around the time that the stat info was collected".)

All methods are safe for concurrent calling.

func NewScoreMap

func NewScoreMap() ScoreMap

Create an empty map.

type ScoreMapKey

type ScoreMapKey struct {
	Path        string
	Permissions os.FileMode
	Uid         sys.UserId
	Gid         sys.GroupId
	MTime       time.Time
	Inode       uint64
	Size        uint64
}

Contains fields used by git for a similar purpose according to racy-git.txt.

type State

type State struct {
	// The set of scores that are known to already exist in the blob store, in
	// hex form. It is unnecessary to again store any blob whose score is in this
	// set.
	ExistingScores util.StringSet

	// The time at which ExistingScores was last updated from the authoritative
	// source.
	RelistTime time.Time

	// A map from file system info to the scores that were seen for a given file
	// last time. These scores may have been written to the blob store, but not
	// flushed.
	ScoresForFiles ScoreMap
}

State that should be saved between runs of the program.

func LoadState

func LoadState(r io.Reader) (state State, err error)

Jump to

Keyboard shortcuts

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