Documentation
¶
Index ¶
Constants ¶
View Source
const ( // EmptyInstanceID represents an empty InstanceID EmptyInstanceID = InstanceID("") )
Variables ¶
This section is empty.
Functions ¶
func IsValidInstanceID ¶
Types ¶
type Action ¶
type Action struct {
// Type of the action
Type ActionType
// InstanceID of the instance in action
InstanceID InstanceID
// CollectionName of the instance in action
CollectionName string
// Previous is the instance before the action
Previous interface{}
// Current is the instance after the action was done
Current interface{}
}
Action is a operation done in the collection
type ActionType ¶
type ActionType int
ActionType is the type used by actions done in a txn
const ( // Create indicates the creation of an instance in a txn Create ActionType = iota // Save indicates the mutation of an instance in a txn Save // Delete indicates the deletion of an instance by ID in a txn Delete )
type Event ¶
type Event interface {
Time() []byte
InstanceID() InstanceID
Collection() string
}
Event is a local or remote event generated in collection and dispatcher by Dispatcher.
type EventCodec ¶
type EventCodec interface {
// Reduce applies generated events into state
Reduce(
events []Event,
datastore ds.TxnDatastore,
baseKey ds.Key,
indexFunc func(collection string, key ds.Key, oldData, newData []byte, txn ds.Txn) error,
) ([]ReduceAction, error)
// Create corresponding events to be dispatched
Create(ops []Action) ([]Event, format.Node, error)
// EventsFromBytes deserializes a format.Node bytes payload into
// Events.
EventsFromBytes(data []byte) ([]Event, error)
}
EventCodec transforms actions generated in collections to events dispatched to thread logs, and viceversa.
type InstanceID ¶
type InstanceID string
InstanceID is the type used in instance identities
func NewInstanceID ¶
func NewInstanceID() InstanceID
NewInstanceID generates a new identity for an instance
func (InstanceID) String ¶
func (e InstanceID) String() string
type ReduceAction ¶
type ReduceAction struct {
// Type of the reduced action
Type ActionType
// Collection in which action was made
Collection string
// InstanceID of the instance in reduced action
InstanceID InstanceID
}
Click to show internal directories.
Click to hide internal directories.