mutator

package
v0.0.0-...-1e3cd99 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package mutator defines the operations to transform mutations into changes in the map as well as operations to write and read mutations to and from the database.

Index

Constants

This section is empty.

Variables

View Source
var (
	// MaxMutationSize represent the maximum allowed mutation size in bytes.
	MaxMutationSize = 16 * 1024
	// ErrReplay occurs when two mutations acting on the same entry & epoch
	// occur.
	ErrReplay = errors.New("mutation replay")
	// ErrSize occurs when the mutation size is larger than the allowed upper
	// bound.
	ErrSize = errors.New("mutation: too large")
	// ErrPreviousHash occurs when the mutation the hash of the previous
	// entry provided in the mutation does not match the previous entry
	// itself.
	ErrPreviousHash = errors.New("mutation: previous entry hash does not match the hash provided in the mutation")
	// ErrMissingKey occurs when a mutation does not have authorized keys.
	ErrMissingKey = errors.New("mutation: missing authorized key(s)")
	// ErrInvalidSig occurs when either the current or previous update entry
	// signature verification fails.
	ErrInvalidSig = errors.New("mutation: invalid signature")
	// ErrUnauthorized occurs when the mutation has not been signed by a key in the
	// previous entry.
	ErrUnauthorized = errors.New("mutation: unauthorized")
)

Functions

This section is empty.

Types

type Mutation

type Mutation interface {
	// ReadRange reads all mutations for a specific given mapID and sequence
	// range. The range is identified by a starting sequence number and a
	// count. Note that startSequence is not included in the result.
	// ReadRange stops when endSequence or count is reached, whichever comes
	// first. ReadRange also returns the maximum sequence number read.
	ReadRange(txn transaction.Txn, startSequence, endSequence uint64, count int32) (uint64, []*tpb.SignedKV, error)
	// ReadAll reads all mutations starting from the given sequence number.
	// Note that startSequence is not included in the result. ReadAll also
	// returns the maximum sequence number read.
	ReadAll(txn transaction.Txn, startSequence uint64) (uint64, []*tpb.SignedKV, error)
	// Write saves the mutation in the database. Write returns the sequence
	// number that is written.
	Write(txn transaction.Txn, mutation *tpb.SignedKV) (uint64, error)
}

Mutation reads and writes mutations to the database. TODO: Add mapID to this interface to support multiple maps per server.

type Mutator

type Mutator interface {
	// Mutate verifies that this is a valid mutation for this item and
	// applies mutation to value.
	Mutate(value, mutation proto.Message) ([]byte, error)
}

Mutator verifies mutations and transforms values in the map.

Directories

Path Synopsis
Package entry implements a simple replacement strategy as a mapper.
Package entry implements a simple replacement strategy as a mapper.

Jump to

Keyboard shortcuts

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