Commit 5274c445 authored by Yong Tang's avatar Yong Tang Committed by GitHub

Remove version pinning of thrift, ugoriji/go, and etcd (#2457)

* Remove version pinning of thrift, ugoriji/go, and etcd

For incompatibility reasons at one point, we were forced
to pining the version of thrift, ugoriji/go, and etcd
to very specific versions (some are not versioned commits)
to get around the build issues.

It looks like those incompatibility issues are gone so
we could remove the pinning of thrift, ugoriji/go, and etcd.
Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>

* Update Gopkg.lock
Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>

* Update vendor library
Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>
parent 003355e1
...@@ -30,11 +30,12 @@ ...@@ -30,11 +30,12 @@
version = "v1.17.0" version = "v1.17.0"
[[projects]] [[projects]]
digest = "1:eee9386329f4fcdf8d6c0def0c9771b634bdd5ba460d888aa98c17d59b37a76c" digest = "1:b39cf81d5f440b9c0757a25058432d33af867e5201109bf53621356d9dab4b73"
name = "github.com/apache/thrift" name = "github.com/apache/thrift"
packages = ["lib/go/thrift"] packages = ["lib/go/thrift"]
pruneopts = "NUT" pruneopts = "NUT"
revision = "e59b73d3c2bf1c328ccb78e683c0462fa1a473c7" revision = "384647d290e2e4a55a14b1b7ef1b7e66293a2c33"
version = "v0.12.0"
[[projects]] [[projects]]
digest = "1:7943d65eade11f12eda6d0c0e681197e26cad6bdc0105a0a28c3c5c761c00589" digest = "1:7943d65eade11f12eda6d0c0e681197e26cad6bdc0105a0a28c3c5c761c00589"
...@@ -75,7 +76,7 @@ ...@@ -75,7 +76,7 @@
version = "v1.14.17" version = "v1.14.17"
[[projects]] [[projects]]
digest = "1:c2f7fb4667999c4a5c90ef00a6762cf186e6ec8a822e6780a354e1cc94682eab" digest = "1:22db66c6af48fe0e93e971d796cad565ee9e0039646bd59bc8e29b7a7bd2d24e"
name = "github.com/coreos/etcd" name = "github.com/coreos/etcd"
packages = [ packages = [
"auth/authpb", "auth/authpb",
...@@ -86,8 +87,8 @@ ...@@ -86,8 +87,8 @@
"pkg/types", "pkg/types",
] ]
pruneopts = "NUT" pruneopts = "NUT"
revision = "33245c6b5b49130ca99280408fadfab01aac0e48" revision = "2cf9e51d2a78003b164c2998886158e60ded1cbb"
version = "v3.3.8" version = "v3.3.11"
[[projects]] [[projects]]
digest = "1:a2c1d0e43bd3baaa071d1b9ed72c27d78169b2b269f71c105ac4ba34b1be4a39" digest = "1:a2c1d0e43bd3baaa071d1b9ed72c27d78169b2b269f71c105ac4ba34b1be4a39"
...@@ -425,11 +426,11 @@ ...@@ -425,11 +426,11 @@
version = "v1.0.1" version = "v1.0.1"
[[projects]] [[projects]]
digest = "1:5751632e81f26941863b0aaf0f33d55cb89898a49ba8d5574eb4d97e9291810d" digest = "1:a49fa08481484b6a37ee5a641a90d1efb6818972a5de88617e3fe31d240dabfd"
name = "github.com/ugorji/go" name = "github.com/ugorji/go"
packages = ["codec"] packages = ["codec"]
pruneopts = "NUT" pruneopts = "NUT"
revision = "f3cacc17c85ecb7f1b6a9e373ee85d1480919868" revision = "9c7f9b7a2bc3a520f7c7b30b34b7f85f47fe27b6"
[[projects]] [[projects]]
branch = "master" branch = "master"
......
...@@ -33,14 +33,3 @@ ignored = [ ...@@ -33,14 +33,3 @@ ignored = [
[[override]] [[override]]
name = "sigs.k8s.io/yaml" name = "sigs.k8s.io/yaml"
revision = "fd68e9863619f6ec2fdd8625fe1f02e7c877e480" revision = "fd68e9863619f6ec2fdd8625fe1f02e7c877e480"
[[override]]
name = "github.com/apache/thrift"
revision = "e59b73d3c2bf1c328ccb78e683c0462fa1a473c7"
[[override]]
name = "github.com/ugorji/go"
revision = "f3cacc17c85ecb7f1b6a9e373ee85d1480919868"
[[constraint]]
name = "github.com/coreos/etcd"
version = "3.3.5"
...@@ -448,9 +448,6 @@ func (p *TBinaryProtocol) ReadBinary() ([]byte, error) { ...@@ -448,9 +448,6 @@ func (p *TBinaryProtocol) ReadBinary() ([]byte, error) {
if size < 0 { if size < 0 {
return nil, invalidDataLength return nil, invalidDataLength
} }
if uint64(size) > p.trans.RemainingBytes() {
return nil, invalidDataLength
}
isize := int(size) isize := int(size)
buf := make([]byte, isize) buf := make([]byte, isize)
...@@ -481,9 +478,6 @@ func (p *TBinaryProtocol) readStringBody(size int32) (value string, err error) { ...@@ -481,9 +478,6 @@ func (p *TBinaryProtocol) readStringBody(size int32) (value string, err error) {
if size < 0 { if size < 0 {
return "", nil return "", nil
} }
if uint64(size) > p.trans.RemainingBytes() {
return "", invalidDataLength
}
var ( var (
buf bytes.Buffer buf bytes.Buffer
......
...@@ -562,9 +562,6 @@ func (p *TCompactProtocol) ReadString() (value string, err error) { ...@@ -562,9 +562,6 @@ func (p *TCompactProtocol) ReadString() (value string, err error) {
if length < 0 { if length < 0 {
return "", invalidDataLength return "", invalidDataLength
} }
if uint64(length) > p.trans.RemainingBytes() {
return "", invalidDataLength
}
if length == 0 { if length == 0 {
return "", nil return "", nil
...@@ -591,9 +588,6 @@ func (p *TCompactProtocol) ReadBinary() (value []byte, err error) { ...@@ -591,9 +588,6 @@ func (p *TCompactProtocol) ReadBinary() (value []byte, err error) {
if length < 0 { if length < 0 {
return nil, invalidDataLength return nil, invalidDataLength
} }
if uint64(length) > p.trans.RemainingBytes() {
return nil, invalidDataLength
}
buf := make([]byte, length) buf := make([]byte, length)
_, e = io.ReadFull(p.trans, buf) _, e = io.ReadFull(p.trans, buf)
......
...@@ -75,7 +75,9 @@ func (p *TServerSocket) Accept() (TTransport, error) { ...@@ -75,7 +75,9 @@ func (p *TServerSocket) Accept() (TTransport, error) {
return nil, errTransportInterrupted return nil, errTransportInterrupted
} }
p.mu.Lock()
listener := p.listener listener := p.listener
p.mu.Unlock()
if listener == nil { if listener == nil {
return nil, NewTTransportException(NOT_OPEN, "No underlying server socket") return nil, NewTTransportException(NOT_OPEN, "No underlying server socket")
} }
...@@ -115,19 +117,20 @@ func (p *TServerSocket) Addr() net.Addr { ...@@ -115,19 +117,20 @@ func (p *TServerSocket) Addr() net.Addr {
} }
func (p *TServerSocket) Close() error { func (p *TServerSocket) Close() error {
defer func() { var err error
p.listener = nil p.mu.Lock()
}()
if p.IsListening() { if p.IsListening() {
return p.listener.Close() err = p.listener.Close()
p.listener = nil
} }
return nil p.mu.Unlock()
return err
} }
func (p *TServerSocket) Interrupt() error { func (p *TServerSocket) Interrupt() error {
p.mu.Lock() p.mu.Lock()
defer p.mu.Unlock()
p.interrupted = true p.interrupted = true
p.mu.Unlock()
p.Close() p.Close()
return nil return nil
......
../../lib/cl/ensure-externals.sh
\ No newline at end of file
...@@ -77,8 +77,6 @@ const ( ...@@ -77,8 +77,6 @@ const (
// defaultTTL is the assumed lease TTL used for the first keepalive // defaultTTL is the assumed lease TTL used for the first keepalive
// deadline before the actual TTL is known to the client. // deadline before the actual TTL is known to the client.
defaultTTL = 5 * time.Second defaultTTL = 5 * time.Second
// a small buffer to store unsent lease responses.
leaseResponseChSize = 16
// NoLease is a lease ID for the absence of a lease. // NoLease is a lease ID for the absence of a lease.
NoLease LeaseID = 0 NoLease LeaseID = 0
...@@ -86,6 +84,11 @@ const ( ...@@ -86,6 +84,11 @@ const (
retryConnWait = 500 * time.Millisecond retryConnWait = 500 * time.Millisecond
) )
// LeaseResponseChSize is the size of buffer to store unsent lease responses.
// WARNING: DO NOT UPDATE.
// Only for testing purposes.
var LeaseResponseChSize = 16
// ErrKeepAliveHalted is returned if client keep alive loop halts with an unexpected error. // ErrKeepAliveHalted is returned if client keep alive loop halts with an unexpected error.
// //
// This usually means that automatic lease renewal via KeepAlive is broken, but KeepAliveOnce will still work as expected. // This usually means that automatic lease renewal via KeepAlive is broken, but KeepAliveOnce will still work as expected.
...@@ -258,7 +261,7 @@ func (l *lessor) Leases(ctx context.Context) (*LeaseLeasesResponse, error) { ...@@ -258,7 +261,7 @@ func (l *lessor) Leases(ctx context.Context) (*LeaseLeasesResponse, error) {
} }
func (l *lessor) KeepAlive(ctx context.Context, id LeaseID) (<-chan *LeaseKeepAliveResponse, error) { func (l *lessor) KeepAlive(ctx context.Context, id LeaseID) (<-chan *LeaseKeepAliveResponse, error) {
ch := make(chan *LeaseKeepAliveResponse, leaseResponseChSize) ch := make(chan *LeaseKeepAliveResponse, LeaseResponseChSize)
l.mu.Lock() l.mu.Lock()
// ensure that recvKeepAliveLoop is still running // ensure that recvKeepAliveLoop is still running
...@@ -514,9 +517,10 @@ func (l *lessor) recvKeepAlive(resp *pb.LeaseKeepAliveResponse) { ...@@ -514,9 +517,10 @@ func (l *lessor) recvKeepAlive(resp *pb.LeaseKeepAliveResponse) {
for _, ch := range ka.chs { for _, ch := range ka.chs {
select { select {
case ch <- karesp: case ch <- karesp:
ka.nextKeepAlive = nextKeepAlive
default: default:
} }
// still advance in order to rate-limit keep-alive sends
ka.nextKeepAlive = nextKeepAlive
} }
} }
......
...@@ -59,7 +59,7 @@ func (as *InternalRaftStringer) String() string { ...@@ -59,7 +59,7 @@ func (as *InternalRaftStringer) String() string {
case as.Request.Put != nil: case as.Request.Put != nil:
return fmt.Sprintf("header:<%s> put:<%s>", return fmt.Sprintf("header:<%s> put:<%s>",
as.Request.Header.String(), as.Request.Header.String(),
newLoggablePutRequest(as.Request.Put).String(), NewLoggablePutRequest(as.Request.Put).String(),
) )
case as.Request.Txn != nil: case as.Request.Txn != nil:
return fmt.Sprintf("header:<%s> txn:<%s>", return fmt.Sprintf("header:<%s> txn:<%s>",
...@@ -121,7 +121,7 @@ func newLoggableRequestOp(op *RequestOp) *requestOpStringer { ...@@ -121,7 +121,7 @@ func newLoggableRequestOp(op *RequestOp) *requestOpStringer {
func (as *requestOpStringer) String() string { func (as *requestOpStringer) String() string {
switch op := as.Op.Request.(type) { switch op := as.Op.Request.(type) {
case *RequestOp_RequestPut: case *RequestOp_RequestPut:
return fmt.Sprintf("request_put:<%s>", newLoggablePutRequest(op.RequestPut).String()) return fmt.Sprintf("request_put:<%s>", NewLoggablePutRequest(op.RequestPut).String())
case *RequestOp_RequestTxn: case *RequestOp_RequestTxn:
return fmt.Sprintf("request_txn:<%s>", NewLoggableTxnRequest(op.RequestTxn).String()) return fmt.Sprintf("request_txn:<%s>", NewLoggableTxnRequest(op.RequestTxn).String())
default: default:
...@@ -167,7 +167,7 @@ type loggablePutRequest struct { ...@@ -167,7 +167,7 @@ type loggablePutRequest struct {
IgnoreLease bool `protobuf:"varint,6,opt,name=ignore_lease,proto3"` IgnoreLease bool `protobuf:"varint,6,opt,name=ignore_lease,proto3"`
} }
func newLoggablePutRequest(request *PutRequest) *loggablePutRequest { func NewLoggablePutRequest(request *PutRequest) *loggablePutRequest {
return &loggablePutRequest{ return &loggablePutRequest{
request.Key, request.Key,
len(request.Value), len(request.Value),
......
// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
// Use of this source code is governed by a MIT license found in the LICENSE file. // Use of this source code is governed by a MIT license found in the LICENSE file.
/* /*
Package codec provides a High Performance, Feature-Rich Idiomatic Go codec/encoding library for
High Performance, Feature-Rich Idiomatic Go 1.4+ codec/encoding library binc, msgpack, cbor, json.
for binc, msgpack, cbor, json.
Supported Serialization formats are: Supported Serialization formats are:
...@@ -18,11 +17,15 @@ To install: ...@@ -18,11 +17,15 @@ To install:
go get github.com/ugorji/go/codec go get github.com/ugorji/go/codec
This package will carefully use 'unsafe' for performance reasons in specific places. This package understands the 'unsafe' tag, to allow using unsafe semantics:
You can build without unsafe use by passing the safe or appengine tag
i.e. 'go install -tags=safe ...'. Note that unsafe is only supported for the last 3 - When decoding into a struct, you need to read the field name as a string
go sdk versions e.g. current go release is go 1.9, so we support unsafe use only from so you can find the struct field it is mapped to.
go 1.7+ . This is because supporting unsafe requires knowledge of implementation details. Using `unsafe` will bypass the allocation and copying overhead of []byte->string conversion.
To install using unsafe, pass the 'unsafe' tag:
go get -tags=unsafe github.com/ugorji/go/codec
For detailed usage information, read the primer at http://ugorji.net/blog/go-codec-primer . For detailed usage information, read the primer at http://ugorji.net/blog/go-codec-primer .
...@@ -32,15 +35,11 @@ the standard library (ie json, xml, gob, etc). ...@@ -32,15 +35,11 @@ the standard library (ie json, xml, gob, etc).
Rich Feature Set includes: Rich Feature Set includes:
- Simple but extremely powerful and feature-rich API - Simple but extremely powerful and feature-rich API
- Support for go1.4 and above, while selectively using newer APIs for later releases
- Excellent code coverage ( > 90% )
- Very High Performance. - Very High Performance.
Our extensive benchmarks show us outperforming Gob, Json, Bson, etc by 2-4X. Our extensive benchmarks show us outperforming Gob, Json, Bson, etc by 2-4X.
- Careful selected use of 'unsafe' for targeted performance gains. - Multiple conversions:
100% mode exists where 'unsafe' is not used at all. Package coerces types where appropriate
- Lock-free (sans mutex) concurrency for scaling to 100's of cores e.g. decode an int in the stream into a float, etc.
- Coerce types where appropriate
e.g. decode an int in the stream into a float, decode numbers from formatted strings, etc
- Corner Cases: - Corner Cases:
Overflows, nil maps/slices, nil values in streams are handled correctly Overflows, nil maps/slices, nil values in streams are handled correctly
- Standard field renaming via tags - Standard field renaming via tags
...@@ -49,16 +48,10 @@ Rich Feature Set includes: ...@@ -49,16 +48,10 @@ Rich Feature Set includes:
(struct, slice, map, primitives, pointers, interface{}, etc) (struct, slice, map, primitives, pointers, interface{}, etc)
- Extensions to support efficient encoding/decoding of any named types - Extensions to support efficient encoding/decoding of any named types
- Support encoding.(Binary|Text)(M|Unm)arshaler interfaces - Support encoding.(Binary|Text)(M|Unm)arshaler interfaces
- Support IsZero() bool to determine if a value is a zero value.
Analogous to time.Time.IsZero() bool.
- Decoding without a schema (into a interface{}). - Decoding without a schema (into a interface{}).
Includes Options to configure what specific map or slice type to use Includes Options to configure what specific map or slice type to use
when decoding an encoded list or map into a nil interface{} when decoding an encoded list or map into a nil interface{}
- Mapping a non-interface type to an interface, so we can decode appropriately
into any interface type with a correctly configured non-interface value.
- Encode a struct as an array, and decode struct from an array in the data stream - Encode a struct as an array, and decode struct from an array in the data stream
- Option to encode struct keys as numbers (instead of strings)
(to support structured streams with fields encoded as numeric codes)
- Comprehensive support for anonymous fields - Comprehensive support for anonymous fields
- Fast (no-reflection) encoding/decoding of common maps and slices - Fast (no-reflection) encoding/decoding of common maps and slices
- Code-generation for faster performance. - Code-generation for faster performance.
...@@ -99,27 +92,6 @@ encoded as an empty map because it has no exported fields, while UUID ...@@ -99,27 +92,6 @@ encoded as an empty map because it has no exported fields, while UUID
would be encoded as a string. However, with extension support, you can would be encoded as a string. However, with extension support, you can
encode any of these however you like. encode any of these however you like.
Custom Encoding and Decoding
This package maintains symmetry in the encoding and decoding halfs.
We determine how to encode or decode by walking this decision tree
- is type a codec.Selfer?
- is there an extension registered for the type?
- is format binary, and is type a encoding.BinaryMarshaler and BinaryUnmarshaler?
- is format specifically json, and is type a encoding/json.Marshaler and Unmarshaler?
- is format text-based, and type an encoding.TextMarshaler?
- else we use a pair of functions based on the "kind" of the type e.g. map, slice, int64, etc
This symmetry is important to reduce chances of issues happening because the
encoding and decoding sides are out of sync e.g. decoded via very specific
encoding.TextUnmarshaler but encoded via kind-specific generalized mode.
Consequently, if a type only defines one-half of the symmetry
(e.g. it implements UnmarshalJSON() but not MarshalJSON() ),
then that type doesn't satisfy the check and we will continue walking down the
decision tree.
RPC RPC
RPC Client and Server Codecs are implemented, so the codecs can be used RPC Client and Server Codecs are implemented, so the codecs can be used
...@@ -188,77 +160,40 @@ Sample usage model: ...@@ -188,77 +160,40 @@ Sample usage model:
//OR rpcCodec := codec.MsgpackSpecRpc.ClientCodec(conn, h) //OR rpcCodec := codec.MsgpackSpecRpc.ClientCodec(conn, h)
client := rpc.NewClientWithCodec(rpcCodec) client := rpc.NewClientWithCodec(rpcCodec)
Running Tests
To run tests, use the following:
go test
To run the full suite of tests, use the following:
go test -tags alltests -run Suite
You can run the tag 'safe' to run tests or build in safe mode. e.g.
go test -tags safe -run Json
go test -tags "alltests safe" -run Suite
Running Benchmarks
Please see http://github.com/ugorji/go-codec-bench .
Caveats
Struct fields matching the following are ignored during encoding and decoding
- struct tag value set to -
- func, complex numbers, unsafe pointers
- unexported and not embedded
- unexported and embedded and not struct kind
- unexported and embedded pointers (from go1.10)
Every other field in a struct will be encoded/decoded.
Embedded fields are encoded as if they exist in the top-level struct,
with some caveats. See Encode documentation.
*/ */
package codec package codec
// TODO: // Benefits of go-codec:
// - For Go 1.11, when mid-stack inlining is enabled,
// we should use committed functions for writeXXX and readXXX calls.
// This involves uncommenting the methods for decReaderSwitch and encWriterSwitch
// and using those (decReaderSwitch and encWriterSwitch) in all handles
// instead of encWriter and decReader.
// The benefit is that, for the (En|De)coder over []byte, the encWriter/decReader
// will be inlined, giving a performance bump for that typical case.
// However, it will only be inlined if mid-stack inlining is enabled,
// as we call panic to raise errors, and panic currently prevents inlining.
//
// PUNTED:
// - To make Handle comparable, make extHandle in BasicHandle a non-embedded pointer,
// and use overlay methods on *BasicHandle to call through to extHandle after initializing
// the "xh *extHandle" to point to a real slice.
// //
// BEFORE EACH RELEASE: // - encoding/json always reads whole file into memory first.
// - Look through and fix padding for each type, to eliminate false sharing // This makes it unsuitable for parsing very large files.
// - critical shared objects that are read many times // - encoding/xml cannot parse into a map[string]interface{}
// TypeInfos // I found this out on reading https://github.com/clbanning/mxj
// - pooled objects:
// decNaked, decNakedContainers, codecFner, typeInfoLoadArray, // TODO:
// - small objects allocated independently, that we read/use much across threads:
// codecFn, typeInfo
// - Objects allocated independently and used a lot
// Decoder, Encoder,
// xxxHandle, xxxEncDriver, xxxDecDriver (xxx = json, msgpack, cbor, binc, simple)
// - In all above, arrange values modified together to be close to each other.
//
// For all of these, either ensure that they occupy full cache lines,
// or ensure that the things just past the cache line boundary are hardly read/written
// e.g. JsonHandle.RawBytesExt - which is copied into json(En|De)cDriver at init
// //
// Occupying full cache lines means they occupy 8*N words (where N is an integer). // - optimization for codecgen:
// Check this out by running: ./run.sh -z // if len of entity is <= 3 words, then support a value receiver for encode.
// - look at those tagged ****, meaning they are not occupying full cache lines // - (En|De)coder should store an error when it occurs.
// - look at those tagged <<<<, meaning they are larger than 32 words (something to watch) // Until reset, subsequent calls return that error that was stored.
// - Run "golint -min_confidence 0.81" // This means that free panics must go away.
// All errors must be raised through errorf method.
// - Decoding using a chan is good, but incurs concurrency costs.
// This is because there's no fast way to use a channel without it
// having to switch goroutines constantly.
// Callback pattern is still the best. Maybe consider supporting something like:
// type X struct {
// Name string
// Ys []Y
// Ys chan <- Y
// Ys func(Y) -> call this function for each entry
// }
// - Consider adding a isZeroer interface { isZero() bool }
// It is used within isEmpty, for omitEmpty support.
// - Consider making Handle used AS-IS within the encoding/decoding session.
// This means that we don't cache Handle information within the (En|De)coder,
// except we really need it at Reset(...)
// - Consider adding math/big support
// - Consider reducing the size of the generated functions:
// Maybe use one loop, and put the conditionals in the loop.
// for ... { if cLen > 0 { if j == cLen { break } } else if dd.CheckBreak() { break } }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
// Use of this source code is governed by a MIT license found in the LICENSE file. // Use of this source code is governed by a MIT license found in the LICENSE file.
// +build go1.5 // +build go1.5
...@@ -9,6 +9,8 @@ import "reflect" ...@@ -9,6 +9,8 @@ import "reflect"
const reflectArrayOfSupported = true const reflectArrayOfSupported = true
func reflectArrayOf(count int, elem reflect.Type) reflect.Type { func reflectArrayOf(rvn reflect.Value) (rvn2 reflect.Value) {
return reflect.ArrayOf(count, elem) rvn2 = reflect.New(reflect.ArrayOf(rvn.Len(), intfTyp)).Elem()
reflect.Copy(rvn2, rvn)
return
} }
// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
// Use of this source code is governed by a MIT license found in the LICENSE file. // Use of this source code is governed by a MIT license found in the LICENSE file.
// +build !go1.5 // +build !go1.5
...@@ -9,6 +9,6 @@ import "reflect" ...@@ -9,6 +9,6 @@ import "reflect"
const reflectArrayOfSupported = false const reflectArrayOfSupported = false
func reflectArrayOf(count int, elem reflect.Type) reflect.Type { func reflectArrayOf(rvn reflect.Value) (rvn2 reflect.Value) {
panic("codec: reflect.ArrayOf unsupported in this go version") panic("reflect.ArrayOf unsupported")
} }
This diff is collapsed.
// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
// Use of this source code is governed by a MIT license found in the LICENSE file.
// +build notfastpath // +build notfastpath
package codec package codec
...@@ -21,27 +18,17 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { return fal ...@@ -21,27 +18,17 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { return fal
func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { return false } func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { return false }
func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { return false } func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { return false }
func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { return false } func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { return false }
func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { return false }
type fastpathT struct{} type fastpathT struct{}
type fastpathE struct { type fastpathE struct {
rtid uintptr rtid uintptr
rt reflect.Type rt reflect.Type
encfn func(*Encoder, *codecFnInfo, reflect.Value) encfn func(*encFnInfo, reflect.Value)
decfn func(*Decoder, *codecFnInfo, reflect.Value) decfn func(*decFnInfo, reflect.Value)
} }
type fastpathA [0]fastpathE type fastpathA [0]fastpathE
func (x fastpathA) index(rtid uintptr) int { return -1 } func (x fastpathA) index(rtid uintptr) int { return -1 }
func (_ fastpathT) DecSliceUint8V(v []uint8, canChange bool, d *Decoder) (_ []uint8, changed bool) {
fn := d.cfer().get(uint8SliceTyp, true, true)
d.kSlice(&fn.i, reflect.ValueOf(&v).Elem())
return v, true
}
var fastpathAV fastpathA var fastpathAV fastpathA
var fastpathTV fastpathT var fastpathTV fastpathT
// ----
type TestMammoth2Wrapper struct{} // to allow testMammoth work in notfastpath mode
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
package codec
//go:generate bash prebuild.sh
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment