Documentation
¶
Index ¶
- Variables
- func ApplyMigrations(oplog *OpLog) error
- type OpLog
- func (o *OpLog) Add(ops ...*v1.Operation) error
- func (o *OpLog) Delete(opID ...int64) error
- func (o *OpLog) FindOne(q Query) (*v1.Operation, error)
- func (o *OpLog) FindOneMetadata(q Query) (OpMetadata, error)
- func (o *OpLog) Get(opID int64) (*v1.Operation, error)
- func (o *OpLog) GetHighestOpIDAndModno(q Query) (int64, int64, 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(opts SetOptions, ops ...*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) SetModnoGte(modnoGte int64) 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) SetOriginalInstanceKeyid(instanceKeyid string) 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 SetOptions
- 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") ErrNoResults = errors.New("no results found") NullOPID = int64(0) )
View Source
var CurrentVersion = int64(len(migrations))
View Source
var SelectAll = Query{}
Functions ¶
func ApplyMigrations ¶ added in v1.0.0
Types ¶
type OpLog ¶
type OpLog struct {
// contains filtered or unexported fields
}
func (*OpLog) FindOneMetadata ¶ added in v1.11.0
func (o *OpLog) FindOneMetadata(q Query) (OpMetadata, error)
func (*OpLog) GetHighestOpIDAndModno ¶ added in v1.11.0
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
func (o *OpLog) Set(opts SetOptions, ops ...*v1.Operation) error
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
type OpMetadata struct {
ID int64
FlowID int64
Modno int64
OriginalID int64
OriginalFlowID int64
Status v1.OperationStatus
RepoID string
RepoGUID string
PlanID string
}
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)
// GetHighestOpIDAndModno returns the highest operation ID and modno in the store, used for synchronization.
GetHighestOpIDAndModno(q Query) (int64, int64, 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
// Set inserts or updates operations. Zero-valued fields (Id, Modno, FlowId) are
// allocated automatically (like Add/Update), but non-zero values provided by the
// caller are preserved. If Id is non-zero, it updates; if Id is zero, it inserts.
Set(opts SetOptions, 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
DeprecatedRepoID *string // Deprecated: use RepoGUID instead
SnapshotID *string
FlowID *int64
InstanceID *string
OriginalInstanceKeyid *string
OriginalID *int64
OriginalFlowID *int64
ModnoGte *int64
// Pagination
Limit int
Offset int
Reversed bool
// contains filtered or unexported fields
}
func (Query) SetInstanceID ¶ added in v1.7.0
func (Query) SetModnoGte ¶ added in v1.11.0
func (Query) SetOriginalFlowID ¶ added in v1.7.0
func (Query) SetOriginalID ¶ added in v1.7.0
func (Query) SetOriginalInstanceKeyid ¶ added in v1.9.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 SetOptions ¶ added in v1.13.0
type SetOptions struct {
InsertOnly bool // If true, only insert; fail if the operation already exists (Id != 0).
UpdateOnly bool // If true, only update; fail if the operation does not exist (Id == 0).
AllocateID bool // If true, allocate a new Id for operations with Id == 0.
}
SetOptions configures the behavior of Set.
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.