Documentation
¶
Index ¶
- Variables
- func ApplyMigrations(oplog *OpLog) error
- func NewRandomModno(lastModno int64) int64
- type OpLog
- func (o *OpLog) Add(ops ...*v1.Operation) error
- func (o *OpLog) Delete(opID ...int64) error
- func (o *OpLog) Get(opID int64) (*v1.Operation, error)
- func (o *OpLog) Query(q Query, f func(*v1.Operation) error) error
- func (o *OpLog) QueryMetadata(q Query, f func(OpMetadata) error) error
- func (o *OpLog) Set(op *v1.Operation) error
- func (o *OpLog) Subscribe(q Query, f *Subscription)
- func (o *OpLog) Transform(q Query, f func(*v1.Operation) (*v1.Operation, error)) error
- func (o *OpLog) Unsubscribe(f *Subscription) error
- func (o *OpLog) Update(ops ...*v1.Operation) error
- type OpMetadata
- type OpStore
- type OperationEvent
- type Query
- func (q *Query) Match(op *v1.Operation) bool
- func (q Query) SetFlowID(flowID int64) Query
- func (q Query) SetInstanceID(instanceID string) Query
- func (q Query) SetLimit(limit int) Query
- func (q Query) SetOffset(offset int) Query
- func (q Query) SetOpIDs(opIDs []int64) Query
- func (q Query) SetOriginalFlowID(originalFlowID int64) Query
- func (q Query) SetOriginalID(originalID int64) Query
- func (q Query) SetPlanID(planID string) Query
- func (q Query) SetRepoGUID(repoGUID string) Query
- func (q Query) SetReversed(reversed bool) Query
- func (q Query) SetSnapshotID(snapshotID string) Query
- type Subscription
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrStopIteration = errors.New("stop iteration") ErrNotExist = errors.New("operation does not exist") ErrExist = errors.New("operation already exists") NullOPID = int64(0) )
View Source
var CurrentVersion = int64(len(migrations))
View Source
var SelectAll = Query{}
Functions ¶
func ApplyMigrations ¶ added in v1.0.0
func NewRandomModno ¶ added in v1.7.0
Types ¶
type OpLog ¶
type OpLog struct {
// contains filtered or unexported fields
}
func (*OpLog) QueryMetadata ¶ added in v1.7.0
func (o *OpLog) QueryMetadata(q Query, f func(OpMetadata) error) error
func (*OpLog) Set ¶ added in v1.7.0
Set is an alias for Update that does not increment the modno, provided for use by the syncapi.
func (*OpLog) Subscribe ¶
func (o *OpLog) Subscribe(q Query, f *Subscription)
func (*OpLog) Unsubscribe ¶
func (o *OpLog) Unsubscribe(f *Subscription) error
type OpMetadata ¶ added in v1.7.0
OpMetadata is a struct that contains metadata about an operation without fetching the operation itself.
type OpStore ¶ added in v1.5.0
type OpStore interface {
// Query returns all operations that match the query.
Query(q Query, f func(*v1.Operation) error) error
// QueryMetadata is like Query, but only returns metadata about the operations.
// this is useful for very high performance scans that don't deserialize the operation itself.
QueryMetadata(q Query, f func(OpMetadata) error) error
// Get returns the operation with the given ID.
Get(opID int64) (*v1.Operation, error)
// Add adds the given operations to the store.
Add(op ...*v1.Operation) error
// Update updates the given operations in the store.
Update(op ...*v1.Operation) error
// Delete removes the operations with the given IDs from the store, and returns the removed operations.
Delete(opID ...int64) ([]*v1.Operation, error)
// Transform applies the given function to each operation that matches the query.
Transform(q Query, f func(*v1.Operation) (*v1.Operation, error)) error
// Version returns the current data version
Version() (int64, error)
// SetVersion sets the data version
SetVersion(version int64) error
}
type OperationEvent ¶ added in v1.5.0
type OperationEvent int
const ( OPERATION_ADDED OperationEvent = iota OPERATION_UPDATED OPERATION_DELETED )
type Query ¶ added in v1.0.0
type Query struct {
// Filter by fields
OpIDs []int64
PlanID *string
RepoGUID *string
SnapshotID *string
FlowID *int64
InstanceID *string
OriginalID *int64
OriginalFlowID *int64
// Pagination
Limit int
Offset int
Reversed bool
// contains filtered or unexported fields
}
func (Query) SetInstanceID ¶ added in v1.7.0
func (Query) SetOriginalFlowID ¶ added in v1.7.0
func (Query) SetOriginalID ¶ added in v1.7.0
func (Query) SetRepoGUID ¶ added in v1.7.0
func (Query) SetReversed ¶ added in v1.7.0
func (Query) SetSnapshotID ¶ added in v1.7.0
type Subscription ¶ added in v1.5.0
type Subscription = func(ops []*v1.Operation, event OperationEvent)
Click to show internal directories.
Click to hide internal directories.