Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 1 | // Copyright 2015 The Vanadium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | // This file was auto-generated by the vanadium vdl tool. |
| 6 | // Source: vsync.vdl |
| 7 | |
| 8 | package vsync |
| 9 | |
| 10 | import ( |
| 11 | // VDL system imports |
| 12 | "io" |
| 13 | "v.io/v23" |
| 14 | "v.io/v23/context" |
| 15 | "v.io/v23/rpc" |
| 16 | "v.io/v23/vdl" |
| 17 | |
| 18 | // VDL user imports |
| 19 | "v.io/v23/security/access" |
| 20 | ) |
| 21 | |
| 22 | // temporary types |
| 23 | type ObjId string |
| 24 | |
| 25 | func (ObjId) __VDLReflect(struct { |
Adam Sadovsky | be0f835 | 2015-05-11 16:04:15 -0700 | [diff] [blame] | 26 | Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/sync.ObjId"` |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 27 | }) { |
| 28 | } |
| 29 | |
| 30 | type Version uint64 |
| 31 | |
| 32 | func (Version) __VDLReflect(struct { |
Adam Sadovsky | be0f835 | 2015-05-11 16:04:15 -0700 | [diff] [blame] | 33 | Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/sync.Version"` |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 34 | }) { |
| 35 | } |
| 36 | |
| 37 | type GroupId uint64 |
| 38 | |
| 39 | func (GroupId) __VDLReflect(struct { |
Adam Sadovsky | be0f835 | 2015-05-11 16:04:15 -0700 | [diff] [blame] | 40 | Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/sync.GroupId"` |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 41 | }) { |
| 42 | } |
| 43 | |
| 44 | // DeviceId is the globally unique Id of a device. |
| 45 | type DeviceId string |
| 46 | |
| 47 | func (DeviceId) __VDLReflect(struct { |
Adam Sadovsky | be0f835 | 2015-05-11 16:04:15 -0700 | [diff] [blame] | 48 | Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/sync.DeviceId"` |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 49 | }) { |
| 50 | } |
| 51 | |
| 52 | // GenId is the unique Id per generation per device. |
| 53 | type GenId uint64 |
| 54 | |
| 55 | func (GenId) __VDLReflect(struct { |
Adam Sadovsky | be0f835 | 2015-05-11 16:04:15 -0700 | [diff] [blame] | 56 | Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/sync.GenId"` |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 57 | }) { |
| 58 | } |
| 59 | |
| 60 | // SeqNum is the log sequence number. |
| 61 | type SeqNum uint64 |
| 62 | |
| 63 | func (SeqNum) __VDLReflect(struct { |
Adam Sadovsky | be0f835 | 2015-05-11 16:04:15 -0700 | [diff] [blame] | 64 | Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/sync.SeqNum"` |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 65 | }) { |
| 66 | } |
| 67 | |
| 68 | // GenVector is the generation vector. |
| 69 | type GenVector map[DeviceId]GenId |
| 70 | |
| 71 | func (GenVector) __VDLReflect(struct { |
Adam Sadovsky | be0f835 | 2015-05-11 16:04:15 -0700 | [diff] [blame] | 72 | Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/sync.GenVector"` |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 73 | }) { |
| 74 | } |
| 75 | |
| 76 | // TxId is the unique Id per transaction. |
| 77 | type TxId uint64 |
| 78 | |
| 79 | func (TxId) __VDLReflect(struct { |
Adam Sadovsky | be0f835 | 2015-05-11 16:04:15 -0700 | [diff] [blame] | 80 | Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/sync.TxId"` |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 81 | }) { |
| 82 | } |
| 83 | |
| 84 | // GroupIdSet is the list of SyncGroup Ids. |
| 85 | type GroupIdSet []GroupId |
| 86 | |
| 87 | func (GroupIdSet) __VDLReflect(struct { |
Adam Sadovsky | be0f835 | 2015-05-11 16:04:15 -0700 | [diff] [blame] | 88 | Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/sync.GroupIdSet"` |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 89 | }) { |
| 90 | } |
| 91 | |
| 92 | // LogRec represents a single log record that is exchanged between two |
| 93 | // peers. |
| 94 | // |
| 95 | // It contains log related metadata: DevId is the id of the device |
| 96 | // that created the log record, SyncRootId is the id of a SyncRoot this log |
| 97 | // record was created under, GNum is the Id of the generation that the |
| 98 | // log record is part of, SeqNum is the log sequence number of the log |
| 99 | // record in the generation GNum, and RecType is the type of log |
| 100 | // record. |
| 101 | // |
| 102 | // It also contains information relevant to the updates to an object |
| 103 | // in the store: ObjId is the id of the object that was |
| 104 | // updated. CurVers is the current version number of the |
| 105 | // object. Parents can contain 0, 1 or 2 parent versions that the |
| 106 | // current version is derived from, and Value is the actual value of |
| 107 | // the object mutation. |
| 108 | type LogRec struct { |
| 109 | // Log related information. |
| 110 | DevId DeviceId |
| 111 | SyncRootId ObjId |
| 112 | GenNum GenId |
| 113 | SeqNum SeqNum |
| 114 | RecType byte |
| 115 | // Object related information. |
| 116 | ObjId ObjId |
| 117 | CurVers Version |
| 118 | Parents []Version |
| 119 | Value LogValue |
| 120 | } |
| 121 | |
| 122 | func (LogRec) __VDLReflect(struct { |
Adam Sadovsky | be0f835 | 2015-05-11 16:04:15 -0700 | [diff] [blame] | 123 | Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/sync.LogRec"` |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 124 | }) { |
| 125 | } |
| 126 | |
| 127 | // LogValue represents an object mutation within a transaction. |
| 128 | type LogValue struct { |
| 129 | // Mutation is the store mutation representing the change in the object. |
| 130 | //Mutation raw.Mutation |
| 131 | // SyncTime is the timestamp of the mutation when it arrives at the Sync server. |
| 132 | SyncTime int64 |
| 133 | // Delete indicates whether the mutation resulted in the object being |
| 134 | // deleted from the store. |
| 135 | Delete bool |
| 136 | // TxId is the unique Id of the transaction this mutation belongs to. |
| 137 | TxId TxId |
| 138 | // TxCount is the number of mutations in the transaction TxId. |
| 139 | TxCount uint32 |
| 140 | } |
| 141 | |
| 142 | func (LogValue) __VDLReflect(struct { |
Adam Sadovsky | be0f835 | 2015-05-11 16:04:15 -0700 | [diff] [blame] | 143 | Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/sync.LogValue"` |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 144 | }) { |
| 145 | } |
| 146 | |
| 147 | // DeviceStats contains high-level information on a device participating in |
| 148 | // peer-to-peer synchronization. |
| 149 | type DeviceStats struct { |
| 150 | DevId DeviceId // Device Id. |
| 151 | LastSync int64 // Timestamp of last sync from the device. |
| 152 | GenVectors map[ObjId]GenVector // Generation vectors per SyncRoot. |
| 153 | IsSelf bool // True if the responder is on this device. |
| 154 | } |
| 155 | |
| 156 | func (DeviceStats) __VDLReflect(struct { |
Adam Sadovsky | be0f835 | 2015-05-11 16:04:15 -0700 | [diff] [blame] | 157 | Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/sync.DeviceStats"` |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 158 | }) { |
| 159 | } |
| 160 | |
| 161 | // SyncGroupStats contains high-level information on a SyncGroup. |
| 162 | type SyncGroupStats struct { |
| 163 | Name string // Global name of the SyncGroup. |
| 164 | Id GroupId // Global Id of the SyncGroup. |
| 165 | Path string // Local store path for the root of the SyncGroup. |
| 166 | RootObjId ObjId // Id of the store object at the root path. |
| 167 | NumJoiners uint32 // Number of members currently in the SyncGroup. |
| 168 | } |
| 169 | |
| 170 | func (SyncGroupStats) __VDLReflect(struct { |
Adam Sadovsky | be0f835 | 2015-05-11 16:04:15 -0700 | [diff] [blame] | 171 | Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/sync.SyncGroupStats"` |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 172 | }) { |
| 173 | } |
| 174 | |
| 175 | // SyncGroupMember contains information on a SyncGroup member. |
| 176 | type SyncGroupMember struct { |
| 177 | Name string // Name of SyncGroup member. |
| 178 | Id GroupId // Global Id of the SyncGroup. |
| 179 | Metadata JoinerMetaData // Extra member metadata. |
| 180 | } |
| 181 | |
| 182 | func (SyncGroupMember) __VDLReflect(struct { |
Adam Sadovsky | be0f835 | 2015-05-11 16:04:15 -0700 | [diff] [blame] | 183 | Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/sync.SyncGroupMember"` |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 184 | }) { |
| 185 | } |
| 186 | |
| 187 | // A SyncGroupInfo is the conceptual state of a SyncGroup object. |
| 188 | type SyncGroupInfo struct { |
| 189 | Id GroupId // Globally unique SyncGroup Id. |
| 190 | ServerName string // Global Vanadium name of SyncGroupServer. |
| 191 | GroupName string // Relative name of group; global name is ServerName/GroupName. |
| 192 | Config SyncGroupConfig // Configuration parameters of this SyncGroup. |
| 193 | ETag string // Version Id for concurrency control. |
| 194 | // A map from joiner names to the associated metaData for devices that |
| 195 | // have called Join() or Create() and not subsequently called Leave() |
| 196 | // or had Eject() called on them. The map returned by the calls below |
| 197 | // may contain only a subset of joiners if the number is large. |
| 198 | Joiners map[string]JoinerMetaData |
| 199 | // Blessings for joiners of this SyncGroup will be self-signed by the |
| 200 | // SyncGroupServer, and will have names matching |
| 201 | // JoinerBlessingPrefix/Name/... |
| 202 | JoinerBlessingPrefix string |
| 203 | } |
| 204 | |
| 205 | func (SyncGroupInfo) __VDLReflect(struct { |
Adam Sadovsky | be0f835 | 2015-05-11 16:04:15 -0700 | [diff] [blame] | 206 | Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/sync.SyncGroupInfo"` |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 207 | }) { |
| 208 | } |
| 209 | |
| 210 | // A SyncGroupConfig contains some fields of SyncGroupInfo that |
| 211 | // are passed at create time, but which can be changed later. |
| 212 | type SyncGroupConfig struct { |
| 213 | Desc string // Human readable description. |
| 214 | Options map[string]*vdl.Value // Options for future evolution. |
| 215 | Permissions access.Permissions // The object's Permissions. |
| 216 | // Mount tables used to advertise for synchronization. |
| 217 | // Typically, we will have only one entry. However, an array allows |
| 218 | // mount tables to be changed over time. |
| 219 | MountTables []string |
| 220 | BlessingsDurationNanos int64 // Duration of blessings, in nanoseconds. 0 => use server default. |
| 221 | } |
| 222 | |
| 223 | func (SyncGroupConfig) __VDLReflect(struct { |
Adam Sadovsky | be0f835 | 2015-05-11 16:04:15 -0700 | [diff] [blame] | 224 | Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/sync.SyncGroupConfig"` |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 225 | }) { |
| 226 | } |
| 227 | |
| 228 | // A JoinerMetaData contains the non-name information stored per joiner. |
| 229 | type JoinerMetaData struct { |
| 230 | // SyncPriority is a hint to bias the choice of syncing partners. |
| 231 | // Members of the SyncGroup should choose to synchronize more often |
| 232 | // with partners with lower values. |
| 233 | SyncPriority int32 |
| 234 | } |
| 235 | |
| 236 | func (JoinerMetaData) __VDLReflect(struct { |
Adam Sadovsky | be0f835 | 2015-05-11 16:04:15 -0700 | [diff] [blame] | 237 | Name string `vdl:"v.io/syncbase/x/ref/services/syncbase/sync.JoinerMetaData"` |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 238 | }) { |
| 239 | } |
| 240 | |
| 241 | func init() { |
| 242 | vdl.Register((*ObjId)(nil)) |
| 243 | vdl.Register((*Version)(nil)) |
| 244 | vdl.Register((*GroupId)(nil)) |
| 245 | vdl.Register((*DeviceId)(nil)) |
| 246 | vdl.Register((*GenId)(nil)) |
| 247 | vdl.Register((*SeqNum)(nil)) |
| 248 | vdl.Register((*GenVector)(nil)) |
| 249 | vdl.Register((*TxId)(nil)) |
| 250 | vdl.Register((*GroupIdSet)(nil)) |
| 251 | vdl.Register((*LogRec)(nil)) |
| 252 | vdl.Register((*LogValue)(nil)) |
| 253 | vdl.Register((*DeviceStats)(nil)) |
| 254 | vdl.Register((*SyncGroupStats)(nil)) |
| 255 | vdl.Register((*SyncGroupMember)(nil)) |
| 256 | vdl.Register((*SyncGroupInfo)(nil)) |
| 257 | vdl.Register((*SyncGroupConfig)(nil)) |
| 258 | vdl.Register((*JoinerMetaData)(nil)) |
| 259 | } |
| 260 | |
| 261 | // NodeRec type log record adds a new node in the dag. |
| 262 | const NodeRec = byte(0) |
| 263 | |
| 264 | // LinkRec type log record adds a new link in the dag. |
| 265 | const LinkRec = byte(1) |
| 266 | |
| 267 | // Sync interface has Object name "global/vsync/<devid>/sync". |
| 268 | const SyncSuffix = "sync" |
| 269 | |
| 270 | // temporary nil values |
| 271 | const NoObjId = ObjId("") |
| 272 | |
| 273 | const NoVersion = Version(0) |
| 274 | |
| 275 | const NoGroupId = GroupId(0) |
| 276 | |
| 277 | // SyncClientMethods is the client interface |
| 278 | // containing Sync methods. |
| 279 | // |
| 280 | // Sync allows a device to GetDeltas from another device. |
| 281 | type SyncClientMethods interface { |
| 282 | // GetDeltas returns a device's current generation vector and all |
| 283 | // the missing log records when compared to the incoming generation vector. |
| 284 | GetDeltas(ctx *context.T, in map[ObjId]GenVector, sgs map[ObjId]GroupIdSet, clientId DeviceId, opts ...rpc.CallOpt) (SyncGetDeltasClientCall, error) |
| 285 | // GetObjectHistory returns the mutation history of a store object. |
| 286 | GetObjectHistory(ctx *context.T, oid ObjId, opts ...rpc.CallOpt) (SyncGetObjectHistoryClientCall, error) |
| 287 | // GetDeviceStats returns information on devices participating in |
| 288 | // peer-to-peer synchronization. |
| 289 | GetDeviceStats(*context.T, ...rpc.CallOpt) (SyncGetDeviceStatsClientCall, error) |
| 290 | // GetSyncGroupMembers returns information on SyncGroup members. |
| 291 | // If SyncGroup names are specified, only members of these SyncGroups |
| 292 | // are returned. Otherwise, if the slice of names is nil or empty, |
| 293 | // members of all SyncGroups are returned. |
| 294 | GetSyncGroupMembers(ctx *context.T, sgNames []string, opts ...rpc.CallOpt) (SyncGetSyncGroupMembersClientCall, error) |
| 295 | // GetSyncGroupStats returns high-level information on all SyncGroups. |
| 296 | GetSyncGroupStats(*context.T, ...rpc.CallOpt) (SyncGetSyncGroupStatsClientCall, error) |
| 297 | // Dump writes to the Sync log internal information used for debugging. |
| 298 | Dump(*context.T, ...rpc.CallOpt) error |
| 299 | } |
| 300 | |
| 301 | // SyncClientStub adds universal methods to SyncClientMethods. |
| 302 | type SyncClientStub interface { |
| 303 | SyncClientMethods |
| 304 | rpc.UniversalServiceMethods |
| 305 | } |
| 306 | |
| 307 | // SyncClient returns a client stub for Sync. |
| 308 | func SyncClient(name string) SyncClientStub { |
| 309 | return implSyncClientStub{name} |
| 310 | } |
| 311 | |
| 312 | type implSyncClientStub struct { |
| 313 | name string |
| 314 | } |
| 315 | |
| 316 | func (c implSyncClientStub) GetDeltas(ctx *context.T, i0 map[ObjId]GenVector, i1 map[ObjId]GroupIdSet, i2 DeviceId, opts ...rpc.CallOpt) (ocall SyncGetDeltasClientCall, err error) { |
| 317 | var call rpc.ClientCall |
| 318 | if call, err = v23.GetClient(ctx).StartCall(ctx, c.name, "GetDeltas", []interface{}{i0, i1, i2}, opts...); err != nil { |
| 319 | return |
| 320 | } |
| 321 | ocall = &implSyncGetDeltasClientCall{ClientCall: call} |
| 322 | return |
| 323 | } |
| 324 | |
| 325 | func (c implSyncClientStub) GetObjectHistory(ctx *context.T, i0 ObjId, opts ...rpc.CallOpt) (ocall SyncGetObjectHistoryClientCall, err error) { |
| 326 | var call rpc.ClientCall |
| 327 | if call, err = v23.GetClient(ctx).StartCall(ctx, c.name, "GetObjectHistory", []interface{}{i0}, opts...); err != nil { |
| 328 | return |
| 329 | } |
| 330 | ocall = &implSyncGetObjectHistoryClientCall{ClientCall: call} |
| 331 | return |
| 332 | } |
| 333 | |
| 334 | func (c implSyncClientStub) GetDeviceStats(ctx *context.T, opts ...rpc.CallOpt) (ocall SyncGetDeviceStatsClientCall, err error) { |
| 335 | var call rpc.ClientCall |
| 336 | if call, err = v23.GetClient(ctx).StartCall(ctx, c.name, "GetDeviceStats", nil, opts...); err != nil { |
| 337 | return |
| 338 | } |
| 339 | ocall = &implSyncGetDeviceStatsClientCall{ClientCall: call} |
| 340 | return |
| 341 | } |
| 342 | |
| 343 | func (c implSyncClientStub) GetSyncGroupMembers(ctx *context.T, i0 []string, opts ...rpc.CallOpt) (ocall SyncGetSyncGroupMembersClientCall, err error) { |
| 344 | var call rpc.ClientCall |
| 345 | if call, err = v23.GetClient(ctx).StartCall(ctx, c.name, "GetSyncGroupMembers", []interface{}{i0}, opts...); err != nil { |
| 346 | return |
| 347 | } |
| 348 | ocall = &implSyncGetSyncGroupMembersClientCall{ClientCall: call} |
| 349 | return |
| 350 | } |
| 351 | |
| 352 | func (c implSyncClientStub) GetSyncGroupStats(ctx *context.T, opts ...rpc.CallOpt) (ocall SyncGetSyncGroupStatsClientCall, err error) { |
| 353 | var call rpc.ClientCall |
| 354 | if call, err = v23.GetClient(ctx).StartCall(ctx, c.name, "GetSyncGroupStats", nil, opts...); err != nil { |
| 355 | return |
| 356 | } |
| 357 | ocall = &implSyncGetSyncGroupStatsClientCall{ClientCall: call} |
| 358 | return |
| 359 | } |
| 360 | |
| 361 | func (c implSyncClientStub) Dump(ctx *context.T, opts ...rpc.CallOpt) (err error) { |
Adam Sadovsky | 3ab0036 | 2015-04-10 22:06:06 -0700 | [diff] [blame] | 362 | err = v23.GetClient(ctx).Call(ctx, c.name, "Dump", nil, nil, opts...) |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 363 | return |
| 364 | } |
| 365 | |
| 366 | // SyncGetDeltasClientStream is the client stream for Sync.GetDeltas. |
| 367 | type SyncGetDeltasClientStream interface { |
| 368 | // RecvStream returns the receiver side of the Sync.GetDeltas client stream. |
| 369 | RecvStream() interface { |
| 370 | // Advance stages an item so that it may be retrieved via Value. Returns |
| 371 | // true iff there is an item to retrieve. Advance must be called before |
| 372 | // Value is called. May block if an item is not available. |
| 373 | Advance() bool |
| 374 | // Value returns the item that was staged by Advance. May panic if Advance |
| 375 | // returned false or was not called. Never blocks. |
| 376 | Value() LogRec |
| 377 | // Err returns any error encountered by Advance. Never blocks. |
| 378 | Err() error |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | // SyncGetDeltasClientCall represents the call returned from Sync.GetDeltas. |
| 383 | type SyncGetDeltasClientCall interface { |
| 384 | SyncGetDeltasClientStream |
| 385 | // Finish blocks until the server is done, and returns the positional return |
| 386 | // values for call. |
| 387 | // |
| 388 | // Finish returns immediately if the call has been canceled; depending on the |
| 389 | // timing the output could either be an error signaling cancelation, or the |
| 390 | // valid positional return values from the server. |
| 391 | // |
| 392 | // Calling Finish is mandatory for releasing stream resources, unless the call |
| 393 | // has been canceled or any of the other methods return an error. Finish should |
| 394 | // be called at most once. |
| 395 | Finish() (map[ObjId]GenVector, error) |
| 396 | } |
| 397 | |
| 398 | type implSyncGetDeltasClientCall struct { |
| 399 | rpc.ClientCall |
| 400 | valRecv LogRec |
| 401 | errRecv error |
| 402 | } |
| 403 | |
| 404 | func (c *implSyncGetDeltasClientCall) RecvStream() interface { |
| 405 | Advance() bool |
| 406 | Value() LogRec |
| 407 | Err() error |
| 408 | } { |
| 409 | return implSyncGetDeltasClientCallRecv{c} |
| 410 | } |
| 411 | |
| 412 | type implSyncGetDeltasClientCallRecv struct { |
| 413 | c *implSyncGetDeltasClientCall |
| 414 | } |
| 415 | |
| 416 | func (c implSyncGetDeltasClientCallRecv) Advance() bool { |
| 417 | c.c.valRecv = LogRec{} |
| 418 | c.c.errRecv = c.c.Recv(&c.c.valRecv) |
| 419 | return c.c.errRecv == nil |
| 420 | } |
| 421 | func (c implSyncGetDeltasClientCallRecv) Value() LogRec { |
| 422 | return c.c.valRecv |
| 423 | } |
| 424 | func (c implSyncGetDeltasClientCallRecv) Err() error { |
| 425 | if c.c.errRecv == io.EOF { |
| 426 | return nil |
| 427 | } |
| 428 | return c.c.errRecv |
| 429 | } |
| 430 | func (c *implSyncGetDeltasClientCall) Finish() (o0 map[ObjId]GenVector, err error) { |
| 431 | err = c.ClientCall.Finish(&o0) |
| 432 | return |
| 433 | } |
| 434 | |
| 435 | // SyncGetObjectHistoryClientStream is the client stream for Sync.GetObjectHistory. |
| 436 | type SyncGetObjectHistoryClientStream interface { |
| 437 | // RecvStream returns the receiver side of the Sync.GetObjectHistory client stream. |
| 438 | RecvStream() interface { |
| 439 | // Advance stages an item so that it may be retrieved via Value. Returns |
| 440 | // true iff there is an item to retrieve. Advance must be called before |
| 441 | // Value is called. May block if an item is not available. |
| 442 | Advance() bool |
| 443 | // Value returns the item that was staged by Advance. May panic if Advance |
| 444 | // returned false or was not called. Never blocks. |
| 445 | Value() LogRec |
| 446 | // Err returns any error encountered by Advance. Never blocks. |
| 447 | Err() error |
| 448 | } |
| 449 | } |
| 450 | |
| 451 | // SyncGetObjectHistoryClientCall represents the call returned from Sync.GetObjectHistory. |
| 452 | type SyncGetObjectHistoryClientCall interface { |
| 453 | SyncGetObjectHistoryClientStream |
| 454 | // Finish blocks until the server is done, and returns the positional return |
| 455 | // values for call. |
| 456 | // |
| 457 | // Finish returns immediately if the call has been canceled; depending on the |
| 458 | // timing the output could either be an error signaling cancelation, or the |
| 459 | // valid positional return values from the server. |
| 460 | // |
| 461 | // Calling Finish is mandatory for releasing stream resources, unless the call |
| 462 | // has been canceled or any of the other methods return an error. Finish should |
| 463 | // be called at most once. |
| 464 | Finish() (Version, error) |
| 465 | } |
| 466 | |
| 467 | type implSyncGetObjectHistoryClientCall struct { |
| 468 | rpc.ClientCall |
| 469 | valRecv LogRec |
| 470 | errRecv error |
| 471 | } |
| 472 | |
| 473 | func (c *implSyncGetObjectHistoryClientCall) RecvStream() interface { |
| 474 | Advance() bool |
| 475 | Value() LogRec |
| 476 | Err() error |
| 477 | } { |
| 478 | return implSyncGetObjectHistoryClientCallRecv{c} |
| 479 | } |
| 480 | |
| 481 | type implSyncGetObjectHistoryClientCallRecv struct { |
| 482 | c *implSyncGetObjectHistoryClientCall |
| 483 | } |
| 484 | |
| 485 | func (c implSyncGetObjectHistoryClientCallRecv) Advance() bool { |
| 486 | c.c.valRecv = LogRec{} |
| 487 | c.c.errRecv = c.c.Recv(&c.c.valRecv) |
| 488 | return c.c.errRecv == nil |
| 489 | } |
| 490 | func (c implSyncGetObjectHistoryClientCallRecv) Value() LogRec { |
| 491 | return c.c.valRecv |
| 492 | } |
| 493 | func (c implSyncGetObjectHistoryClientCallRecv) Err() error { |
| 494 | if c.c.errRecv == io.EOF { |
| 495 | return nil |
| 496 | } |
| 497 | return c.c.errRecv |
| 498 | } |
| 499 | func (c *implSyncGetObjectHistoryClientCall) Finish() (o0 Version, err error) { |
| 500 | err = c.ClientCall.Finish(&o0) |
| 501 | return |
| 502 | } |
| 503 | |
| 504 | // SyncGetDeviceStatsClientStream is the client stream for Sync.GetDeviceStats. |
| 505 | type SyncGetDeviceStatsClientStream interface { |
| 506 | // RecvStream returns the receiver side of the Sync.GetDeviceStats client stream. |
| 507 | RecvStream() interface { |
| 508 | // Advance stages an item so that it may be retrieved via Value. Returns |
| 509 | // true iff there is an item to retrieve. Advance must be called before |
| 510 | // Value is called. May block if an item is not available. |
| 511 | Advance() bool |
| 512 | // Value returns the item that was staged by Advance. May panic if Advance |
| 513 | // returned false or was not called. Never blocks. |
| 514 | Value() DeviceStats |
| 515 | // Err returns any error encountered by Advance. Never blocks. |
| 516 | Err() error |
| 517 | } |
| 518 | } |
| 519 | |
| 520 | // SyncGetDeviceStatsClientCall represents the call returned from Sync.GetDeviceStats. |
| 521 | type SyncGetDeviceStatsClientCall interface { |
| 522 | SyncGetDeviceStatsClientStream |
| 523 | // Finish blocks until the server is done, and returns the positional return |
| 524 | // values for call. |
| 525 | // |
| 526 | // Finish returns immediately if the call has been canceled; depending on the |
| 527 | // timing the output could either be an error signaling cancelation, or the |
| 528 | // valid positional return values from the server. |
| 529 | // |
| 530 | // Calling Finish is mandatory for releasing stream resources, unless the call |
| 531 | // has been canceled or any of the other methods return an error. Finish should |
| 532 | // be called at most once. |
| 533 | Finish() error |
| 534 | } |
| 535 | |
| 536 | type implSyncGetDeviceStatsClientCall struct { |
| 537 | rpc.ClientCall |
| 538 | valRecv DeviceStats |
| 539 | errRecv error |
| 540 | } |
| 541 | |
| 542 | func (c *implSyncGetDeviceStatsClientCall) RecvStream() interface { |
| 543 | Advance() bool |
| 544 | Value() DeviceStats |
| 545 | Err() error |
| 546 | } { |
| 547 | return implSyncGetDeviceStatsClientCallRecv{c} |
| 548 | } |
| 549 | |
| 550 | type implSyncGetDeviceStatsClientCallRecv struct { |
| 551 | c *implSyncGetDeviceStatsClientCall |
| 552 | } |
| 553 | |
| 554 | func (c implSyncGetDeviceStatsClientCallRecv) Advance() bool { |
| 555 | c.c.valRecv = DeviceStats{} |
| 556 | c.c.errRecv = c.c.Recv(&c.c.valRecv) |
| 557 | return c.c.errRecv == nil |
| 558 | } |
| 559 | func (c implSyncGetDeviceStatsClientCallRecv) Value() DeviceStats { |
| 560 | return c.c.valRecv |
| 561 | } |
| 562 | func (c implSyncGetDeviceStatsClientCallRecv) Err() error { |
| 563 | if c.c.errRecv == io.EOF { |
| 564 | return nil |
| 565 | } |
| 566 | return c.c.errRecv |
| 567 | } |
| 568 | func (c *implSyncGetDeviceStatsClientCall) Finish() (err error) { |
| 569 | err = c.ClientCall.Finish() |
| 570 | return |
| 571 | } |
| 572 | |
| 573 | // SyncGetSyncGroupMembersClientStream is the client stream for Sync.GetSyncGroupMembers. |
| 574 | type SyncGetSyncGroupMembersClientStream interface { |
| 575 | // RecvStream returns the receiver side of the Sync.GetSyncGroupMembers client stream. |
| 576 | RecvStream() interface { |
| 577 | // Advance stages an item so that it may be retrieved via Value. Returns |
| 578 | // true iff there is an item to retrieve. Advance must be called before |
| 579 | // Value is called. May block if an item is not available. |
| 580 | Advance() bool |
| 581 | // Value returns the item that was staged by Advance. May panic if Advance |
| 582 | // returned false or was not called. Never blocks. |
| 583 | Value() SyncGroupMember |
| 584 | // Err returns any error encountered by Advance. Never blocks. |
| 585 | Err() error |
| 586 | } |
| 587 | } |
| 588 | |
| 589 | // SyncGetSyncGroupMembersClientCall represents the call returned from Sync.GetSyncGroupMembers. |
| 590 | type SyncGetSyncGroupMembersClientCall interface { |
| 591 | SyncGetSyncGroupMembersClientStream |
| 592 | // Finish blocks until the server is done, and returns the positional return |
| 593 | // values for call. |
| 594 | // |
| 595 | // Finish returns immediately if the call has been canceled; depending on the |
| 596 | // timing the output could either be an error signaling cancelation, or the |
| 597 | // valid positional return values from the server. |
| 598 | // |
| 599 | // Calling Finish is mandatory for releasing stream resources, unless the call |
| 600 | // has been canceled or any of the other methods return an error. Finish should |
| 601 | // be called at most once. |
| 602 | Finish() error |
| 603 | } |
| 604 | |
| 605 | type implSyncGetSyncGroupMembersClientCall struct { |
| 606 | rpc.ClientCall |
| 607 | valRecv SyncGroupMember |
| 608 | errRecv error |
| 609 | } |
| 610 | |
| 611 | func (c *implSyncGetSyncGroupMembersClientCall) RecvStream() interface { |
| 612 | Advance() bool |
| 613 | Value() SyncGroupMember |
| 614 | Err() error |
| 615 | } { |
| 616 | return implSyncGetSyncGroupMembersClientCallRecv{c} |
| 617 | } |
| 618 | |
| 619 | type implSyncGetSyncGroupMembersClientCallRecv struct { |
| 620 | c *implSyncGetSyncGroupMembersClientCall |
| 621 | } |
| 622 | |
| 623 | func (c implSyncGetSyncGroupMembersClientCallRecv) Advance() bool { |
| 624 | c.c.valRecv = SyncGroupMember{} |
| 625 | c.c.errRecv = c.c.Recv(&c.c.valRecv) |
| 626 | return c.c.errRecv == nil |
| 627 | } |
| 628 | func (c implSyncGetSyncGroupMembersClientCallRecv) Value() SyncGroupMember { |
| 629 | return c.c.valRecv |
| 630 | } |
| 631 | func (c implSyncGetSyncGroupMembersClientCallRecv) Err() error { |
| 632 | if c.c.errRecv == io.EOF { |
| 633 | return nil |
| 634 | } |
| 635 | return c.c.errRecv |
| 636 | } |
| 637 | func (c *implSyncGetSyncGroupMembersClientCall) Finish() (err error) { |
| 638 | err = c.ClientCall.Finish() |
| 639 | return |
| 640 | } |
| 641 | |
| 642 | // SyncGetSyncGroupStatsClientStream is the client stream for Sync.GetSyncGroupStats. |
| 643 | type SyncGetSyncGroupStatsClientStream interface { |
| 644 | // RecvStream returns the receiver side of the Sync.GetSyncGroupStats client stream. |
| 645 | RecvStream() interface { |
| 646 | // Advance stages an item so that it may be retrieved via Value. Returns |
| 647 | // true iff there is an item to retrieve. Advance must be called before |
| 648 | // Value is called. May block if an item is not available. |
| 649 | Advance() bool |
| 650 | // Value returns the item that was staged by Advance. May panic if Advance |
| 651 | // returned false or was not called. Never blocks. |
| 652 | Value() SyncGroupStats |
| 653 | // Err returns any error encountered by Advance. Never blocks. |
| 654 | Err() error |
| 655 | } |
| 656 | } |
| 657 | |
| 658 | // SyncGetSyncGroupStatsClientCall represents the call returned from Sync.GetSyncGroupStats. |
| 659 | type SyncGetSyncGroupStatsClientCall interface { |
| 660 | SyncGetSyncGroupStatsClientStream |
| 661 | // Finish blocks until the server is done, and returns the positional return |
| 662 | // values for call. |
| 663 | // |
| 664 | // Finish returns immediately if the call has been canceled; depending on the |
| 665 | // timing the output could either be an error signaling cancelation, or the |
| 666 | // valid positional return values from the server. |
| 667 | // |
| 668 | // Calling Finish is mandatory for releasing stream resources, unless the call |
| 669 | // has been canceled or any of the other methods return an error. Finish should |
| 670 | // be called at most once. |
| 671 | Finish() error |
| 672 | } |
| 673 | |
| 674 | type implSyncGetSyncGroupStatsClientCall struct { |
| 675 | rpc.ClientCall |
| 676 | valRecv SyncGroupStats |
| 677 | errRecv error |
| 678 | } |
| 679 | |
| 680 | func (c *implSyncGetSyncGroupStatsClientCall) RecvStream() interface { |
| 681 | Advance() bool |
| 682 | Value() SyncGroupStats |
| 683 | Err() error |
| 684 | } { |
| 685 | return implSyncGetSyncGroupStatsClientCallRecv{c} |
| 686 | } |
| 687 | |
| 688 | type implSyncGetSyncGroupStatsClientCallRecv struct { |
| 689 | c *implSyncGetSyncGroupStatsClientCall |
| 690 | } |
| 691 | |
| 692 | func (c implSyncGetSyncGroupStatsClientCallRecv) Advance() bool { |
| 693 | c.c.valRecv = SyncGroupStats{} |
| 694 | c.c.errRecv = c.c.Recv(&c.c.valRecv) |
| 695 | return c.c.errRecv == nil |
| 696 | } |
| 697 | func (c implSyncGetSyncGroupStatsClientCallRecv) Value() SyncGroupStats { |
| 698 | return c.c.valRecv |
| 699 | } |
| 700 | func (c implSyncGetSyncGroupStatsClientCallRecv) Err() error { |
| 701 | if c.c.errRecv == io.EOF { |
| 702 | return nil |
| 703 | } |
| 704 | return c.c.errRecv |
| 705 | } |
| 706 | func (c *implSyncGetSyncGroupStatsClientCall) Finish() (err error) { |
| 707 | err = c.ClientCall.Finish() |
| 708 | return |
| 709 | } |
| 710 | |
| 711 | // SyncServerMethods is the interface a server writer |
| 712 | // implements for Sync. |
| 713 | // |
| 714 | // Sync allows a device to GetDeltas from another device. |
| 715 | type SyncServerMethods interface { |
| 716 | // GetDeltas returns a device's current generation vector and all |
| 717 | // the missing log records when compared to the incoming generation vector. |
Adam Sadovsky | b1b099b | 2015-04-21 15:40:10 -0700 | [diff] [blame] | 718 | GetDeltas(ctx *context.T, call SyncGetDeltasServerCall, in map[ObjId]GenVector, sgs map[ObjId]GroupIdSet, clientId DeviceId) (map[ObjId]GenVector, error) |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 719 | // GetObjectHistory returns the mutation history of a store object. |
Adam Sadovsky | b1b099b | 2015-04-21 15:40:10 -0700 | [diff] [blame] | 720 | GetObjectHistory(ctx *context.T, call SyncGetObjectHistoryServerCall, oid ObjId) (Version, error) |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 721 | // GetDeviceStats returns information on devices participating in |
| 722 | // peer-to-peer synchronization. |
Adam Sadovsky | b1b099b | 2015-04-21 15:40:10 -0700 | [diff] [blame] | 723 | GetDeviceStats(*context.T, SyncGetDeviceStatsServerCall) error |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 724 | // GetSyncGroupMembers returns information on SyncGroup members. |
| 725 | // If SyncGroup names are specified, only members of these SyncGroups |
| 726 | // are returned. Otherwise, if the slice of names is nil or empty, |
| 727 | // members of all SyncGroups are returned. |
Adam Sadovsky | b1b099b | 2015-04-21 15:40:10 -0700 | [diff] [blame] | 728 | GetSyncGroupMembers(ctx *context.T, call SyncGetSyncGroupMembersServerCall, sgNames []string) error |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 729 | // GetSyncGroupStats returns high-level information on all SyncGroups. |
Adam Sadovsky | b1b099b | 2015-04-21 15:40:10 -0700 | [diff] [blame] | 730 | GetSyncGroupStats(*context.T, SyncGetSyncGroupStatsServerCall) error |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 731 | // Dump writes to the Sync log internal information used for debugging. |
Adam Sadovsky | b1b099b | 2015-04-21 15:40:10 -0700 | [diff] [blame] | 732 | Dump(*context.T, rpc.ServerCall) error |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 733 | } |
| 734 | |
| 735 | // SyncServerStubMethods is the server interface containing |
| 736 | // Sync methods, as expected by rpc.Server. |
| 737 | // The only difference between this interface and SyncServerMethods |
| 738 | // is the streaming methods. |
| 739 | type SyncServerStubMethods interface { |
| 740 | // GetDeltas returns a device's current generation vector and all |
| 741 | // the missing log records when compared to the incoming generation vector. |
Adam Sadovsky | b1b099b | 2015-04-21 15:40:10 -0700 | [diff] [blame] | 742 | GetDeltas(ctx *context.T, call *SyncGetDeltasServerCallStub, in map[ObjId]GenVector, sgs map[ObjId]GroupIdSet, clientId DeviceId) (map[ObjId]GenVector, error) |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 743 | // GetObjectHistory returns the mutation history of a store object. |
Adam Sadovsky | b1b099b | 2015-04-21 15:40:10 -0700 | [diff] [blame] | 744 | GetObjectHistory(ctx *context.T, call *SyncGetObjectHistoryServerCallStub, oid ObjId) (Version, error) |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 745 | // GetDeviceStats returns information on devices participating in |
| 746 | // peer-to-peer synchronization. |
Adam Sadovsky | b1b099b | 2015-04-21 15:40:10 -0700 | [diff] [blame] | 747 | GetDeviceStats(*context.T, *SyncGetDeviceStatsServerCallStub) error |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 748 | // GetSyncGroupMembers returns information on SyncGroup members. |
| 749 | // If SyncGroup names are specified, only members of these SyncGroups |
| 750 | // are returned. Otherwise, if the slice of names is nil or empty, |
| 751 | // members of all SyncGroups are returned. |
Adam Sadovsky | b1b099b | 2015-04-21 15:40:10 -0700 | [diff] [blame] | 752 | GetSyncGroupMembers(ctx *context.T, call *SyncGetSyncGroupMembersServerCallStub, sgNames []string) error |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 753 | // GetSyncGroupStats returns high-level information on all SyncGroups. |
Adam Sadovsky | b1b099b | 2015-04-21 15:40:10 -0700 | [diff] [blame] | 754 | GetSyncGroupStats(*context.T, *SyncGetSyncGroupStatsServerCallStub) error |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 755 | // Dump writes to the Sync log internal information used for debugging. |
Adam Sadovsky | b1b099b | 2015-04-21 15:40:10 -0700 | [diff] [blame] | 756 | Dump(*context.T, rpc.ServerCall) error |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 757 | } |
| 758 | |
| 759 | // SyncServerStub adds universal methods to SyncServerStubMethods. |
| 760 | type SyncServerStub interface { |
| 761 | SyncServerStubMethods |
| 762 | // Describe the Sync interfaces. |
| 763 | Describe__() []rpc.InterfaceDesc |
| 764 | } |
| 765 | |
| 766 | // SyncServer returns a server stub for Sync. |
| 767 | // It converts an implementation of SyncServerMethods into |
| 768 | // an object that may be used by rpc.Server. |
| 769 | func SyncServer(impl SyncServerMethods) SyncServerStub { |
| 770 | stub := implSyncServerStub{ |
| 771 | impl: impl, |
| 772 | } |
| 773 | // Initialize GlobState; always check the stub itself first, to handle the |
| 774 | // case where the user has the Glob method defined in their VDL source. |
| 775 | if gs := rpc.NewGlobState(stub); gs != nil { |
| 776 | stub.gs = gs |
| 777 | } else if gs := rpc.NewGlobState(impl); gs != nil { |
| 778 | stub.gs = gs |
| 779 | } |
| 780 | return stub |
| 781 | } |
| 782 | |
| 783 | type implSyncServerStub struct { |
| 784 | impl SyncServerMethods |
| 785 | gs *rpc.GlobState |
| 786 | } |
| 787 | |
Adam Sadovsky | b1b099b | 2015-04-21 15:40:10 -0700 | [diff] [blame] | 788 | func (s implSyncServerStub) GetDeltas(ctx *context.T, call *SyncGetDeltasServerCallStub, i0 map[ObjId]GenVector, i1 map[ObjId]GroupIdSet, i2 DeviceId) (map[ObjId]GenVector, error) { |
| 789 | return s.impl.GetDeltas(ctx, call, i0, i1, i2) |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 790 | } |
| 791 | |
Adam Sadovsky | b1b099b | 2015-04-21 15:40:10 -0700 | [diff] [blame] | 792 | func (s implSyncServerStub) GetObjectHistory(ctx *context.T, call *SyncGetObjectHistoryServerCallStub, i0 ObjId) (Version, error) { |
| 793 | return s.impl.GetObjectHistory(ctx, call, i0) |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 794 | } |
| 795 | |
Adam Sadovsky | b1b099b | 2015-04-21 15:40:10 -0700 | [diff] [blame] | 796 | func (s implSyncServerStub) GetDeviceStats(ctx *context.T, call *SyncGetDeviceStatsServerCallStub) error { |
| 797 | return s.impl.GetDeviceStats(ctx, call) |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 798 | } |
| 799 | |
Adam Sadovsky | b1b099b | 2015-04-21 15:40:10 -0700 | [diff] [blame] | 800 | func (s implSyncServerStub) GetSyncGroupMembers(ctx *context.T, call *SyncGetSyncGroupMembersServerCallStub, i0 []string) error { |
| 801 | return s.impl.GetSyncGroupMembers(ctx, call, i0) |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 802 | } |
| 803 | |
Adam Sadovsky | b1b099b | 2015-04-21 15:40:10 -0700 | [diff] [blame] | 804 | func (s implSyncServerStub) GetSyncGroupStats(ctx *context.T, call *SyncGetSyncGroupStatsServerCallStub) error { |
| 805 | return s.impl.GetSyncGroupStats(ctx, call) |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 806 | } |
| 807 | |
Adam Sadovsky | b1b099b | 2015-04-21 15:40:10 -0700 | [diff] [blame] | 808 | func (s implSyncServerStub) Dump(ctx *context.T, call rpc.ServerCall) error { |
| 809 | return s.impl.Dump(ctx, call) |
Adam Sadovsky | b85e353 | 2015-04-08 20:38:27 -0700 | [diff] [blame] | 810 | } |
| 811 | |
| 812 | func (s implSyncServerStub) Globber() *rpc.GlobState { |
| 813 | return s.gs |
| 814 | } |
| 815 | |
| 816 | func (s implSyncServerStub) Describe__() []rpc.InterfaceDesc { |
| 817 | return []rpc.InterfaceDesc{SyncDesc} |
| 818 | } |
| 819 | |
| 820 | // SyncDesc describes the Sync interface. |
| 821 | var SyncDesc rpc.InterfaceDesc = descSync |
| 822 | |
| 823 | // descSync hides the desc to keep godoc clean. |
| 824 | var descSync = rpc.InterfaceDesc{ |
| 825 | Name: "Sync", |
| 826 | PkgPath: "v.io/syncbase/x/ref/services/syncbase/sync", |
| 827 | Doc: "// Sync allows a device to GetDeltas from another device.", |
| 828 | Methods: []rpc.MethodDesc{ |
| 829 | { |
| 830 | Name: "GetDeltas", |
| 831 | Doc: "// GetDeltas returns a device's current generation vector and all\n// the missing log records when compared to the incoming generation vector.", |
| 832 | InArgs: []rpc.ArgDesc{ |
| 833 | {"in", ``}, // map[ObjId]GenVector |
| 834 | {"sgs", ``}, // map[ObjId]GroupIdSet |
| 835 | {"clientId", ``}, // DeviceId |
| 836 | }, |
| 837 | OutArgs: []rpc.ArgDesc{ |
| 838 | {"", ``}, // map[ObjId]GenVector |
| 839 | }, |
| 840 | Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Write"))}, |
| 841 | }, |
| 842 | { |
| 843 | Name: "GetObjectHistory", |
| 844 | Doc: "// GetObjectHistory returns the mutation history of a store object.", |
| 845 | InArgs: []rpc.ArgDesc{ |
| 846 | {"oid", ``}, // ObjId |
| 847 | }, |
| 848 | OutArgs: []rpc.ArgDesc{ |
| 849 | {"", ``}, // Version |
| 850 | }, |
| 851 | }, |
| 852 | { |
| 853 | Name: "GetDeviceStats", |
| 854 | Doc: "// GetDeviceStats returns information on devices participating in\n// peer-to-peer synchronization.", |
| 855 | Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Admin"))}, |
| 856 | }, |
| 857 | { |
| 858 | Name: "GetSyncGroupMembers", |
| 859 | Doc: "// GetSyncGroupMembers returns information on SyncGroup members.\n// If SyncGroup names are specified, only members of these SyncGroups\n// are returned. Otherwise, if the slice of names is nil or empty,\n// members of all SyncGroups are returned.", |
| 860 | InArgs: []rpc.ArgDesc{ |
| 861 | {"sgNames", ``}, // []string |
| 862 | }, |
| 863 | Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Admin"))}, |
| 864 | }, |
| 865 | { |
| 866 | Name: "GetSyncGroupStats", |
| 867 | Doc: "// GetSyncGroupStats returns high-level information on all SyncGroups.", |
| 868 | Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Admin"))}, |
| 869 | }, |
| 870 | { |
| 871 | Name: "Dump", |
| 872 | Doc: "// Dump writes to the Sync log internal information used for debugging.", |
| 873 | Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Admin"))}, |
| 874 | }, |
| 875 | }, |
| 876 | } |
| 877 | |
| 878 | // SyncGetDeltasServerStream is the server stream for Sync.GetDeltas. |
| 879 | type SyncGetDeltasServerStream interface { |
| 880 | // SendStream returns the send side of the Sync.GetDeltas server stream. |
| 881 | SendStream() interface { |
| 882 | // Send places the item onto the output stream. Returns errors encountered |
| 883 | // while sending. Blocks if there is no buffer space; will unblock when |
| 884 | // buffer space is available. |
| 885 | Send(item LogRec) error |
| 886 | } |
| 887 | } |
| 888 | |
| 889 | // SyncGetDeltasServerCall represents the context passed to Sync.GetDeltas. |
| 890 | type SyncGetDeltasServerCall interface { |
| 891 | rpc.ServerCall |
| 892 | SyncGetDeltasServerStream |
| 893 | } |
| 894 | |
| 895 | // SyncGetDeltasServerCallStub is a wrapper that converts rpc.StreamServerCall into |
| 896 | // a typesafe stub that implements SyncGetDeltasServerCall. |
| 897 | type SyncGetDeltasServerCallStub struct { |
| 898 | rpc.StreamServerCall |
| 899 | } |
| 900 | |
| 901 | // Init initializes SyncGetDeltasServerCallStub from rpc.StreamServerCall. |
| 902 | func (s *SyncGetDeltasServerCallStub) Init(call rpc.StreamServerCall) { |
| 903 | s.StreamServerCall = call |
| 904 | } |
| 905 | |
| 906 | // SendStream returns the send side of the Sync.GetDeltas server stream. |
| 907 | func (s *SyncGetDeltasServerCallStub) SendStream() interface { |
| 908 | Send(item LogRec) error |
| 909 | } { |
| 910 | return implSyncGetDeltasServerCallSend{s} |
| 911 | } |
| 912 | |
| 913 | type implSyncGetDeltasServerCallSend struct { |
| 914 | s *SyncGetDeltasServerCallStub |
| 915 | } |
| 916 | |
| 917 | func (s implSyncGetDeltasServerCallSend) Send(item LogRec) error { |
| 918 | return s.s.Send(item) |
| 919 | } |
| 920 | |
| 921 | // SyncGetObjectHistoryServerStream is the server stream for Sync.GetObjectHistory. |
| 922 | type SyncGetObjectHistoryServerStream interface { |
| 923 | // SendStream returns the send side of the Sync.GetObjectHistory server stream. |
| 924 | SendStream() interface { |
| 925 | // Send places the item onto the output stream. Returns errors encountered |
| 926 | // while sending. Blocks if there is no buffer space; will unblock when |
| 927 | // buffer space is available. |
| 928 | Send(item LogRec) error |
| 929 | } |
| 930 | } |
| 931 | |
| 932 | // SyncGetObjectHistoryServerCall represents the context passed to Sync.GetObjectHistory. |
| 933 | type SyncGetObjectHistoryServerCall interface { |
| 934 | rpc.ServerCall |
| 935 | SyncGetObjectHistoryServerStream |
| 936 | } |
| 937 | |
| 938 | // SyncGetObjectHistoryServerCallStub is a wrapper that converts rpc.StreamServerCall into |
| 939 | // a typesafe stub that implements SyncGetObjectHistoryServerCall. |
| 940 | type SyncGetObjectHistoryServerCallStub struct { |
| 941 | rpc.StreamServerCall |
| 942 | } |
| 943 | |
| 944 | // Init initializes SyncGetObjectHistoryServerCallStub from rpc.StreamServerCall. |
| 945 | func (s *SyncGetObjectHistoryServerCallStub) Init(call rpc.StreamServerCall) { |
| 946 | s.StreamServerCall = call |
| 947 | } |
| 948 | |
| 949 | // SendStream returns the send side of the Sync.GetObjectHistory server stream. |
| 950 | func (s *SyncGetObjectHistoryServerCallStub) SendStream() interface { |
| 951 | Send(item LogRec) error |
| 952 | } { |
| 953 | return implSyncGetObjectHistoryServerCallSend{s} |
| 954 | } |
| 955 | |
| 956 | type implSyncGetObjectHistoryServerCallSend struct { |
| 957 | s *SyncGetObjectHistoryServerCallStub |
| 958 | } |
| 959 | |
| 960 | func (s implSyncGetObjectHistoryServerCallSend) Send(item LogRec) error { |
| 961 | return s.s.Send(item) |
| 962 | } |
| 963 | |
| 964 | // SyncGetDeviceStatsServerStream is the server stream for Sync.GetDeviceStats. |
| 965 | type SyncGetDeviceStatsServerStream interface { |
| 966 | // SendStream returns the send side of the Sync.GetDeviceStats server stream. |
| 967 | SendStream() interface { |
| 968 | // Send places the item onto the output stream. Returns errors encountered |
| 969 | // while sending. Blocks if there is no buffer space; will unblock when |
| 970 | // buffer space is available. |
| 971 | Send(item DeviceStats) error |
| 972 | } |
| 973 | } |
| 974 | |
| 975 | // SyncGetDeviceStatsServerCall represents the context passed to Sync.GetDeviceStats. |
| 976 | type SyncGetDeviceStatsServerCall interface { |
| 977 | rpc.ServerCall |
| 978 | SyncGetDeviceStatsServerStream |
| 979 | } |
| 980 | |
| 981 | // SyncGetDeviceStatsServerCallStub is a wrapper that converts rpc.StreamServerCall into |
| 982 | // a typesafe stub that implements SyncGetDeviceStatsServerCall. |
| 983 | type SyncGetDeviceStatsServerCallStub struct { |
| 984 | rpc.StreamServerCall |
| 985 | } |
| 986 | |
| 987 | // Init initializes SyncGetDeviceStatsServerCallStub from rpc.StreamServerCall. |
| 988 | func (s *SyncGetDeviceStatsServerCallStub) Init(call rpc.StreamServerCall) { |
| 989 | s.StreamServerCall = call |
| 990 | } |
| 991 | |
| 992 | // SendStream returns the send side of the Sync.GetDeviceStats server stream. |
| 993 | func (s *SyncGetDeviceStatsServerCallStub) SendStream() interface { |
| 994 | Send(item DeviceStats) error |
| 995 | } { |
| 996 | return implSyncGetDeviceStatsServerCallSend{s} |
| 997 | } |
| 998 | |
| 999 | type implSyncGetDeviceStatsServerCallSend struct { |
| 1000 | s *SyncGetDeviceStatsServerCallStub |
| 1001 | } |
| 1002 | |
| 1003 | func (s implSyncGetDeviceStatsServerCallSend) Send(item DeviceStats) error { |
| 1004 | return s.s.Send(item) |
| 1005 | } |
| 1006 | |
| 1007 | // SyncGetSyncGroupMembersServerStream is the server stream for Sync.GetSyncGroupMembers. |
| 1008 | type SyncGetSyncGroupMembersServerStream interface { |
| 1009 | // SendStream returns the send side of the Sync.GetSyncGroupMembers server stream. |
| 1010 | SendStream() interface { |
| 1011 | // Send places the item onto the output stream. Returns errors encountered |
| 1012 | // while sending. Blocks if there is no buffer space; will unblock when |
| 1013 | // buffer space is available. |
| 1014 | Send(item SyncGroupMember) error |
| 1015 | } |
| 1016 | } |
| 1017 | |
| 1018 | // SyncGetSyncGroupMembersServerCall represents the context passed to Sync.GetSyncGroupMembers. |
| 1019 | type SyncGetSyncGroupMembersServerCall interface { |
| 1020 | rpc.ServerCall |
| 1021 | SyncGetSyncGroupMembersServerStream |
| 1022 | } |
| 1023 | |
| 1024 | // SyncGetSyncGroupMembersServerCallStub is a wrapper that converts rpc.StreamServerCall into |
| 1025 | // a typesafe stub that implements SyncGetSyncGroupMembersServerCall. |
| 1026 | type SyncGetSyncGroupMembersServerCallStub struct { |
| 1027 | rpc.StreamServerCall |
| 1028 | } |
| 1029 | |
| 1030 | // Init initializes SyncGetSyncGroupMembersServerCallStub from rpc.StreamServerCall. |
| 1031 | func (s *SyncGetSyncGroupMembersServerCallStub) Init(call rpc.StreamServerCall) { |
| 1032 | s.StreamServerCall = call |
| 1033 | } |
| 1034 | |
| 1035 | // SendStream returns the send side of the Sync.GetSyncGroupMembers server stream. |
| 1036 | func (s *SyncGetSyncGroupMembersServerCallStub) SendStream() interface { |
| 1037 | Send(item SyncGroupMember) error |
| 1038 | } { |
| 1039 | return implSyncGetSyncGroupMembersServerCallSend{s} |
| 1040 | } |
| 1041 | |
| 1042 | type implSyncGetSyncGroupMembersServerCallSend struct { |
| 1043 | s *SyncGetSyncGroupMembersServerCallStub |
| 1044 | } |
| 1045 | |
| 1046 | func (s implSyncGetSyncGroupMembersServerCallSend) Send(item SyncGroupMember) error { |
| 1047 | return s.s.Send(item) |
| 1048 | } |
| 1049 | |
| 1050 | // SyncGetSyncGroupStatsServerStream is the server stream for Sync.GetSyncGroupStats. |
| 1051 | type SyncGetSyncGroupStatsServerStream interface { |
| 1052 | // SendStream returns the send side of the Sync.GetSyncGroupStats server stream. |
| 1053 | SendStream() interface { |
| 1054 | // Send places the item onto the output stream. Returns errors encountered |
| 1055 | // while sending. Blocks if there is no buffer space; will unblock when |
| 1056 | // buffer space is available. |
| 1057 | Send(item SyncGroupStats) error |
| 1058 | } |
| 1059 | } |
| 1060 | |
| 1061 | // SyncGetSyncGroupStatsServerCall represents the context passed to Sync.GetSyncGroupStats. |
| 1062 | type SyncGetSyncGroupStatsServerCall interface { |
| 1063 | rpc.ServerCall |
| 1064 | SyncGetSyncGroupStatsServerStream |
| 1065 | } |
| 1066 | |
| 1067 | // SyncGetSyncGroupStatsServerCallStub is a wrapper that converts rpc.StreamServerCall into |
| 1068 | // a typesafe stub that implements SyncGetSyncGroupStatsServerCall. |
| 1069 | type SyncGetSyncGroupStatsServerCallStub struct { |
| 1070 | rpc.StreamServerCall |
| 1071 | } |
| 1072 | |
| 1073 | // Init initializes SyncGetSyncGroupStatsServerCallStub from rpc.StreamServerCall. |
| 1074 | func (s *SyncGetSyncGroupStatsServerCallStub) Init(call rpc.StreamServerCall) { |
| 1075 | s.StreamServerCall = call |
| 1076 | } |
| 1077 | |
| 1078 | // SendStream returns the send side of the Sync.GetSyncGroupStats server stream. |
| 1079 | func (s *SyncGetSyncGroupStatsServerCallStub) SendStream() interface { |
| 1080 | Send(item SyncGroupStats) error |
| 1081 | } { |
| 1082 | return implSyncGetSyncGroupStatsServerCallSend{s} |
| 1083 | } |
| 1084 | |
| 1085 | type implSyncGetSyncGroupStatsServerCallSend struct { |
| 1086 | s *SyncGetSyncGroupStatsServerCallStub |
| 1087 | } |
| 1088 | |
| 1089 | func (s implSyncGetSyncGroupStatsServerCallSend) Send(item SyncGroupStats) error { |
| 1090 | return s.s.Send(item) |
| 1091 | } |