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 is 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("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("missing authorized key(s)") // ErrInvalidSig occurs when either the current or previous update entry // signature verification fails. ErrInvalidSig = errors.New("invalid signature") )
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 {
// CheckMutation verifies that this is a valid mutation for this item.
CheckMutation(value, mutation []byte) error
// Mutate applies mutation to value
Mutate(value, mutation []byte) ([]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. |
|
Package replace implements a simple replacement strategy as a mapper.
|
Package replace implements a simple replacement strategy as a mapper. |
Click to show internal directories.
Click to hide internal directories.