syncbase: use "any" instead of []byte in Put/Get RPCs
This CL and its companion use the VDL type "any" instead of []byte in the
definitions of rows in the syncbase API. See
v.io/v23/services/syncbase/service.vdl
in the Row interface.
The intent is to avoid unnecessary trips through marshalling/unmarshalling when
communicating with syncbase. With this change, all data in syncbase will be
VOM encoded, and on a Get() will not be fully decoded by the syncbase server
before the VOM-encoded data is transmitted via RPC to the client. If the
client wishes to store byte vectors, he can, but they too will be VOM encoded
inside syncbase.
The change also affects the scan and conflict resolution interfaces by changing
the KeyValue and Value structs in
v.io/v23/services/syncbase/types.vdl
v.io/syncbase/types.vdl
The strategy is to use vom.RawBytes at levels of the system near the RPC
interfaces, and []byte in the watchable and store abstractions. The
converstion between the two ios done primarily in the "row" abstraction, and
the collection abstraction (for scans)
v.io/v23/syncbase/model.go
v.io/v23/syncbase/row.go
v.io/v23/syncbase/scan_stream.go
v.io/x/ref/services/syncbase/server/collection.go
v.io/x/ref/services/syncbase/server/row.go
Details:
v.io/v23/services/syncbase/service.vdl
Row.Put() and Row.Get() pass parameters of type "any" rather than type
"[]byte".
v.io/v23/services/syncbase/types.vdl
The structs KeyValue and Value now use the type "any" to represent the
VOM-encoded value.
v.io/v23/syncbase/cr_test.go
makeResolution() now takes a *vom.RawBytes parameter.
compareResult() now encodes vom.RawBytes values to []byte values before comparing.
encode() now converts to vom.RawBytes instead of []byte.
v.io/v23/syncbase/model.go
Get() now uses RawBytes.ToValue() instead of vom.Decode.
NewValue() nbow uses RawBytesFromValue() instead of vom.Encode().
v.io/v23/syncbase/row.go
Get() and Put() now use RawBytes instead of []byte interally to
communicate with the layer below.
v.io/v23/syncbase/scan_stream.go
Value() now uses RawBytes.ToValue() instead of vmo.Decode().
v.io/v23/syncbase/syncgroup_v23_test.go
This test used to have subtests called "*NonVomData", that tested
putting raw bytes directly into the store. We no longer do this: raw
bytes are now accommodated by VOM encoding them, so all values in the
store are expected to be VOM encoded.
v.io/v23/syncbase/types.vdl
Struct Value's Val field is now of type "any" rather than "[]byte".
--------------------
v.io/x/ref/services/syncbase/server/collection.go
Scan() now decodes each value retrieved from the store into a
vom.RawBytes for transmission to the client.
v.io/x/ref/services/syncbase/server/row.go
Get()/get() now decodes a value obtained from the store into a
vom.RawBytes for transmission to the client.
Put()/put() now encodes a vom.RawBytes from the client into a []byte to
give to the store.
v.io/x/ref/services/syncbase/server/watchlog_test.go
TestWatchLogPerms() uses the row interface directly, and so now uses
vom.RawBytes.
v.io/x/ref/services/syncbase/testutil/util.go
WatchChangeEq() now expects a vom.RawBytes in the WatchChange data
structure, rather than []byte.
v.io/x/ref/services/syncbase/vsync/cr_app_resolves.go
processResInfos() now converts the vom.RawBytes data it finds to []byte.
createValueObj() now converts the []byte it finds to a vom.RawBytes
v.io/x/ref/services/syncbase/vsync/cr_app_resolves_test.go
setResInfData() now gives vom.RawValue elements to addResInfo().
checkConflictRow() converts vom.RawValue elements to []byte for comparisons.
addResInfo() now takes vo.RawValue instead of []byte
saveValue() now saves a VOM-encoded value, rather than a byte vector.
--------------------
java/io/v/v23/syncbase/RowImpl.java
test/java/io/v/v23/syncbase/SyncbaseTest.java
In the Java world, there is as yet no equivalent of vom.RawBytes. The types
are mapped to VdlAny. Currently, I convert to and from the desired types by using
VomUtil.Decode(VomUtil.encode(...)...).
MultiPart: 3/3
Change-Id: I93f3b41b96dbab2f1acba1e66e34e3cd0c3d76f7
2 files changed