aboutsummaryrefslogtreecommitdiff
path: root/binary/decoder.go
diff options
context:
space:
mode:
authorBen Clayton <headlessclayton@gmail.com>2015-07-01 16:54:54 +0100
committerBen Clayton <headlessclayton@gmail.com>2015-07-02 11:26:25 +0100
commit78d65fe06b1c254ae2bb6f45dca6f366efcc6ffa (patch)
tree77850107ce52040bab625230edbbfc7446653f17 /binary/decoder.go
parent561b633b0e36eee90c6c7ef13f76778b612309c8 (diff)
downloadgpu-78d65fe06b1c254ae2bb6f45dca6f366efcc6ffa.tar.gz
Replace the binary/pod package with binary/any.
There were concerns with performance hit encoding and decoding took with the introduction of the POD package: https://android-review.googlesource.com/#/c/157320/ To address this, the pod package has been replaced with any, which as well as supporting POD types, can box binary.Object types. The wrapper object can be encoded using Variant for POD-efficent encodings while still encoding Objects as references (as the wrapper uses Object() internally). Added new schema type to support anys. Change-Id: I789f6ef61a5a1f2ee4e26b3fde3b95cdbdb611b5
Diffstat (limited to 'binary/decoder.go')
-rw-r--r--binary/decoder.go18
1 files changed, 8 insertions, 10 deletions
diff --git a/binary/decoder.go b/binary/decoder.go
index 7e305c5f8..8fa450f17 100644
--- a/binary/decoder.go
+++ b/binary/decoder.go
@@ -26,18 +26,16 @@ type Decoder interface {
// SkipValue must skip the same data that a call to Value would read.
// The value may be a typed nil.
SkipValue(Object) error
- // Variant decodes and returns a POD value or Object from the stream.
- // If the value in the stream is an Object, the Class in the stream must have
- // been previously registered with binary.registry.Add.
- Variant() (interface{}, error)
+ // Variant decodes and returns an Object from the stream. The Class in the
+ // stream must have been previously registered with binary.registry.Add.
+ Variant() (Object, error)
// SkipVariant must skip the same data that a call to Variant would read.
SkipVariant() (ID, error)
- // Object decodes and returns a POD value or Object from the stream.
- // Values that were encoded multiple times may be decoded and returned as a
- // shared, single instance.
- // If the value in the stream is an Object, the Class in the stream must have
- // been previously registered with binary.registry.Add.
- Object() (interface{}, error)
+ // Object decodes and returns an Object from the stream. Object instances
+ // that were encoded multiple times may be decoded and returned as a shared,
+ // single instance. The Class in the stream must have been previously
+ // registered with binary.registry.Add.
+ Object() (Object, error)
// SkipObject must skip the same data that a call to Object would read.
SkipObject() (ID, error)
// Lookup the class that would be used to encode an id in this encoder.