Documentation
¶
Overview ¶
Package watchable contains helper functions for the Syncbase-specific operations. The equivalent for the Syncbase-agnostic operations sit in the store/watchable package.
Index ¶
- Variables
- func AddDbStateChangeRequestOp(ctx *context.T, tx *watchable.Transaction, stateChangeType StateChange) error
- func AddSyncSnapshotOp(ctx *context.T, tx *watchable.Transaction, key, version []byte) error
- func AddSyncgroupOp(ctx *context.T, tx *watchable.Transaction, gid interfaces.GroupId, ...) error
- type DbStateChangeRequestOp
- type StateChange
- type SyncSnapshotOp
- type SyncgroupOp
Constants ¶
This section is empty.
Variables ¶
var StateChangeAll = [...]StateChange{StateChangePauseSync, StateChangeResumeSync}
StateChangeAll holds all labels for StateChange.
Functions ¶
func AddDbStateChangeRequestOp ¶
func AddDbStateChangeRequestOp(ctx *context.T, tx *watchable.Transaction, stateChangeType StateChange) error
AddDbStateChangeRequestOp injects a database state change request in the log entries that the transaction writes when it is committed. The sync watcher receives the request at the proper position in the timeline (the transaction commit) and makes appropriate updates to the db state causing the request to take effect. Note: This is an internal function used by server.database.
func AddSyncSnapshotOp ¶
AddSyncSnapshotOp injects a sync snapshot operation notification in the log entries that the transaction writes when it is committed. It allows the syncgroup create or join operations to notify the sync watcher of the current keys and their versions to use when initializing the sync metadata at the point in the timeline when these keys become syncable (at commit). Note: this is an internal function used by sync, not part of the interface.
func AddSyncgroupOp ¶
func AddSyncgroupOp(ctx *context.T, tx *watchable.Transaction, gid interfaces.GroupId, prefixes []string, remove bool) error
AddSyncgroupOp injects a syncgroup operation notification in the log entries that the transaction writes when it is committed. It allows the syncgroup operations (create, join, leave, destroy) to notify the sync watcher of the change at its proper position in the timeline (the transaction commit). Note: this is an internal function used by sync, not part of the interface.
Types ¶
type DbStateChangeRequestOp ¶
type DbStateChangeRequestOp struct {
RequestType StateChange
}
DbStateChangeRequestOp represents a database state change request. Specifically there are two events that create this op: PauseSync, indicating a client request to pause sync on this db. ResumeSync, indicating a client request to resume sync on this db. Client watcher will ignore this op.
func (DbStateChangeRequestOp) VDLIsZero ¶
func (x DbStateChangeRequestOp) VDLIsZero() bool
func (*DbStateChangeRequestOp) VDLRead ¶
func (x *DbStateChangeRequestOp) VDLRead(dec vdl.Decoder) error
func (DbStateChangeRequestOp) VDLReflect ¶
func (DbStateChangeRequestOp) VDLReflect(struct { Name string `vdl:"v.io/x/ref/services/syncbase/watchable.DbStateChangeRequestOp"` })
type StateChange ¶
type StateChange int
StateChange represents the set of types of state change requests possible.
const ( StateChangePauseSync StateChange = iota StateChangeResumeSync )
func StateChangeFromString ¶
func StateChangeFromString(label string) (x StateChange, err error)
StateChangeFromString creates a StateChange from a string label.
func (StateChange) String ¶
func (x StateChange) String() string
String returns the string label of x.
func (StateChange) VDLIsZero ¶
func (x StateChange) VDLIsZero() bool
func (StateChange) VDLReflect ¶
func (StateChange) VDLReflect(struct { Name string `vdl:"v.io/x/ref/services/syncbase/watchable.StateChange"` Enum struct{ PauseSync, ResumeSync string } })
type SyncSnapshotOp ¶
SyncSnapshotOp represents a snapshot operation when creating and joining a syncgroup. The sync watcher needs to get a snapshot of the Database at the point of creating/joining a syncgroup. A SyncSnapshotOp entry is written to the log for each Database key that falls within the syncgroup prefixes. This allows sync to initialize its metadata at the correct versions of the objects when they become syncable. These log entries should be filtered by the client-facing Watch interface because the user data did not actually change.
func (SyncSnapshotOp) VDLIsZero ¶
func (x SyncSnapshotOp) VDLIsZero() bool
func (SyncSnapshotOp) VDLReflect ¶
func (SyncSnapshotOp) VDLReflect(struct { Name string `vdl:"v.io/x/ref/services/syncbase/watchable.SyncSnapshotOp"` })
type SyncgroupOp ¶
type SyncgroupOp struct { SgId interfaces.GroupId Prefixes []string Remove bool }
SyncgroupOp represents a change in the set of prefixes that should be tracked by sync, i.e. the union of prefix sets across all syncgroups. Note that an individual syncgroup's prefixes cannot be changed; this record type is used to track changes due to syncgroup create/join/leave/destroy.
func (SyncgroupOp) VDLIsZero ¶
func (x SyncgroupOp) VDLIsZero() bool
func (SyncgroupOp) VDLReflect ¶
func (SyncgroupOp) VDLReflect(struct { Name string `vdl:"v.io/x/ref/services/syncbase/watchable.SyncgroupOp"` })