| // 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 watchable |
| |
| import ( |
| // VDL system imports |
| "v.io/v23/vdl" |
| |
| // VDL user imports |
| "v.io/x/ref/services/syncbase/server/interfaces" |
| ) |
| |
| // GetOp represents a store get operation. |
| type GetOp struct { |
| Key []byte |
| } |
| |
| func (GetOp) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/ref/services/syncbase/server/watchable.GetOp"` |
| }) { |
| } |
| |
| // ScanOp represents a store scan operation. |
| type ScanOp struct { |
| Start []byte |
| Limit []byte |
| } |
| |
| func (ScanOp) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/ref/services/syncbase/server/watchable.ScanOp"` |
| }) { |
| } |
| |
| // PutOp represents a store put operation. The new version is written instead |
| // of the value to avoid duplicating the user data in the store. The version |
| // is used to access the user data of that specific mutation. The key and the |
| // version of the permissions entry that was checked to allow this put operation |
| // are also tracked to secure the access to this history. |
| type PutOp struct { |
| Key []byte |
| Version []byte |
| PermKey []byte |
| PermVersion []byte |
| } |
| |
| func (PutOp) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/ref/services/syncbase/server/watchable.PutOp"` |
| }) { |
| } |
| |
| // DeleteOp represents a store delete operation. The key and the version of the |
| // permissions entry that was checked to allow this delete operation are also |
| // tracked to secure the access to this history. |
| type DeleteOp struct { |
| Key []byte |
| PermKey []byte |
| PermVersion []byte |
| } |
| |
| func (DeleteOp) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/ref/services/syncbase/server/watchable.DeleteOp"` |
| }) { |
| } |
| |
| // 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. |
| type SyncgroupOp struct { |
| SgId interfaces.GroupId |
| Prefixes []string |
| Remove bool |
| } |
| |
| func (SyncgroupOp) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/ref/services/syncbase/server/watchable.SyncgroupOp"` |
| }) { |
| } |
| |
| // 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. |
| // The key and the version of the permissions entry that was checked when the |
| // key was accessed are also tracked to secure the access to this history. |
| type SyncSnapshotOp struct { |
| Key []byte |
| Version []byte |
| PermKey []byte |
| PermVersion []byte |
| } |
| |
| func (SyncSnapshotOp) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/ref/services/syncbase/server/watchable.SyncSnapshotOp"` |
| }) { |
| } |
| |
| type ( |
| // Op represents any single field of the Op union type. |
| // |
| // Op represents a store operation. |
| Op interface { |
| // Index returns the field index. |
| Index() int |
| // Interface returns the field value as an interface. |
| Interface() interface{} |
| // Name returns the field name. |
| Name() string |
| // __VDLReflect describes the Op union type. |
| __VDLReflect(__OpReflect) |
| } |
| // OpGet represents field Get of the Op union type. |
| OpGet struct{ Value GetOp } |
| // OpScan represents field Scan of the Op union type. |
| OpScan struct{ Value ScanOp } |
| // OpPut represents field Put of the Op union type. |
| OpPut struct{ Value PutOp } |
| // OpDelete represents field Delete of the Op union type. |
| OpDelete struct{ Value DeleteOp } |
| // OpSyncgroup represents field Syncgroup of the Op union type. |
| OpSyncgroup struct{ Value SyncgroupOp } |
| // OpSyncSnapshot represents field SyncSnapshot of the Op union type. |
| OpSyncSnapshot struct{ Value SyncSnapshotOp } |
| // __OpReflect describes the Op union type. |
| __OpReflect struct { |
| Name string `vdl:"v.io/x/ref/services/syncbase/server/watchable.Op"` |
| Type Op |
| Union struct { |
| Get OpGet |
| Scan OpScan |
| Put OpPut |
| Delete OpDelete |
| Syncgroup OpSyncgroup |
| SyncSnapshot OpSyncSnapshot |
| } |
| } |
| ) |
| |
| func (x OpGet) Index() int { return 0 } |
| func (x OpGet) Interface() interface{} { return x.Value } |
| func (x OpGet) Name() string { return "Get" } |
| func (x OpGet) __VDLReflect(__OpReflect) {} |
| |
| func (x OpScan) Index() int { return 1 } |
| func (x OpScan) Interface() interface{} { return x.Value } |
| func (x OpScan) Name() string { return "Scan" } |
| func (x OpScan) __VDLReflect(__OpReflect) {} |
| |
| func (x OpPut) Index() int { return 2 } |
| func (x OpPut) Interface() interface{} { return x.Value } |
| func (x OpPut) Name() string { return "Put" } |
| func (x OpPut) __VDLReflect(__OpReflect) {} |
| |
| func (x OpDelete) Index() int { return 3 } |
| func (x OpDelete) Interface() interface{} { return x.Value } |
| func (x OpDelete) Name() string { return "Delete" } |
| func (x OpDelete) __VDLReflect(__OpReflect) {} |
| |
| func (x OpSyncgroup) Index() int { return 4 } |
| func (x OpSyncgroup) Interface() interface{} { return x.Value } |
| func (x OpSyncgroup) Name() string { return "Syncgroup" } |
| func (x OpSyncgroup) __VDLReflect(__OpReflect) {} |
| |
| func (x OpSyncSnapshot) Index() int { return 5 } |
| func (x OpSyncSnapshot) Interface() interface{} { return x.Value } |
| func (x OpSyncSnapshot) Name() string { return "SyncSnapshot" } |
| func (x OpSyncSnapshot) __VDLReflect(__OpReflect) {} |
| |
| // LogEntry represents a single store operation. This operation may have been |
| // part of a transaction, as signified by the Continued boolean. Read-only |
| // operations (and read-only transactions) are not logged. |
| type LogEntry struct { |
| // The store operation that was performed. |
| Op Op |
| // Time when the operation was committed in nanoseconds since the epoch. |
| // Note: We don't use time.Time here because VDL's time.Time consists of |
| // {Seconds int64, Nanos int32}, which is more expensive than a single int64. |
| CommitTimestamp int64 |
| // Operation came from sync (used for echo suppression). |
| FromSync bool |
| // If true, this entry is followed by more entries that belong to the same |
| // commit as this entry. |
| Continued bool |
| } |
| |
| func (LogEntry) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/ref/services/syncbase/server/watchable.LogEntry"` |
| }) { |
| } |
| |
| func init() { |
| vdl.Register((*GetOp)(nil)) |
| vdl.Register((*ScanOp)(nil)) |
| vdl.Register((*PutOp)(nil)) |
| vdl.Register((*DeleteOp)(nil)) |
| vdl.Register((*SyncgroupOp)(nil)) |
| vdl.Register((*SyncSnapshotOp)(nil)) |
| vdl.Register((*Op)(nil)) |
| vdl.Register((*LogEntry)(nil)) |
| } |