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
- func (m *DbStateChangeRequestOp) FillVDLTarget(t vdl.Target, tt *vdl.Type) error
- func (m *DbStateChangeRequestOp) MakeVDLTarget() vdl.Target
- func (x DbStateChangeRequestOp) VDLIsZero() bool
- func (x *DbStateChangeRequestOp) VDLRead(dec vdl.Decoder) error
- func (x DbStateChangeRequestOp) VDLWrite(enc vdl.Encoder) error
- type DbStateChangeRequestOpTarget
- func (t *DbStateChangeRequestOpTarget) FinishField(_, _ vdl.Target) error
- func (t *DbStateChangeRequestOpTarget) FinishFields(_ vdl.FieldsTarget) error
- func (t *DbStateChangeRequestOpTarget) StartField(name string) (key, field vdl.Target, _ error)
- func (t *DbStateChangeRequestOpTarget) StartFields(tt *vdl.Type) (vdl.FieldsTarget, error)
- func (t *DbStateChangeRequestOpTarget) ZeroField(name string) error
- type StateChange
- func (m *StateChange) FillVDLTarget(t vdl.Target, tt *vdl.Type) error
- func (m *StateChange) MakeVDLTarget() vdl.Target
- func (x *StateChange) Set(label string) error
- func (x StateChange) String() string
- func (x StateChange) VDLIsZero() bool
- func (x *StateChange) VDLRead(dec vdl.Decoder) error
- func (x StateChange) VDLWrite(enc vdl.Encoder) error
- type StateChangeTarget
- type SyncSnapshotOp
- type SyncSnapshotOpTarget
- func (t *SyncSnapshotOpTarget) FinishField(_, _ vdl.Target) error
- func (t *SyncSnapshotOpTarget) FinishFields(_ vdl.FieldsTarget) error
- func (t *SyncSnapshotOpTarget) StartField(name string) (key, field vdl.Target, _ error)
- func (t *SyncSnapshotOpTarget) StartFields(tt *vdl.Type) (vdl.FieldsTarget, error)
- func (t *SyncSnapshotOpTarget) ZeroField(name string) error
- type SyncgroupOp
- type SyncgroupOpTarget
- func (t *SyncgroupOpTarget) FinishField(_, _ vdl.Target) error
- func (t *SyncgroupOpTarget) FinishFields(_ vdl.FieldsTarget) error
- func (t *SyncgroupOpTarget) StartField(name string) (key, field vdl.Target, _ error)
- func (t *SyncgroupOpTarget) StartFields(tt *vdl.Type) (vdl.FieldsTarget, error)
- func (t *SyncgroupOpTarget) ZeroField(name string) error
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) FillVDLTarget ¶
func (*DbStateChangeRequestOp) MakeVDLTarget ¶
func (m *DbStateChangeRequestOp) MakeVDLTarget() vdl.Target
func (DbStateChangeRequestOp) VDLIsZero ¶
func (x DbStateChangeRequestOp) VDLIsZero() bool
type DbStateChangeRequestOpTarget ¶
type DbStateChangeRequestOpTarget struct { Value *DbStateChangeRequestOp vdl.TargetBase vdl.FieldsTargetBase // contains filtered or unexported fields }
func (*DbStateChangeRequestOpTarget) FinishField ¶
func (t *DbStateChangeRequestOpTarget) FinishField(_, _ vdl.Target) error
func (*DbStateChangeRequestOpTarget) FinishFields ¶
func (t *DbStateChangeRequestOpTarget) FinishFields(_ vdl.FieldsTarget) error
func (*DbStateChangeRequestOpTarget) StartField ¶
func (t *DbStateChangeRequestOpTarget) StartField(name string) (key, field vdl.Target, _ error)
func (*DbStateChangeRequestOpTarget) StartFields ¶
func (t *DbStateChangeRequestOpTarget) StartFields(tt *vdl.Type) (vdl.FieldsTarget, error)
func (*DbStateChangeRequestOpTarget) ZeroField ¶
func (t *DbStateChangeRequestOpTarget) ZeroField(name string) error
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) FillVDLTarget ¶
func (*StateChange) MakeVDLTarget ¶
func (m *StateChange) MakeVDLTarget() vdl.Target
func (StateChange) String ¶
func (x StateChange) String() string
String returns the string label of x.
func (StateChange) VDLIsZero ¶
func (x StateChange) VDLIsZero() bool
type StateChangeTarget ¶
type StateChangeTarget struct { Value *StateChange vdl.TargetBase }
func (*StateChangeTarget) FromEnumLabel ¶
func (t *StateChangeTarget) FromEnumLabel(src string, tt *vdl.Type) error
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) FillVDLTarget ¶
func (*SyncSnapshotOp) MakeVDLTarget ¶
func (m *SyncSnapshotOp) MakeVDLTarget() vdl.Target
func (SyncSnapshotOp) VDLIsZero ¶
func (x SyncSnapshotOp) VDLIsZero() bool
type SyncSnapshotOpTarget ¶
type SyncSnapshotOpTarget struct { Value *SyncSnapshotOp vdl.TargetBase vdl.FieldsTargetBase // contains filtered or unexported fields }
func (*SyncSnapshotOpTarget) FinishField ¶
func (t *SyncSnapshotOpTarget) FinishField(_, _ vdl.Target) error
func (*SyncSnapshotOpTarget) FinishFields ¶
func (t *SyncSnapshotOpTarget) FinishFields(_ vdl.FieldsTarget) error
func (*SyncSnapshotOpTarget) StartField ¶
func (t *SyncSnapshotOpTarget) StartField(name string) (key, field vdl.Target, _ error)
func (*SyncSnapshotOpTarget) StartFields ¶
func (t *SyncSnapshotOpTarget) StartFields(tt *vdl.Type) (vdl.FieldsTarget, error)
func (*SyncSnapshotOpTarget) ZeroField ¶
func (t *SyncSnapshotOpTarget) ZeroField(name string) error
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) FillVDLTarget ¶
func (*SyncgroupOp) MakeVDLTarget ¶
func (m *SyncgroupOp) MakeVDLTarget() vdl.Target
func (SyncgroupOp) VDLIsZero ¶
func (x SyncgroupOp) VDLIsZero() bool
type SyncgroupOpTarget ¶
type SyncgroupOpTarget struct { Value *SyncgroupOp vdl.TargetBase vdl.FieldsTargetBase // contains filtered or unexported fields }
func (*SyncgroupOpTarget) FinishField ¶
func (t *SyncgroupOpTarget) FinishField(_, _ vdl.Target) error
func (*SyncgroupOpTarget) FinishFields ¶
func (t *SyncgroupOpTarget) FinishFields(_ vdl.FieldsTarget) error
func (*SyncgroupOpTarget) StartField ¶
func (t *SyncgroupOpTarget) StartField(name string) (key, field vdl.Target, _ error)
func (*SyncgroupOpTarget) StartFields ¶
func (t *SyncgroupOpTarget) StartFields(tt *vdl.Type) (vdl.FieldsTarget, error)
func (*SyncgroupOpTarget) ZeroField ¶
func (t *SyncgroupOpTarget) ZeroField(name string) error