Documentation ¶
Overview ¶
Package entry implements a simple replacement strategy as a mapper.
Index ¶
- func FromLeafValue(value []byte) (*pb.SignedEntry, error)
- func IsValidEntry(signedEntry *pb.SignedEntry) error
- func MapLogItemFn(m *mutator.LogMessage, emit func(index []byte, mutation *pb.EntryUpdate), ...)
- func MutateFn(oldSignedEntry, newSignedEntry *pb.SignedEntry) (*pb.SignedEntry, error)
- func ReduceFn(leaves []*pb.EntryUpdate, msgs []*pb.EntryUpdate, emit func(*pb.EntryUpdate), ...)
- func ToLeafValue(update *pb.SignedEntry) ([]byte, error)
- type IndexedValue
- type Mutation
- func (m *Mutation) EqualsPrevious(leafValue *pb.SignedEntry) bool
- func (m *Mutation) EqualsRequested(leafValue *pb.SignedEntry) bool
- func (m *Mutation) MinApplyRevision() int64
- func (m *Mutation) ReplaceAuthorizedKeys(handle *keyset.Handle) error
- func (m *Mutation) SerializeAndSign(signers []tink.Signer) (*pb.EntryUpdate, error)
- func (m *Mutation) SetCommitment(data []byte) error
- func (m *Mutation) SetPrevious(oldValueRevision uint64, oldValue []byte, copyPrevious bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromLeafValue ¶
func FromLeafValue(value []byte) (*pb.SignedEntry, error)
FromLeafValue takes a trillian.MapLeaf.LeafValue and returns and instantiated Entry or nil if the passes LeafValue was nil.
func IsValidEntry ¶
func IsValidEntry(signedEntry *pb.SignedEntry) error
IsValidEntry checks the internal consistency and correctness of a mutation.
func MapLogItemFn ¶
func MapLogItemFn(m *mutator.LogMessage, emit func(index []byte, mutation *pb.EntryUpdate), emitErr func(error))
MapLogItemFn maps elements from *mutator.LogMessage to KV<index, *pb.EntryUpdate>.
func MutateFn ¶
func MutateFn(oldSignedEntry, newSignedEntry *pb.SignedEntry) (*pb.SignedEntry, error)
MutateFn verifies that newSignedEntry is a valid mutation for oldSignedEntry and returns the application of newSignedEntry to oldSignedEntry.
func ReduceFn ¶
func ReduceFn(leaves []*pb.EntryUpdate, msgs []*pb.EntryUpdate, emit func(*pb.EntryUpdate), emitErr func(error))
ReduceFn decides which of multiple updates can be applied in this revision.
func ToLeafValue ¶
func ToLeafValue(update *pb.SignedEntry) ([]byte, error)
ToLeafValue converts the update object into a serialized object to store in the map.
Types ¶
type IndexedValue ¶
type IndexedValue struct { Index []byte Value *pb.EntryUpdate }
IndexedValue is a KV<Index, Value> type.
type Mutation ¶
type Mutation struct { UserID string // contains filtered or unexported fields }
Mutation provides APIs for manipulating entries.
func NewMutation ¶
NewMutation creates a mutation object from a previous value which can be modified. To create a new value: - Create a new mutation for a user starting with the previous value with NewMutation. - Change the value with SetCommitment and ReplaceAuthorizedKeys. - Finalize the changes and create the mutation with SerializeAndSign.
func (*Mutation) EqualsPrevious ¶
func (m *Mutation) EqualsPrevious(leafValue *pb.SignedEntry) bool
EqualsPrevious returns true if the leafValue is equal to the value of entry at the time this mutation was made.
func (*Mutation) EqualsRequested ¶
func (m *Mutation) EqualsRequested(leafValue *pb.SignedEntry) bool
EqualsRequested verifies that an update was successfully applied. Returns nil if newLeaf is equal to the entry in this mutation.
func (*Mutation) MinApplyRevision ¶
MinApplyRevision returns the minimum revision that a client can reasonably expect this mutation to be applied in. Clients should wait until a current map revision > MinApplyRevision before attempting to verify that a mutation has succeeded.
func (*Mutation) ReplaceAuthorizedKeys ¶
ReplaceAuthorizedKeys sets authorized keys to pubkeys. pubkeys must contain at least one key.
func (*Mutation) SerializeAndSign ¶
SerializeAndSign produces the mutation.
func (*Mutation) SetCommitment ¶
SetCommitment updates entry to be a commitment to data.
func (*Mutation) SetPrevious ¶
SetPrevious adds a check-set constraint on the mutation which is useful when performing a get-modify-set operation.
If Previous is set, the server will verify that the *current* value matches the Previous hash in this mutation. If the hash is missmatched, the server will not apply the mutation. If Previous is unset, the server will not perform this check.
If copyPrevious is true, AuthorizedKeys and Commitment are also copied. oldValueRevision is the map revision that oldValue was fetched at.