att

package
v0.0.0-...-4f4d58c Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSummaryDoesntExist = errors.New("summary doesn't exist")

ErrSummaryDoesntExist is the error returned when trying to read a summary for a given key that doesn't exist

Functions

This section is empty.

Types

type AttributionMethod

type AttributionMethod interface {
	// EmptySummary returns an empty summary for the given method type
	EmptySummary(ctx context.Context) Summary

	// ReadSummary reads a summary for a commit hash
	ReadSummary(ctx context.Context, key string) (Summary, error)

	// CollectShards gathers all the shards that need to be processed
	CollectShards(ctx context.Context, commit, prevCommit *doltdb.Commit, summary Summary) ([]ShardInfo, error)

	// ProcessShard processes a single shard
	ProcessShard(ctx context.Context, commitIdx int16, cm, prevCm *doltdb.Commit, shardInfo ShardInfo) (ShardResult, error)

	// ProcessResults takes all the results from processing all the shards and returns a summary
	ProcessResults(ctx context.Context, commitHash hash.Hash, prevSummary Summary, results []ShardResult) (Summary, error)

	// WriteSummary persists a summary
	WriteSummary(ctx context.Context, summary Summary) (string, error)

	// SerializeShardInfo takes a ShardInfo object and serializes it
	SerializeShardInfo(ctx context.Context, info ShardInfo) ([]byte, error)

	// DeserializeShardInfo takes a []byte and deserializes it to a ShardInfo object
	DeserializeShardInfo(ctx context.Context, data []byte) (ShardInfo, error)

	// SerializeResults takes a ShardResult object and serializes it
	SerializeResults(ctx context.Context, results ShardResult) ([]byte, error)

	// DeserializeResults takes a []bite and deserializes it ta a ShardResult
	DeserializeResults(ctx context.Context, data []byte) (ShardResult, error)
}

AttributionMethod is an interface for attributing changes to commits

type FilesysShardStore

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

FilesysShardStore is a ShardStore implementation that reads from and writes to the local file system

func NewFilesysShardStore

func NewFilesysShardStore(rootDir string) (*FilesysShardStore, error)

NewFilesysShardStore returns a new FilesysShardStore object

func (*FilesysShardStore) Join

func (f *FilesysShardStore) Join(keyElements ...string) string

Join joins key elements into a single key with delimiters that are appropriate for the backing storage. In this case it uses the filesys appropriate file separator.

func (*FilesysShardStore) ReadShard

func (f *FilesysShardStore) ReadShard(ctx context.Context, key string) (*MemShard, error)

ReadShard reads shard data

func (*FilesysShardStore) WriteShard

func (f *FilesysShardStore) WriteShard(ctx context.Context, key string, store *valuefile.FileValueStore, shardVal types.Value) error

WriteShard presists shard data stored in noms.valuefile format

type MemShard

type MemShard struct {
	Value types.Value
	Vrw   types.ValueReadWriter
	Ns    tree.NodeStore
}

MemShard is the in memory representation of a shard and its |Value|.

type ShardInfo

type ShardInfo interface {
	Key(*types.NomsBinFormat) string
}

ShardInfo is an interface which contains data necessary for processing a single shard of data

type ShardResult

type ShardResult interface{}

ShardResult is an interface which contains the result of processing a shard of data

type ShardStore

type ShardStore interface {
	// WriteShard presists shard data stored in noms.valuefile format
	WriteShard(ctx context.Context, key string, store *valuefile.FileValueStore, shardVal types.Value) error
	// ReadShard reads shard data
	ReadShard(ctx context.Context, key string) (*MemShard, error)
	// Join joins key elements into a single key with delimiters that are appropriate for the backing storage
	Join(keyElements ...string) string
}

ShardStore is an interface for storing and retrieving shard data

type Summary

type Summary interface {
	// CommitToCount returns a map from commit hashes to the changes attributed to the commit
	CommitToCount(ctx context.Context) (map[hash.Hash]uint64, error)
}

Summary is an interface which provides access to the attribution results

Jump to

Keyboard shortcuts

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