blob: a22b37d743ef513fb3868d6f70a7157d5c0d034c [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: sync_types.vdl
package interfaces
import (
// VDL system imports
"fmt"
"v.io/v23/vdl"
// VDL user imports
"time"
"v.io/syncbase/v23/services/syncbase/nosql"
_ "v.io/v23/vdlroot/time"
)
// PrefixGenVector is the generation vector for a data prefix, which maps each
// device id to its last locally known generation in the scope of that prefix.
type PrefixGenVector map[uint64]uint64
func (PrefixGenVector) __VDLReflect(struct {
Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/server/interfaces.PrefixGenVector"`
}) {
}
// GenVector is the generation vector for a Database, and maps prefixes to their
// generation vectors. Note that the prefixes in a GenVector are global prefixes
// that include the appropriate Application and Database name.
type GenVector map[string]PrefixGenVector
func (GenVector) __VDLReflect(struct {
Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/server/interfaces.GenVector"`
}) {
}
// LogRecMetadata represents the metadata of a single log record that is
// exchanged between two peers. Each log record represents a change made to an
// object in the store.
//
// TODO(hpucha): Add readset/scanset. Look into sending tx metadata only once
// per transaction.
type LogRecMetadata struct {
// Log related information.
Id uint64 // device id that created the log record.
Gen uint64 // generation number for the log record.
RecType byte // type of log record.
// Object related information.
ObjId string // id of the object that was updated.
CurVers string // current version number of the object.
Parents []string // 0, 1 or 2 parent versions that the current version is derived from.
UpdTime time.Time // timestamp when the update is generated.
Delete bool // indicates whether the update resulted in object being deleted from the store.
BatchId uint64 // unique id of the Batch this update belongs to.
BatchCount uint64 // number of objects in the Batch.
}
func (LogRecMetadata) __VDLReflect(struct {
Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/server/interfaces.LogRecMetadata"`
}) {
}
// LogRec represents the on-wire representation of an entire log record: its
// metadata and data. Value is the actual value of a store object.
type LogRec struct {
Metadata LogRecMetadata
Value []byte
}
func (LogRec) __VDLReflect(struct {
Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/server/interfaces.LogRec"`
}) {
}
// GroupId is a globally unique SyncGroup ID.
type GroupId uint64
func (GroupId) __VDLReflect(struct {
Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/server/interfaces.GroupId"`
}) {
}
// Possible states for a SyncGroup.
type SyncGroupStatus int
const (
SyncGroupStatusPublishPending SyncGroupStatus = iota
SyncGroupStatusPublishRejected
SyncGroupStatusRunning
)
// SyncGroupStatusAll holds all labels for SyncGroupStatus.
var SyncGroupStatusAll = [...]SyncGroupStatus{SyncGroupStatusPublishPending, SyncGroupStatusPublishRejected, SyncGroupStatusRunning}
// SyncGroupStatusFromString creates a SyncGroupStatus from a string label.
func SyncGroupStatusFromString(label string) (x SyncGroupStatus, err error) {
err = x.Set(label)
return
}
// Set assigns label to x.
func (x *SyncGroupStatus) Set(label string) error {
switch label {
case "PublishPending", "publishpending":
*x = SyncGroupStatusPublishPending
return nil
case "PublishRejected", "publishrejected":
*x = SyncGroupStatusPublishRejected
return nil
case "Running", "running":
*x = SyncGroupStatusRunning
return nil
}
*x = -1
return fmt.Errorf("unknown label %q in interfaces.SyncGroupStatus", label)
}
// String returns the string label of x.
func (x SyncGroupStatus) String() string {
switch x {
case SyncGroupStatusPublishPending:
return "PublishPending"
case SyncGroupStatusPublishRejected:
return "PublishRejected"
case SyncGroupStatusRunning:
return "Running"
}
return ""
}
func (SyncGroupStatus) __VDLReflect(struct {
Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/server/interfaces.SyncGroupStatus"`
Enum struct{ PublishPending, PublishRejected, Running string }
}) {
}
// SyncGroup contains the state of a SyncGroup object.
type SyncGroup struct {
Id GroupId // globally unique identifier generated by Syncbase
Name string // globally unique Vanadium name chosen by app
SpecVersion string // version on SyncGroup spec for concurrency control
Spec nosql.SyncGroupSpec // app-given specification
Creator string // Creator's Vanadium name
AppName string // Globally unique App name
DbName string // Database name within the App
Status SyncGroupStatus // Status of the SyncGroup
Joiners map[string]nosql.SyncGroupMemberInfo // map of joiners to their metadata
}
func (SyncGroup) __VDLReflect(struct {
Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/server/interfaces.SyncGroup"`
}) {
}
func init() {
vdl.Register((*PrefixGenVector)(nil))
vdl.Register((*GenVector)(nil))
vdl.Register((*LogRecMetadata)(nil))
vdl.Register((*LogRec)(nil))
vdl.Register((*GroupId)(nil))
vdl.Register((*SyncGroupStatus)(nil))
vdl.Register((*SyncGroup)(nil))
}
const NoGroupId = GroupId(0)
// NodeRec type log record adds a new node in the dag.
const NodeRec = byte(0)
// LinkRec type log record adds a new link in the dag. Link records are
// added when a conflict is resolved by picking the local or the remote
// version as the resolution of a conflict, instead of creating a new
// version.
const LinkRec = byte(1)