blob: c61e06152cb5724235bbb80dd42d98ebd73da891 [file] [log] [blame]
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This file was auto-generated by the vanadium vdl tool.
// Source: types.vdl
package vsync
import (
// VDL system imports
"v.io/v23/vdl"
// VDL user imports
"v.io/x/ref/services/syncbase/server/interfaces"
)
// syncData represents the persistent state of the sync module.
type syncData struct {
Id uint64
}
func (syncData) __VDLReflect(struct {
Name string `vdl:"v.io/x/ref/services/syncbase/vsync.syncData"`
}) {
}
// dbSyncState represents the persistent sync state of a Database.
type dbSyncState struct {
GenVec interfaces.GenVector // generation vector capturing the locally-known generations of remote peers for data in Database.
SgGenVec interfaces.GenVector // generation vector capturing the locally-known generations of remote peers for syncgroups in Database.
}
func (dbSyncState) __VDLReflect(struct {
Name string `vdl:"v.io/x/ref/services/syncbase/vsync.dbSyncState"`
}) {
}
// localLogRec represents the persistent local state of a log record. Metadata
// is synced across peers, while pos is local-only.
type localLogRec struct {
Metadata interfaces.LogRecMetadata
Pos uint64 // position in the Database log.
}
func (localLogRec) __VDLReflect(struct {
Name string `vdl:"v.io/x/ref/services/syncbase/vsync.localLogRec"`
}) {
}
// sgLocalState holds the syncgroup local state, only relevant to this member
// (i.e. the local Syncbase). This is needed for crash recovery of the internal
// state transitions of the syncgroup.
type sgLocalState struct {
// The count of local joiners to the same syncgroup.
NumLocalJoiners uint32
// The syncgroup is watched when the sync Watcher starts processing the
// syncgroup data. When a syncgroup is created or joined, an entry is
// added to the Watcher queue (log) to inform it from which point to
// start accepting store mutations, an asynchronous notification similar
// to regular store mutations. When the Watcher processes that queue
// entry, it sets this bit to true. When Syncbase restarts, the value
// of this bit allows the new sync Watcher to recreate its in-memory
// state by resuming to watch only the prefixes of syncgroups that were
// previously being watched.
Watched bool
// The syncgroup was published here by this remote peer (if non-empty
// string), typically the syncgroup creator. In this case the syncgroup
// cannot be GCed locally even if it has no local joiners.
RemotePublisher string
// The syncgroup is in pending state on a device that learns the current
// state of the syncgroup from another device but has not yet received
// through peer-to-peer sync the history of the changes (DAG and logs).
// This happens in two cases:
// 1- A joiner was accepted into a syncgroup by a syncgroup admin and
// only given the current syncgroup info synchronously and will
// receive the full history later via p2p sync.
// 2- A remote server where the syncgroup is published was told by the
// syncgroup publisher the current syncgroup info synchronously and
// will receive the full history later via p2p sync.
// The pending state is over when the device reaches or exceeds the
// knowledge level indicated in the pending genvec. While SyncPending
// is true, no local syncgroup mutations are allowed (i.e. no join or
// set-spec requests).
SyncPending bool
PendingGenVec interfaces.PrefixGenVector
}
func (sgLocalState) __VDLReflect(struct {
Name string `vdl:"v.io/x/ref/services/syncbase/vsync.sgLocalState"`
}) {
}
// dagNode holds the information on an object mutation in the DAG. The node
// information is extracted from the log records exchanged between Syncbases.
// They are also stored in the DAG node to improve DAG traversal for conflict
// resolution and pruning without having to fetch the full log record.
type dagNode struct {
Level uint64 // node distance from root
Parents []string // references to parent versions
Logrec string // reference to log record
BatchId uint64 // ID of a write batch
Shell bool // true when the data is hidden due to permissions
Deleted bool // true if the change was a delete
PermId string // ID of the permissions controlling this version
PermVers string // current version of the permissions object
}
func (dagNode) __VDLReflect(struct {
Name string `vdl:"v.io/x/ref/services/syncbase/vsync.dagNode"`
}) {
}
// batchInfo holds the information on a write batch:
// - The map of syncable (versioned) objects: {oid: version}
// - The map of linked objects {oid: version} that were not explicitly written
// as part of the batch but were reaffirmed during conflict resolution along
// with other objects written in this batch by the app by choosing "pickLocal"
// or "pickRemote". NOTE: this map is non empty only for batches created
// during conflict resolution. Unlike the Objects map, the collection of
// oid:version present in this map do not point back to this batch. They point
// to the batches that there were originally created in.
// - The total count of batch objects, including non-syncable ones.
// TODO(rdaoud): add support to track the read and scan sets.
type batchInfo struct {
Objects map[string]string
LinkedObjects map[string]string
Count uint64
}
func (batchInfo) __VDLReflect(struct {
Name string `vdl:"v.io/x/ref/services/syncbase/vsync.batchInfo"`
}) {
}
func init() {
vdl.Register((*syncData)(nil))
vdl.Register((*dbSyncState)(nil))
vdl.Register((*localLogRec)(nil))
vdl.Register((*sgLocalState)(nil))
vdl.Register((*dagNode)(nil))
vdl.Register((*batchInfo)(nil))
}
const logPrefix = "log" // log state.
const logDataPrefix = "data" // data log state.
const dbssPrefix = "dbss" // database sync state.
const dagPrefix = "dag" // dag state.
const sgPrefix = "sg" // local syncgroup state.
const sgDataPrefix = "sgd" // synced syncgroup state.