watchable

package
v0.0.0-...-ff5f600 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2016 License: BSD-3-Clause Imports: 6 Imported by: 0

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

Constants

This section is empty.

Variables

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

func AddSyncSnapshotOp(ctx *context.T, tx *watchable.Transaction, key, version []byte) error

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 (m *DbStateChangeRequestOp) FillVDLTarget(t vdl.Target, tt *vdl.Type) error

func (*DbStateChangeRequestOp) MakeVDLTarget

func (m *DbStateChangeRequestOp) MakeVDLTarget() vdl.Target

func (DbStateChangeRequestOp) VDLIsZero

func (x DbStateChangeRequestOp) VDLIsZero() bool

func (*DbStateChangeRequestOp) VDLRead

func (x *DbStateChangeRequestOp) VDLRead(dec vdl.Decoder) error

func (DbStateChangeRequestOp) VDLWrite

func (x DbStateChangeRequestOp) VDLWrite(enc vdl.Encoder) error

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 (*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 (m *StateChange) FillVDLTarget(t vdl.Target, tt *vdl.Type) error

func (*StateChange) MakeVDLTarget

func (m *StateChange) MakeVDLTarget() vdl.Target

func (*StateChange) Set

func (x *StateChange) Set(label string) error

Set assigns label to x.

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) VDLRead

func (x *StateChange) VDLRead(dec vdl.Decoder) error

func (StateChange) VDLWrite

func (x StateChange) VDLWrite(enc vdl.Encoder) error

type StateChangeTarget

type StateChangeTarget struct {
	Value *StateChange
	vdl.TargetBase
}

func (*StateChangeTarget) FromEnumLabel

func (t *StateChangeTarget) FromEnumLabel(src string, tt *vdl.Type) error

type SyncSnapshotOp

type SyncSnapshotOp struct {
	Key     []byte
	Version []byte
}

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 (m *SyncSnapshotOp) FillVDLTarget(t vdl.Target, tt *vdl.Type) error

func (*SyncSnapshotOp) MakeVDLTarget

func (m *SyncSnapshotOp) MakeVDLTarget() vdl.Target

func (SyncSnapshotOp) VDLIsZero

func (x SyncSnapshotOp) VDLIsZero() bool

func (*SyncSnapshotOp) VDLRead

func (x *SyncSnapshotOp) VDLRead(dec vdl.Decoder) error

func (SyncSnapshotOp) VDLWrite

func (x SyncSnapshotOp) VDLWrite(enc vdl.Encoder) error

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 (m *SyncgroupOp) FillVDLTarget(t vdl.Target, tt *vdl.Type) error

func (*SyncgroupOp) MakeVDLTarget

func (m *SyncgroupOp) MakeVDLTarget() vdl.Target

func (SyncgroupOp) VDLIsZero

func (x SyncgroupOp) VDLIsZero() bool

func (*SyncgroupOp) VDLRead

func (x *SyncgroupOp) VDLRead(dec vdl.Decoder) error

func (SyncgroupOp) VDLWrite

func (x SyncgroupOp) VDLWrite(enc vdl.Encoder) error

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL