*: vendor tool migrate to glide (#1743)
* *: vendor tool migrate to glide * update github.com/gogo/protobuf vendor * update several packages
This commit is contained in:
24
Makefile
24
Makefile
@ -20,7 +20,7 @@ LDFLAGS += -X "github.com/pingcap/tidb/util/printer.TiDBGitHash=$(shell git rev-
|
||||
|
||||
TARGET = ""
|
||||
|
||||
.PHONY: all build install update parser clean todo test gotest interpreter server goyacc dev benchkv
|
||||
.PHONY: all build install update parser clean todo test gotest interpreter server dev benchkv check
|
||||
|
||||
default: server buildsucc
|
||||
|
||||
@ -45,11 +45,10 @@ TEMP_FILE = temp_parser_file
|
||||
|
||||
goyacc:
|
||||
rm -rf vendor && ln -s _vendor/vendor vendor
|
||||
$(GO) build -o bin/goyacc github.com/pingcap/tidb/parser/goyacc
|
||||
$(GO) build -o bin/goyacc parser/goyacc/main.go
|
||||
rm -rf vendor
|
||||
|
||||
parser: goyacc
|
||||
rm -rf parser/scanner.go
|
||||
bin/goyacc -o /dev/null -xegen $(TEMP_FILE) parser/parser.y
|
||||
bin/goyacc -o parser/parser.go -xe $(TEMP_FILE) parser/parser.y 2>&1 | egrep "(shift|reduce)/reduce" | awk '{print} END {if (NR > 0) {print "Find conflict in parser.y. Please check y.output for more information."; system("rm -f $(TEMP_FILE)"); exit 1;}}'
|
||||
rm -f $(TEMP_FILE)
|
||||
@ -122,7 +121,7 @@ interpreter:
|
||||
@cd interpreter && $(GO) build -ldflags '$(LDFLAGS)'
|
||||
rm -rf vendor
|
||||
|
||||
server: parser
|
||||
server: parser
|
||||
ifeq ($(TARGET), "")
|
||||
rm -rf vendor && ln -s _vendor/vendor vendor
|
||||
$(GO) build -ldflags '$(LDFLAGS)' -o bin/tidb-server tidb-server/main.go
|
||||
@ -133,9 +132,22 @@ else
|
||||
rm -rf vendor
|
||||
endif
|
||||
|
||||
benchkv:
|
||||
benchkv:
|
||||
rm -rf vendor && ln -s _vendor/vendor vendor
|
||||
$(GO) build -ldflags '$(LDFLAGS)' -o bin/benchkv benchkv/main.go
|
||||
rm -rf vendor
|
||||
|
||||
|
||||
update:
|
||||
which glide >/dev/null || curl https://glide.sh/get | sh
|
||||
which glide-vc || go get -v -u github.com/sgotti/glide-vc
|
||||
rm -r vendor && mv _vendor/vendor vendor || true
|
||||
rm -rf _vendor
|
||||
ifdef PKG
|
||||
glide get -s -v --skip-test ${PKG}
|
||||
else
|
||||
glide update -s -v --skip-test
|
||||
endif
|
||||
@echo "removing test files"
|
||||
glide vc --only-code --no-tests
|
||||
mkdir -p _vendor
|
||||
mv vendor _vendor/vendor
|
||||
|
||||
620
_vendor/Godeps/Godeps.json
generated
620
_vendor/Godeps/Godeps.json
generated
@ -1,620 +0,0 @@
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/tidb",
|
||||
"GoVersion": "go1.6",
|
||||
"GodepVersion": "v74",
|
||||
"Packages": [
|
||||
"./..."
|
||||
],
|
||||
"Deps": [
|
||||
{
|
||||
"ImportPath": "github.com/boltdb/bolt",
|
||||
"Comment": "v1.2.0-21-gd974993",
|
||||
"Rev": "d97499360d1ecebc492ea66c7447ea948f417620"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/cloudfoundry-incubator/candiedyaml",
|
||||
"Rev": "99c3df83b51532e3615f851d8c2dbb638f5313bf"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/coreos/etcd/auth/authpb",
|
||||
"Comment": "v3.0.0-beta.0-1262-ge53b995",
|
||||
"Rev": "e53b99588a05d1f4ef172c178d4ed8e8106b8be4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/coreos/etcd/clientv3",
|
||||
"Comment": "v3.0.0-beta.0-1262-ge53b995",
|
||||
"Rev": "e53b99588a05d1f4ef172c178d4ed8e8106b8be4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes",
|
||||
"Comment": "v3.0.0-beta.0-1262-ge53b995",
|
||||
"Rev": "e53b99588a05d1f4ef172c178d4ed8e8106b8be4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/coreos/etcd/etcdserver/etcdserverpb",
|
||||
"Comment": "v3.0.0-beta.0-1262-ge53b995",
|
||||
"Rev": "e53b99588a05d1f4ef172c178d4ed8e8106b8be4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/coreos/etcd/mvcc/mvccpb",
|
||||
"Comment": "v3.0.0-beta.0-1262-ge53b995",
|
||||
"Rev": "e53b99588a05d1f4ef172c178d4ed8e8106b8be4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/coreos/etcd/pkg/tlsutil",
|
||||
"Comment": "v3.0.0-beta.0-1262-ge53b995",
|
||||
"Rev": "e53b99588a05d1f4ef172c178d4ed8e8106b8be4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/gengo/grpc-gateway/runtime",
|
||||
"Rev": "04d03d2c0176f9060cc3da4945a71abc759648bc"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/gengo/grpc-gateway/runtime/internal",
|
||||
"Rev": "04d03d2c0176f9060cc3da4945a71abc759648bc"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/gengo/grpc-gateway/utilities",
|
||||
"Rev": "04d03d2c0176f9060cc3da4945a71abc759648bc"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/ghodss/yaml",
|
||||
"Rev": "1a6f069841556a7bcaff4a397ca6e8328d266c2f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/go-sql-driver/mysql",
|
||||
"Comment": "v1.2-118-g3dd7008",
|
||||
"Rev": "3dd7008ac1529aca1bcd8a9db75228a71ba23cac"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/gogo/protobuf/proto",
|
||||
"Comment": "v0.2-13-gc3995ae",
|
||||
"Rev": "c3995ae437bb78d1189f4f147dfe5f87ad3596e4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/golang/protobuf/jsonpb",
|
||||
"Rev": "3852dcfda249c2097355a6aabb199a28d97b30df"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/golang/protobuf/proto",
|
||||
"Rev": "3852dcfda249c2097355a6aabb199a28d97b30df"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/golang/snappy",
|
||||
"Rev": "723cc1e459b8eea2dea4583200fd60757d40097a"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/juju/errors",
|
||||
"Rev": "b2c7a7da5b2995941048f60146e67702a292e468"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/ngaut/deadline",
|
||||
"Rev": "fae8f9dfd7048de16575b9d4c255278e38c28a4f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/ngaut/log",
|
||||
"Rev": "cec23d3e10b016363780d894a0eb732a12c06e02"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/ngaut/pools",
|
||||
"Rev": "6352e005618615ffaf1cb1c6622b8e91435751fe"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/ngaut/sync2",
|
||||
"Rev": "7a24ed77b2efb460c1468b7dc917821c66e80e55"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/petar/GoLLRB/llrb",
|
||||
"Rev": "53be0d36a84c2a886ca057d34b6aa4468df9ccb4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/peterh/liner",
|
||||
"Rev": "3f3a91ddf7d2784892a58e27ddf48d70e3304bb7"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/check",
|
||||
"Rev": "ce8a2f822ab1e245a4eefcef2996531c79c943f1"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/goleveldb/leveldb",
|
||||
"Rev": "c131135d59a38f4212f627cde570dddfe5261c43"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/goleveldb/leveldb/cache",
|
||||
"Rev": "c131135d59a38f4212f627cde570dddfe5261c43"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/goleveldb/leveldb/comparer",
|
||||
"Rev": "c131135d59a38f4212f627cde570dddfe5261c43"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/goleveldb/leveldb/errors",
|
||||
"Rev": "c131135d59a38f4212f627cde570dddfe5261c43"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/goleveldb/leveldb/filter",
|
||||
"Rev": "c131135d59a38f4212f627cde570dddfe5261c43"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/goleveldb/leveldb/iterator",
|
||||
"Rev": "c131135d59a38f4212f627cde570dddfe5261c43"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/goleveldb/leveldb/journal",
|
||||
"Rev": "c131135d59a38f4212f627cde570dddfe5261c43"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/goleveldb/leveldb/memdb",
|
||||
"Rev": "c131135d59a38f4212f627cde570dddfe5261c43"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/goleveldb/leveldb/opt",
|
||||
"Rev": "c131135d59a38f4212f627cde570dddfe5261c43"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/goleveldb/leveldb/storage",
|
||||
"Rev": "c131135d59a38f4212f627cde570dddfe5261c43"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/goleveldb/leveldb/table",
|
||||
"Rev": "c131135d59a38f4212f627cde570dddfe5261c43"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/goleveldb/leveldb/util",
|
||||
"Rev": "c131135d59a38f4212f627cde570dddfe5261c43"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/kvproto/pkg/coprocessor",
|
||||
"Rev": "294d57c6b301fcf3f64edcc2ee1a988308169ffc"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/kvproto/pkg/errorpb",
|
||||
"Rev": "294d57c6b301fcf3f64edcc2ee1a988308169ffc"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/kvproto/pkg/eraftpb",
|
||||
"Rev": "294d57c6b301fcf3f64edcc2ee1a988308169ffc"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/kvproto/pkg/kvrpcpb",
|
||||
"Rev": "294d57c6b301fcf3f64edcc2ee1a988308169ffc"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/kvproto/pkg/metapb",
|
||||
"Rev": "294d57c6b301fcf3f64edcc2ee1a988308169ffc"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/kvproto/pkg/msgpb",
|
||||
"Rev": "294d57c6b301fcf3f64edcc2ee1a988308169ffc"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/kvproto/pkg/pdpb",
|
||||
"Rev": "294d57c6b301fcf3f64edcc2ee1a988308169ffc"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/kvproto/pkg/raft_cmdpb",
|
||||
"Rev": "294d57c6b301fcf3f64edcc2ee1a988308169ffc"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/kvproto/pkg/raft_serverpb",
|
||||
"Rev": "294d57c6b301fcf3f64edcc2ee1a988308169ffc"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/kvproto/pkg/util",
|
||||
"Rev": "294d57c6b301fcf3f64edcc2ee1a988308169ffc"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/pd-client",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/tipb/go-binlog",
|
||||
"Rev": "c3409ad509cfadfe2318739bade8fe8c7f4e000e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/tipb/go-tipb",
|
||||
"Rev": "c3409ad509cfadfe2318739bade8fe8c7f4e000e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/twinj/uuid",
|
||||
"Rev": "70cac2bcd273ef6a371bb96cde363d28b68734c3"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/net/context",
|
||||
"Rev": "b797637b7aeeed133049c7281bfa31dcc9ca42d6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/net/http2",
|
||||
"Rev": "b797637b7aeeed133049c7281bfa31dcc9ca42d6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/net/http2/hpack",
|
||||
"Rev": "b797637b7aeeed133049c7281bfa31dcc9ca42d6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/net/internal/timeseries",
|
||||
"Rev": "b797637b7aeeed133049c7281bfa31dcc9ca42d6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/net/trace",
|
||||
"Rev": "b797637b7aeeed133049c7281bfa31dcc9ca42d6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/text/encoding",
|
||||
"Rev": "723492b65e225eafcba054e76ba18bb9c5ac1ea2"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/text/encoding/charmap",
|
||||
"Rev": "723492b65e225eafcba054e76ba18bb9c5ac1ea2"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/text/encoding/internal",
|
||||
"Rev": "723492b65e225eafcba054e76ba18bb9c5ac1ea2"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/text/encoding/internal/identifier",
|
||||
"Rev": "723492b65e225eafcba054e76ba18bb9c5ac1ea2"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/text/encoding/japanese",
|
||||
"Rev": "723492b65e225eafcba054e76ba18bb9c5ac1ea2"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/text/encoding/korean",
|
||||
"Rev": "723492b65e225eafcba054e76ba18bb9c5ac1ea2"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/text/encoding/simplifiedchinese",
|
||||
"Rev": "723492b65e225eafcba054e76ba18bb9c5ac1ea2"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/text/encoding/traditionalchinese",
|
||||
"Rev": "723492b65e225eafcba054e76ba18bb9c5ac1ea2"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/text/encoding/unicode",
|
||||
"Rev": "723492b65e225eafcba054e76ba18bb9c5ac1ea2"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/text/transform",
|
||||
"Rev": "723492b65e225eafcba054e76ba18bb9c5ac1ea2"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/grpc",
|
||||
"Comment": "v1.0.1-GA-29-g79b7c34",
|
||||
"Rev": "79b7c349179cdd6efd8bac4a1ce7f01b98c16e9b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/grpc/codes",
|
||||
"Comment": "v1.0.1-GA-29-g79b7c34",
|
||||
"Rev": "79b7c349179cdd6efd8bac4a1ce7f01b98c16e9b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/grpc/credentials",
|
||||
"Comment": "v1.0.1-GA-29-g79b7c34",
|
||||
"Rev": "79b7c349179cdd6efd8bac4a1ce7f01b98c16e9b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/grpc/grpclog",
|
||||
"Comment": "v1.0.1-GA-29-g79b7c34",
|
||||
"Rev": "79b7c349179cdd6efd8bac4a1ce7f01b98c16e9b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/grpc/internal",
|
||||
"Comment": "v1.0.1-GA-29-g79b7c34",
|
||||
"Rev": "79b7c349179cdd6efd8bac4a1ce7f01b98c16e9b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/grpc/metadata",
|
||||
"Comment": "v1.0.1-GA-29-g79b7c34",
|
||||
"Rev": "79b7c349179cdd6efd8bac4a1ce7f01b98c16e9b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/grpc/naming",
|
||||
"Comment": "v1.0.1-GA-29-g79b7c34",
|
||||
"Rev": "79b7c349179cdd6efd8bac4a1ce7f01b98c16e9b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/grpc/peer",
|
||||
"Comment": "v1.0.1-GA-29-g79b7c34",
|
||||
"Rev": "79b7c349179cdd6efd8bac4a1ce7f01b98c16e9b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/grpc/transport",
|
||||
"Comment": "v1.0.1-GA-29-g79b7c34",
|
||||
"Rev": "79b7c349179cdd6efd8bac4a1ce7f01b98c16e9b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/ngaut/systimemon",
|
||||
"Rev": "c2ca1c75c6af5556eb6ce67994120adf12f2ccef"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/cznic/mathutil",
|
||||
"Rev": "78ad7f262603437f0ecfebc835d80094f89c8f54"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/cznic/parser/yacc",
|
||||
"Rev": "31edd927e5b19d1c4a260c41a397e7f81d6694d9"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/cznic/sortutil",
|
||||
"Rev": "4c7342852e65c2088c981288f2c5610d10b9f7f4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/cznic/strutil",
|
||||
"Rev": "1eb03e3cc9d345307a45ec82bd3016cde4bd4464"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/cznic/y",
|
||||
"Rev": "9fdf92d4aac058959f814606bb729ed50f5e4240"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/grpc-ecosystem/grpc-gateway/runtime",
|
||||
"Comment": "v1.1.0-2-gc8ec92d",
|
||||
"Rev": "c8ec92d0481dd77d9b8c1808eb6476d190aa039a"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/grpc-ecosystem/grpc-gateway/utilities",
|
||||
"Comment": "v1.1.0-2-gc8ec92d",
|
||||
"Rev": "c8ec92d0481dd77d9b8c1808eb6476d190aa039a"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/grpc-ecosystem/grpc-gateway/runtime/internal",
|
||||
"Comment": "v1.1.0-2-gc8ec92d",
|
||||
"Rev": "c8ec92d0481dd77d9b8c1808eb6476d190aa039a"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/beorn7/perks/quantile",
|
||||
"Rev": "3ac7bf7a47d159a033b107610db8a1b6575507a4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/matttproud/golang_protobuf_extensions/pbutil",
|
||||
"Comment": "v1.0.0-2-gc12348c",
|
||||
"Rev": "c12348ce28de40eed0136aa2b644d0ee0650e56c"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/prometheus/client_golang/prometheus",
|
||||
"Comment": "v0.8.0-7-g5636dc6",
|
||||
"Rev": "5636dc67ae776adf5590da7349e70fbb9559972d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/prometheus/client_golang/prometheus/push",
|
||||
"Comment": "v0.8.0-7-g5636dc6",
|
||||
"Rev": "5636dc67ae776adf5590da7349e70fbb9559972d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/prometheus/client_model/go",
|
||||
"Comment": "model-0.0.2-12-gfa8ad6f",
|
||||
"Rev": "fa8ad6fec33561be4280a8f0514318c79d7f6cb6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/prometheus/common/expfmt",
|
||||
"Rev": "9a94032291f2192936512bab367bc45e77990d6a"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/prometheus/common/model",
|
||||
"Rev": "9a94032291f2192936512bab367bc45e77990d6a"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/prometheus/procfs",
|
||||
"Rev": "abf152e5f3e97f2fafac028d2cc06c1feb87ffa5"
|
||||
},
|
||||
{
|
||||
"ImportPath": "bitbucket.org/ww/goautoneg",
|
||||
"Comment": "null-5",
|
||||
"Rev": "'75cd24fc2f2c2a2088577d12123ddee5f54e0675'"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg",
|
||||
"Rev": "9a94032291f2192936512bab367bc45e77990d6a"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/cznic/golex/lex",
|
||||
"Rev": "da5a7153a51074477ecac5c45a7e5182a0c72448"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/coreos/etcd/clientv3",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/juju/errors",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/ngaut/deadline",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/ngaut/log",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/pingcap/kvproto/pkg/metapb",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/pingcap/kvproto/pkg/msgpb",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/pingcap/kvproto/pkg/pdpb",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/pingcap/kvproto/pkg/util",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/pkg/metrics",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/prometheus/client_golang/prometheus",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/twinj/uuid",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/golang.org/x/net/context",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/coreos/etcd/auth/authpb",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/coreos/etcd/mvcc/mvccpb",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/coreos/etcd/pkg/tlsutil",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/ghodss/yaml",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/google.golang.org/grpc",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/google.golang.org/grpc/codes",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/google.golang.org/grpc/credentials",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/google.golang.org/grpc/grpclog",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/google.golang.org/grpc/metadata",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/golang/protobuf/proto",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/pingcap/kvproto/pkg/coprocessor",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/pingcap/kvproto/pkg/kvrpcpb",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/pingcap/kvproto/pkg/raft_cmdpb",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/pingcap/kvproto/pkg/raft_serverpb",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/pingcap/kvproto/pkg/eraftpb",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/beorn7/perks/quantile",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/prometheus/client_model/go",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/prometheus/common/expfmt",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/prometheus/procfs",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/cloudfoundry-incubator/candiedyaml",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/golang.org/x/net/http2",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/golang.org/x/net/trace",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/google.golang.org/grpc/internal",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/google.golang.org/grpc/naming",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/google.golang.org/grpc/transport",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/pingcap/kvproto/pkg/errorpb",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/prometheus/common/model",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/golang/protobuf/jsonpb",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/internal",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/golang.org/x/net/http2/hpack",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/golang.org/x/net/lex/httplex",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/golang.org/x/net/internal/timeseries",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pingcap/pd/vendor/google.golang.org/grpc/peer",
|
||||
"Rev": "1bc8ea71f9e54d2eb1a8b8d4dae8c32394ce4477"
|
||||
}
|
||||
]
|
||||
}
|
||||
5
_vendor/Godeps/Readme
generated
5
_vendor/Godeps/Readme
generated
@ -1,5 +0,0 @@
|
||||
This directory tree is generated automatically by godep.
|
||||
|
||||
Please do not edit.
|
||||
|
||||
See https://github.com/tools/godep for more information.
|
||||
13
_vendor/vendor/bitbucket.org/ww/goautoneg/Makefile
generated
vendored
13
_vendor/vendor/bitbucket.org/ww/goautoneg/Makefile
generated
vendored
@ -1,13 +0,0 @@
|
||||
include $(GOROOT)/src/Make.inc
|
||||
|
||||
TARG=bitbucket.org/ww/goautoneg
|
||||
GOFILES=autoneg.go
|
||||
|
||||
include $(GOROOT)/src/Make.pkg
|
||||
|
||||
format:
|
||||
gofmt -w *.go
|
||||
|
||||
docs:
|
||||
gomake clean
|
||||
godoc ${TARG} > README.txt
|
||||
67
_vendor/vendor/bitbucket.org/ww/goautoneg/README.txt
generated
vendored
67
_vendor/vendor/bitbucket.org/ww/goautoneg/README.txt
generated
vendored
@ -1,67 +0,0 @@
|
||||
PACKAGE
|
||||
|
||||
package goautoneg
|
||||
import "bitbucket.org/ww/goautoneg"
|
||||
|
||||
HTTP Content-Type Autonegotiation.
|
||||
|
||||
The functions in this package implement the behaviour specified in
|
||||
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
|
||||
|
||||
Copyright (c) 2011, Open Knowledge Foundation Ltd.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
Neither the name of the Open Knowledge Foundation Ltd. nor the
|
||||
names of its contributors may be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
FUNCTIONS
|
||||
|
||||
func Negotiate(header string, alternatives []string) (content_type string)
|
||||
Negotiate the most appropriate content_type given the accept header
|
||||
and a list of alternatives.
|
||||
|
||||
func ParseAccept(header string) (accept []Accept)
|
||||
Parse an Accept Header string returning a sorted list
|
||||
of clauses
|
||||
|
||||
|
||||
TYPES
|
||||
|
||||
type Accept struct {
|
||||
Type, SubType string
|
||||
Q float32
|
||||
Params map[string]string
|
||||
}
|
||||
Structure to represent a clause in an HTTP Accept Header
|
||||
|
||||
|
||||
SUBDIRECTORIES
|
||||
|
||||
.hg
|
||||
2388
_vendor/vendor/github.com/beorn7/perks/quantile/exampledata.txt
generated
vendored
2388
_vendor/vendor/github.com/beorn7/perks/quantile/exampledata.txt
generated
vendored
File diff suppressed because it is too large
Load Diff
4
_vendor/vendor/github.com/boltdb/bolt/.gitignore
generated
vendored
4
_vendor/vendor/github.com/boltdb/bolt/.gitignore
generated
vendored
@ -1,4 +0,0 @@
|
||||
*.prof
|
||||
*.test
|
||||
*.swp
|
||||
/bin/
|
||||
18
_vendor/vendor/github.com/boltdb/bolt/Makefile
generated
vendored
18
_vendor/vendor/github.com/boltdb/bolt/Makefile
generated
vendored
@ -1,18 +0,0 @@
|
||||
BRANCH=`git rev-parse --abbrev-ref HEAD`
|
||||
COMMIT=`git rev-parse --short HEAD`
|
||||
GOLDFLAGS="-X main.branch $(BRANCH) -X main.commit $(COMMIT)"
|
||||
|
||||
default: build
|
||||
|
||||
race:
|
||||
@go test -v -race -test.run="TestSimulate_(100op|1000op)"
|
||||
|
||||
# go get github.com/kisielk/errcheck
|
||||
errcheck:
|
||||
@errcheck -ignorepkg=bytes -ignore=os:Remove github.com/boltdb/bolt
|
||||
|
||||
test:
|
||||
@go test -v -cover .
|
||||
@go test -v ./cmd/bolt
|
||||
|
||||
.PHONY: fmt test
|
||||
848
_vendor/vendor/github.com/boltdb/bolt/README.md
generated
vendored
848
_vendor/vendor/github.com/boltdb/bolt/README.md
generated
vendored
@ -1,848 +0,0 @@
|
||||
Bolt [](https://coveralls.io/r/boltdb/bolt?branch=master) [](https://godoc.org/github.com/boltdb/bolt) 
|
||||
====
|
||||
|
||||
Bolt is a pure Go key/value store inspired by [Howard Chu's][hyc_symas]
|
||||
[LMDB project][lmdb]. The goal of the project is to provide a simple,
|
||||
fast, and reliable database for projects that don't require a full database
|
||||
server such as Postgres or MySQL.
|
||||
|
||||
Since Bolt is meant to be used as such a low-level piece of functionality,
|
||||
simplicity is key. The API will be small and only focus on getting values
|
||||
and setting values. That's it.
|
||||
|
||||
[hyc_symas]: https://twitter.com/hyc_symas
|
||||
[lmdb]: http://symas.com/mdb/
|
||||
|
||||
## Project Status
|
||||
|
||||
Bolt is stable and the API is fixed. Full unit test coverage and randomized
|
||||
black box testing are used to ensure database consistency and thread safety.
|
||||
Bolt is currently in high-load production environments serving databases as
|
||||
large as 1TB. Many companies such as Shopify and Heroku use Bolt-backed
|
||||
services every day.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Getting Started](#getting-started)
|
||||
- [Installing](#installing)
|
||||
- [Opening a database](#opening-a-database)
|
||||
- [Transactions](#transactions)
|
||||
- [Read-write transactions](#read-write-transactions)
|
||||
- [Read-only transactions](#read-only-transactions)
|
||||
- [Batch read-write transactions](#batch-read-write-transactions)
|
||||
- [Managing transactions manually](#managing-transactions-manually)
|
||||
- [Using buckets](#using-buckets)
|
||||
- [Using key/value pairs](#using-keyvalue-pairs)
|
||||
- [Autoincrementing integer for the bucket](#autoincrementing-integer-for-the-bucket)
|
||||
- [Iterating over keys](#iterating-over-keys)
|
||||
- [Prefix scans](#prefix-scans)
|
||||
- [Range scans](#range-scans)
|
||||
- [ForEach()](#foreach)
|
||||
- [Nested buckets](#nested-buckets)
|
||||
- [Database backups](#database-backups)
|
||||
- [Statistics](#statistics)
|
||||
- [Read-Only Mode](#read-only-mode)
|
||||
- [Mobile Use (iOS/Android)](#mobile-use-iosandroid)
|
||||
- [Resources](#resources)
|
||||
- [Comparison with other databases](#comparison-with-other-databases)
|
||||
- [Postgres, MySQL, & other relational databases](#postgres-mysql--other-relational-databases)
|
||||
- [LevelDB, RocksDB](#leveldb-rocksdb)
|
||||
- [LMDB](#lmdb)
|
||||
- [Caveats & Limitations](#caveats--limitations)
|
||||
- [Reading the Source](#reading-the-source)
|
||||
- [Other Projects Using Bolt](#other-projects-using-bolt)
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Installing
|
||||
|
||||
To start using Bolt, install Go and run `go get`:
|
||||
|
||||
```sh
|
||||
$ go get github.com/boltdb/bolt/...
|
||||
```
|
||||
|
||||
This will retrieve the library and install the `bolt` command line utility into
|
||||
your `$GOBIN` path.
|
||||
|
||||
|
||||
### Opening a database
|
||||
|
||||
The top-level object in Bolt is a `DB`. It is represented as a single file on
|
||||
your disk and represents a consistent snapshot of your data.
|
||||
|
||||
To open your database, simply use the `bolt.Open()` function:
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Open the my.db data file in your current directory.
|
||||
// It will be created if it doesn't exist.
|
||||
db, err := bolt.Open("my.db", 0600, nil)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer db.Close()
|
||||
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Please note that Bolt obtains a file lock on the data file so multiple processes
|
||||
cannot open the same database at the same time. Opening an already open Bolt
|
||||
database will cause it to hang until the other process closes it. To prevent
|
||||
an indefinite wait you can pass a timeout option to the `Open()` function:
|
||||
|
||||
```go
|
||||
db, err := bolt.Open("my.db", 0600, &bolt.Options{Timeout: 1 * time.Second})
|
||||
```
|
||||
|
||||
|
||||
### Transactions
|
||||
|
||||
Bolt allows only one read-write transaction at a time but allows as many
|
||||
read-only transactions as you want at a time. Each transaction has a consistent
|
||||
view of the data as it existed when the transaction started.
|
||||
|
||||
Individual transactions and all objects created from them (e.g. buckets, keys)
|
||||
are not thread safe. To work with data in multiple goroutines you must start
|
||||
a transaction for each one or use locking to ensure only one goroutine accesses
|
||||
a transaction at a time. Creating transaction from the `DB` is thread safe.
|
||||
|
||||
Read-only transactions and read-write transactions should not depend on one
|
||||
another and generally shouldn't be opened simultaneously in the same goroutine.
|
||||
This can cause a deadlock as the read-write transaction needs to periodically
|
||||
re-map the data file but it cannot do so while a read-only transaction is open.
|
||||
|
||||
|
||||
#### Read-write transactions
|
||||
|
||||
To start a read-write transaction, you can use the `DB.Update()` function:
|
||||
|
||||
```go
|
||||
err := db.Update(func(tx *bolt.Tx) error {
|
||||
...
|
||||
return nil
|
||||
})
|
||||
```
|
||||
|
||||
Inside the closure, you have a consistent view of the database. You commit the
|
||||
transaction by returning `nil` at the end. You can also rollback the transaction
|
||||
at any point by returning an error. All database operations are allowed inside
|
||||
a read-write transaction.
|
||||
|
||||
Always check the return error as it will report any disk failures that can cause
|
||||
your transaction to not complete. If you return an error within your closure
|
||||
it will be passed through.
|
||||
|
||||
|
||||
#### Read-only transactions
|
||||
|
||||
To start a read-only transaction, you can use the `DB.View()` function:
|
||||
|
||||
```go
|
||||
err := db.View(func(tx *bolt.Tx) error {
|
||||
...
|
||||
return nil
|
||||
})
|
||||
```
|
||||
|
||||
You also get a consistent view of the database within this closure, however,
|
||||
no mutating operations are allowed within a read-only transaction. You can only
|
||||
retrieve buckets, retrieve values, and copy the database within a read-only
|
||||
transaction.
|
||||
|
||||
|
||||
#### Batch read-write transactions
|
||||
|
||||
Each `DB.Update()` waits for disk to commit the writes. This overhead
|
||||
can be minimized by combining multiple updates with the `DB.Batch()`
|
||||
function:
|
||||
|
||||
```go
|
||||
err := db.Batch(func(tx *bolt.Tx) error {
|
||||
...
|
||||
return nil
|
||||
})
|
||||
```
|
||||
|
||||
Concurrent Batch calls are opportunistically combined into larger
|
||||
transactions. Batch is only useful when there are multiple goroutines
|
||||
calling it.
|
||||
|
||||
The trade-off is that `Batch` can call the given
|
||||
function multiple times, if parts of the transaction fail. The
|
||||
function must be idempotent and side effects must take effect only
|
||||
after a successful return from `DB.Batch()`.
|
||||
|
||||
For example: don't display messages from inside the function, instead
|
||||
set variables in the enclosing scope:
|
||||
|
||||
```go
|
||||
var id uint64
|
||||
err := db.Batch(func(tx *bolt.Tx) error {
|
||||
// Find last key in bucket, decode as bigendian uint64, increment
|
||||
// by one, encode back to []byte, and add new key.
|
||||
...
|
||||
id = newValue
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return ...
|
||||
}
|
||||
fmt.Println("Allocated ID %d", id)
|
||||
```
|
||||
|
||||
|
||||
#### Managing transactions manually
|
||||
|
||||
The `DB.View()` and `DB.Update()` functions are wrappers around the `DB.Begin()`
|
||||
function. These helper functions will start the transaction, execute a function,
|
||||
and then safely close your transaction if an error is returned. This is the
|
||||
recommended way to use Bolt transactions.
|
||||
|
||||
However, sometimes you may want to manually start and end your transactions.
|
||||
You can use the `Tx.Begin()` function directly but **please** be sure to close
|
||||
the transaction.
|
||||
|
||||
```go
|
||||
// Start a writable transaction.
|
||||
tx, err := db.Begin(true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer tx.Rollback()
|
||||
|
||||
// Use the transaction...
|
||||
_, err := tx.CreateBucket([]byte("MyBucket"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Commit the transaction and check for error.
|
||||
if err := tx.Commit(); err != nil {
|
||||
return err
|
||||
}
|
||||
```
|
||||
|
||||
The first argument to `DB.Begin()` is a boolean stating if the transaction
|
||||
should be writable.
|
||||
|
||||
|
||||
### Using buckets
|
||||
|
||||
Buckets are collections of key/value pairs within the database. All keys in a
|
||||
bucket must be unique. You can create a bucket using the `DB.CreateBucket()`
|
||||
function:
|
||||
|
||||
```go
|
||||
db.Update(func(tx *bolt.Tx) error {
|
||||
b, err := tx.CreateBucket([]byte("MyBucket"))
|
||||
if err != nil {
|
||||
return fmt.Errorf("create bucket: %s", err)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
```
|
||||
|
||||
You can also create a bucket only if it doesn't exist by using the
|
||||
`Tx.CreateBucketIfNotExists()` function. It's a common pattern to call this
|
||||
function for all your top-level buckets after you open your database so you can
|
||||
guarantee that they exist for future transactions.
|
||||
|
||||
To delete a bucket, simply call the `Tx.DeleteBucket()` function.
|
||||
|
||||
|
||||
### Using key/value pairs
|
||||
|
||||
To save a key/value pair to a bucket, use the `Bucket.Put()` function:
|
||||
|
||||
```go
|
||||
db.Update(func(tx *bolt.Tx) error {
|
||||
b := tx.Bucket([]byte("MyBucket"))
|
||||
err := b.Put([]byte("answer"), []byte("42"))
|
||||
return err
|
||||
})
|
||||
```
|
||||
|
||||
This will set the value of the `"answer"` key to `"42"` in the `MyBucket`
|
||||
bucket. To retrieve this value, we can use the `Bucket.Get()` function:
|
||||
|
||||
```go
|
||||
db.View(func(tx *bolt.Tx) error {
|
||||
b := tx.Bucket([]byte("MyBucket"))
|
||||
v := b.Get([]byte("answer"))
|
||||
fmt.Printf("The answer is: %s\n", v)
|
||||
return nil
|
||||
})
|
||||
```
|
||||
|
||||
The `Get()` function does not return an error because its operation is
|
||||
guaranteed to work (unless there is some kind of system failure). If the key
|
||||
exists then it will return its byte slice value. If it doesn't exist then it
|
||||
will return `nil`. It's important to note that you can have a zero-length value
|
||||
set to a key which is different than the key not existing.
|
||||
|
||||
Use the `Bucket.Delete()` function to delete a key from the bucket.
|
||||
|
||||
Please note that values returned from `Get()` are only valid while the
|
||||
transaction is open. If you need to use a value outside of the transaction
|
||||
then you must use `copy()` to copy it to another byte slice.
|
||||
|
||||
|
||||
### Autoincrementing integer for the bucket
|
||||
By using the `NextSequence()` function, you can let Bolt determine a sequence
|
||||
which can be used as the unique identifier for your key/value pairs. See the
|
||||
example below.
|
||||
|
||||
```go
|
||||
// CreateUser saves u to the store. The new user ID is set on u once the data is persisted.
|
||||
func (s *Store) CreateUser(u *User) error {
|
||||
return s.db.Update(func(tx *bolt.Tx) error {
|
||||
// Retrieve the users bucket.
|
||||
// This should be created when the DB is first opened.
|
||||
b := tx.Bucket([]byte("users"))
|
||||
|
||||
// Generate ID for the user.
|
||||
// This returns an error only if the Tx is closed or not writeable.
|
||||
// That can't happen in an Update() call so I ignore the error check.
|
||||
id, _ = b.NextSequence()
|
||||
u.ID = int(id)
|
||||
|
||||
// Marshal user data into bytes.
|
||||
buf, err := json.Marshal(u)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Persist bytes to users bucket.
|
||||
return b.Put(itob(u.ID), buf)
|
||||
})
|
||||
}
|
||||
|
||||
// itob returns an 8-byte big endian representation of v.
|
||||
func itob(v int) []byte {
|
||||
b := make([]byte, 8)
|
||||
binary.BigEndian.PutUint64(b, uint64(v))
|
||||
return b
|
||||
}
|
||||
|
||||
type User struct {
|
||||
ID int
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
### Iterating over keys
|
||||
|
||||
Bolt stores its keys in byte-sorted order within a bucket. This makes sequential
|
||||
iteration over these keys extremely fast. To iterate over keys we'll use a
|
||||
`Cursor`:
|
||||
|
||||
```go
|
||||
db.View(func(tx *bolt.Tx) error {
|
||||
// Assume bucket exists and has keys
|
||||
b := tx.Bucket([]byte("MyBucket"))
|
||||
|
||||
c := b.Cursor()
|
||||
|
||||
for k, v := c.First(); k != nil; k, v = c.Next() {
|
||||
fmt.Printf("key=%s, value=%s\n", k, v)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
```
|
||||
|
||||
The cursor allows you to move to a specific point in the list of keys and move
|
||||
forward or backward through the keys one at a time.
|
||||
|
||||
The following functions are available on the cursor:
|
||||
|
||||
```
|
||||
First() Move to the first key.
|
||||
Last() Move to the last key.
|
||||
Seek() Move to a specific key.
|
||||
Next() Move to the next key.
|
||||
Prev() Move to the previous key.
|
||||
```
|
||||
|
||||
Each of those functions has a return signature of `(key []byte, value []byte)`.
|
||||
When you have iterated to the end of the cursor then `Next()` will return a
|
||||
`nil` key. You must seek to a position using `First()`, `Last()`, or `Seek()`
|
||||
before calling `Next()` or `Prev()`. If you do not seek to a position then
|
||||
these functions will return a `nil` key.
|
||||
|
||||
During iteration, if the key is non-`nil` but the value is `nil`, that means
|
||||
the key refers to a bucket rather than a value. Use `Bucket.Bucket()` to
|
||||
access the sub-bucket.
|
||||
|
||||
|
||||
#### Prefix scans
|
||||
|
||||
To iterate over a key prefix, you can combine `Seek()` and `bytes.HasPrefix()`:
|
||||
|
||||
```go
|
||||
db.View(func(tx *bolt.Tx) error {
|
||||
// Assume bucket exists and has keys
|
||||
c := tx.Bucket([]byte("MyBucket")).Cursor()
|
||||
|
||||
prefix := []byte("1234")
|
||||
for k, v := c.Seek(prefix); bytes.HasPrefix(k, prefix); k, v = c.Next() {
|
||||
fmt.Printf("key=%s, value=%s\n", k, v)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
```
|
||||
|
||||
#### Range scans
|
||||
|
||||
Another common use case is scanning over a range such as a time range. If you
|
||||
use a sortable time encoding such as RFC3339 then you can query a specific
|
||||
date range like this:
|
||||
|
||||
```go
|
||||
db.View(func(tx *bolt.Tx) error {
|
||||
// Assume our events bucket exists and has RFC3339 encoded time keys.
|
||||
c := tx.Bucket([]byte("Events")).Cursor()
|
||||
|
||||
// Our time range spans the 90's decade.
|
||||
min := []byte("1990-01-01T00:00:00Z")
|
||||
max := []byte("2000-01-01T00:00:00Z")
|
||||
|
||||
// Iterate over the 90's.
|
||||
for k, v := c.Seek(min); k != nil && bytes.Compare(k, max) <= 0; k, v = c.Next() {
|
||||
fmt.Printf("%s: %s\n", k, v)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
```
|
||||
|
||||
Note that, while RFC3339 is sortable, the Golang implementation of RFC3339Nano does not use a fixed number of digits after the decimal point and is therefore not sortable.
|
||||
|
||||
|
||||
#### ForEach()
|
||||
|
||||
You can also use the function `ForEach()` if you know you'll be iterating over
|
||||
all the keys in a bucket:
|
||||
|
||||
```go
|
||||
db.View(func(tx *bolt.Tx) error {
|
||||
// Assume bucket exists and has keys
|
||||
b := tx.Bucket([]byte("MyBucket"))
|
||||
|
||||
b.ForEach(func(k, v []byte) error {
|
||||
fmt.Printf("key=%s, value=%s\n", k, v)
|
||||
return nil
|
||||
})
|
||||
return nil
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
### Nested buckets
|
||||
|
||||
You can also store a bucket in a key to create nested buckets. The API is the
|
||||
same as the bucket management API on the `DB` object:
|
||||
|
||||
```go
|
||||
func (*Bucket) CreateBucket(key []byte) (*Bucket, error)
|
||||
func (*Bucket) CreateBucketIfNotExists(key []byte) (*Bucket, error)
|
||||
func (*Bucket) DeleteBucket(key []byte) error
|
||||
```
|
||||
|
||||
|
||||
### Database backups
|
||||
|
||||
Bolt is a single file so it's easy to backup. You can use the `Tx.WriteTo()`
|
||||
function to write a consistent view of the database to a writer. If you call
|
||||
this from a read-only transaction, it will perform a hot backup and not block
|
||||
your other database reads and writes.
|
||||
|
||||
By default, it will use a regular file handle which will utilize the operating
|
||||
system's page cache. See the [`Tx`](https://godoc.org/github.com/boltdb/bolt#Tx)
|
||||
documentation for information about optimizing for larger-than-RAM datasets.
|
||||
|
||||
One common use case is to backup over HTTP so you can use tools like `cURL` to
|
||||
do database backups:
|
||||
|
||||
```go
|
||||
func BackupHandleFunc(w http.ResponseWriter, req *http.Request) {
|
||||
err := db.View(func(tx *bolt.Tx) error {
|
||||
w.Header().Set("Content-Type", "application/octet-stream")
|
||||
w.Header().Set("Content-Disposition", `attachment; filename="my.db"`)
|
||||
w.Header().Set("Content-Length", strconv.Itoa(int(tx.Size())))
|
||||
_, err := tx.WriteTo(w)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Then you can backup using this command:
|
||||
|
||||
```sh
|
||||
$ curl http://localhost/backup > my.db
|
||||
```
|
||||
|
||||
Or you can open your browser to `http://localhost/backup` and it will download
|
||||
automatically.
|
||||
|
||||
If you want to backup to another file you can use the `Tx.CopyFile()` helper
|
||||
function.
|
||||
|
||||
|
||||
### Statistics
|
||||
|
||||
The database keeps a running count of many of the internal operations it
|
||||
performs so you can better understand what's going on. By grabbing a snapshot
|
||||
of these stats at two points in time we can see what operations were performed
|
||||
in that time range.
|
||||
|
||||
For example, we could start a goroutine to log stats every 10 seconds:
|
||||
|
||||
```go
|
||||
go func() {
|
||||
// Grab the initial stats.
|
||||
prev := db.Stats()
|
||||
|
||||
for {
|
||||
// Wait for 10s.
|
||||
time.Sleep(10 * time.Second)
|
||||
|
||||
// Grab the current stats and diff them.
|
||||
stats := db.Stats()
|
||||
diff := stats.Sub(&prev)
|
||||
|
||||
// Encode stats to JSON and print to STDERR.
|
||||
json.NewEncoder(os.Stderr).Encode(diff)
|
||||
|
||||
// Save stats for the next loop.
|
||||
prev = stats
|
||||
}
|
||||
}()
|
||||
```
|
||||
|
||||
It's also useful to pipe these stats to a service such as statsd for monitoring
|
||||
or to provide an HTTP endpoint that will perform a fixed-length sample.
|
||||
|
||||
|
||||
### Read-Only Mode
|
||||
|
||||
Sometimes it is useful to create a shared, read-only Bolt database. To this,
|
||||
set the `Options.ReadOnly` flag when opening your database. Read-only mode
|
||||
uses a shared lock to allow multiple processes to read from the database but
|
||||
it will block any processes from opening the database in read-write mode.
|
||||
|
||||
```go
|
||||
db, err := bolt.Open("my.db", 0666, &bolt.Options{ReadOnly: true})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
```
|
||||
|
||||
### Mobile Use (iOS/Android)
|
||||
|
||||
Bolt is able to run on mobile devices by leveraging the binding feature of the
|
||||
[gomobile](https://github.com/golang/mobile) tool. Create a struct that will
|
||||
contain your database logic and a reference to a `*bolt.DB` with a initializing
|
||||
contstructor that takes in a filepath where the database file will be stored.
|
||||
Neither Android nor iOS require extra permissions or cleanup from using this method.
|
||||
|
||||
```go
|
||||
func NewBoltDB(filepath string) *BoltDB {
|
||||
db, err := bolt.Open(filepath+"/demo.db", 0600, nil)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return &BoltDB{db}
|
||||
}
|
||||
|
||||
type BoltDB struct {
|
||||
db *bolt.DB
|
||||
...
|
||||
}
|
||||
|
||||
func (b *BoltDB) Path() string {
|
||||
return b.db.Path()
|
||||
}
|
||||
|
||||
func (b *BoltDB) Close() {
|
||||
b.db.Close()
|
||||
}
|
||||
```
|
||||
|
||||
Database logic should be defined as methods on this wrapper struct.
|
||||
|
||||
To initialize this struct from the native language (both platforms now sync
|
||||
their local storage to the cloud. These snippets disable that functionality for the
|
||||
database file):
|
||||
|
||||
#### Android
|
||||
|
||||
```java
|
||||
String path;
|
||||
if (android.os.Build.VERSION.SDK_INT >=android.os.Build.VERSION_CODES.LOLLIPOP){
|
||||
path = getNoBackupFilesDir().getAbsolutePath();
|
||||
} else{
|
||||
path = getFilesDir().getAbsolutePath();
|
||||
}
|
||||
Boltmobiledemo.BoltDB boltDB = Boltmobiledemo.NewBoltDB(path)
|
||||
```
|
||||
|
||||
#### iOS
|
||||
|
||||
```objc
|
||||
- (void)demo {
|
||||
NSString* path = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
|
||||
NSUserDomainMask,
|
||||
YES) objectAtIndex:0];
|
||||
GoBoltmobiledemoBoltDB * demo = GoBoltmobiledemoNewBoltDB(path);
|
||||
[self addSkipBackupAttributeToItemAtPath:demo.path];
|
||||
//Some DB Logic would go here
|
||||
[demo close];
|
||||
}
|
||||
|
||||
- (BOOL)addSkipBackupAttributeToItemAtPath:(NSString *) filePathString
|
||||
{
|
||||
NSURL* URL= [NSURL fileURLWithPath: filePathString];
|
||||
assert([[NSFileManager defaultManager] fileExistsAtPath: [URL path]]);
|
||||
|
||||
NSError *error = nil;
|
||||
BOOL success = [URL setResourceValue: [NSNumber numberWithBool: YES]
|
||||
forKey: NSURLIsExcludedFromBackupKey error: &error];
|
||||
if(!success){
|
||||
NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
For more information on getting started with Bolt, check out the following articles:
|
||||
|
||||
* [Intro to BoltDB: Painless Performant Persistence](http://npf.io/2014/07/intro-to-boltdb-painless-performant-persistence/) by [Nate Finch](https://github.com/natefinch).
|
||||
* [Bolt -- an embedded key/value database for Go](https://www.progville.com/go/bolt-embedded-db-golang/) by Progville
|
||||
|
||||
|
||||
## Comparison with other databases
|
||||
|
||||
### Postgres, MySQL, & other relational databases
|
||||
|
||||
Relational databases structure data into rows and are only accessible through
|
||||
the use of SQL. This approach provides flexibility in how you store and query
|
||||
your data but also incurs overhead in parsing and planning SQL statements. Bolt
|
||||
accesses all data by a byte slice key. This makes Bolt fast to read and write
|
||||
data by key but provides no built-in support for joining values together.
|
||||
|
||||
Most relational databases (with the exception of SQLite) are standalone servers
|
||||
that run separately from your application. This gives your systems
|
||||
flexibility to connect multiple application servers to a single database
|
||||
server but also adds overhead in serializing and transporting data over the
|
||||
network. Bolt runs as a library included in your application so all data access
|
||||
has to go through your application's process. This brings data closer to your
|
||||
application but limits multi-process access to the data.
|
||||
|
||||
|
||||
### LevelDB, RocksDB
|
||||
|
||||
LevelDB and its derivatives (RocksDB, HyperLevelDB) are similar to Bolt in that
|
||||
they are libraries bundled into the application, however, their underlying
|
||||
structure is a log-structured merge-tree (LSM tree). An LSM tree optimizes
|
||||
random writes by using a write ahead log and multi-tiered, sorted files called
|
||||
SSTables. Bolt uses a B+tree internally and only a single file. Both approaches
|
||||
have trade-offs.
|
||||
|
||||
If you require a high random write throughput (>10,000 w/sec) or you need to use
|
||||
spinning disks then LevelDB could be a good choice. If your application is
|
||||
read-heavy or does a lot of range scans then Bolt could be a good choice.
|
||||
|
||||
One other important consideration is that LevelDB does not have transactions.
|
||||
It supports batch writing of key/values pairs and it supports read snapshots
|
||||
but it will not give you the ability to do a compare-and-swap operation safely.
|
||||
Bolt supports fully serializable ACID transactions.
|
||||
|
||||
|
||||
### LMDB
|
||||
|
||||
Bolt was originally a port of LMDB so it is architecturally similar. Both use
|
||||
a B+tree, have ACID semantics with fully serializable transactions, and support
|
||||
lock-free MVCC using a single writer and multiple readers.
|
||||
|
||||
The two projects have somewhat diverged. LMDB heavily focuses on raw performance
|
||||
while Bolt has focused on simplicity and ease of use. For example, LMDB allows
|
||||
several unsafe actions such as direct writes for the sake of performance. Bolt
|
||||
opts to disallow actions which can leave the database in a corrupted state. The
|
||||
only exception to this in Bolt is `DB.NoSync`.
|
||||
|
||||
There are also a few differences in API. LMDB requires a maximum mmap size when
|
||||
opening an `mdb_env` whereas Bolt will handle incremental mmap resizing
|
||||
automatically. LMDB overloads the getter and setter functions with multiple
|
||||
flags whereas Bolt splits these specialized cases into their own functions.
|
||||
|
||||
|
||||
## Caveats & Limitations
|
||||
|
||||
It's important to pick the right tool for the job and Bolt is no exception.
|
||||
Here are a few things to note when evaluating and using Bolt:
|
||||
|
||||
* Bolt is good for read intensive workloads. Sequential write performance is
|
||||
also fast but random writes can be slow. You can use `DB.Batch()` or add a
|
||||
write-ahead log to help mitigate this issue.
|
||||
|
||||
* Bolt uses a B+tree internally so there can be a lot of random page access.
|
||||
SSDs provide a significant performance boost over spinning disks.
|
||||
|
||||
* Try to avoid long running read transactions. Bolt uses copy-on-write so
|
||||
old pages cannot be reclaimed while an old transaction is using them.
|
||||
|
||||
* Byte slices returned from Bolt are only valid during a transaction. Once the
|
||||
transaction has been committed or rolled back then the memory they point to
|
||||
can be reused by a new page or can be unmapped from virtual memory and you'll
|
||||
see an `unexpected fault address` panic when accessing it.
|
||||
|
||||
* Be careful when using `Bucket.FillPercent`. Setting a high fill percent for
|
||||
buckets that have random inserts will cause your database to have very poor
|
||||
page utilization.
|
||||
|
||||
* Use larger buckets in general. Smaller buckets causes poor page utilization
|
||||
once they become larger than the page size (typically 4KB).
|
||||
|
||||
* Bulk loading a lot of random writes into a new bucket can be slow as the
|
||||
page will not split until the transaction is committed. Randomly inserting
|
||||
more than 100,000 key/value pairs into a single new bucket in a single
|
||||
transaction is not advised.
|
||||
|
||||
* Bolt uses a memory-mapped file so the underlying operating system handles the
|
||||
caching of the data. Typically, the OS will cache as much of the file as it
|
||||
can in memory and will release memory as needed to other processes. This means
|
||||
that Bolt can show very high memory usage when working with large databases.
|
||||
However, this is expected and the OS will release memory as needed. Bolt can
|
||||
handle databases much larger than the available physical RAM, provided its
|
||||
memory-map fits in the process virtual address space. It may be problematic
|
||||
on 32-bits systems.
|
||||
|
||||
* The data structures in the Bolt database are memory mapped so the data file
|
||||
will be endian specific. This means that you cannot copy a Bolt file from a
|
||||
little endian machine to a big endian machine and have it work. For most
|
||||
users this is not a concern since most modern CPUs are little endian.
|
||||
|
||||
* Because of the way pages are laid out on disk, Bolt cannot truncate data files
|
||||
and return free pages back to the disk. Instead, Bolt maintains a free list
|
||||
of unused pages within its data file. These free pages can be reused by later
|
||||
transactions. This works well for many use cases as databases generally tend
|
||||
to grow. However, it's important to note that deleting large chunks of data
|
||||
will not allow you to reclaim that space on disk.
|
||||
|
||||
For more information on page allocation, [see this comment][page-allocation].
|
||||
|
||||
[page-allocation]: https://github.com/boltdb/bolt/issues/308#issuecomment-74811638
|
||||
|
||||
|
||||
## Reading the Source
|
||||
|
||||
Bolt is a relatively small code base (<3KLOC) for an embedded, serializable,
|
||||
transactional key/value database so it can be a good starting point for people
|
||||
interested in how databases work.
|
||||
|
||||
The best places to start are the main entry points into Bolt:
|
||||
|
||||
- `Open()` - Initializes the reference to the database. It's responsible for
|
||||
creating the database if it doesn't exist, obtaining an exclusive lock on the
|
||||
file, reading the meta pages, & memory-mapping the file.
|
||||
|
||||
- `DB.Begin()` - Starts a read-only or read-write transaction depending on the
|
||||
value of the `writable` argument. This requires briefly obtaining the "meta"
|
||||
lock to keep track of open transactions. Only one read-write transaction can
|
||||
exist at a time so the "rwlock" is acquired during the life of a read-write
|
||||
transaction.
|
||||
|
||||
- `Bucket.Put()` - Writes a key/value pair into a bucket. After validating the
|
||||
arguments, a cursor is used to traverse the B+tree to the page and position
|
||||
where they key & value will be written. Once the position is found, the bucket
|
||||
materializes the underlying page and the page's parent pages into memory as
|
||||
"nodes". These nodes are where mutations occur during read-write transactions.
|
||||
These changes get flushed to disk during commit.
|
||||
|
||||
- `Bucket.Get()` - Retrieves a key/value pair from a bucket. This uses a cursor
|
||||
to move to the page & position of a key/value pair. During a read-only
|
||||
transaction, the key and value data is returned as a direct reference to the
|
||||
underlying mmap file so there's no allocation overhead. For read-write
|
||||
transactions, this data may reference the mmap file or one of the in-memory
|
||||
node values.
|
||||
|
||||
- `Cursor` - This object is simply for traversing the B+tree of on-disk pages
|
||||
or in-memory nodes. It can seek to a specific key, move to the first or last
|
||||
value, or it can move forward or backward. The cursor handles the movement up
|
||||
and down the B+tree transparently to the end user.
|
||||
|
||||
- `Tx.Commit()` - Converts the in-memory dirty nodes and the list of free pages
|
||||
into pages to be written to disk. Writing to disk then occurs in two phases.
|
||||
First, the dirty pages are written to disk and an `fsync()` occurs. Second, a
|
||||
new meta page with an incremented transaction ID is written and another
|
||||
`fsync()` occurs. This two phase write ensures that partially written data
|
||||
pages are ignored in the event of a crash since the meta page pointing to them
|
||||
is never written. Partially written meta pages are invalidated because they
|
||||
are written with a checksum.
|
||||
|
||||
If you have additional notes that could be helpful for others, please submit
|
||||
them via pull request.
|
||||
|
||||
|
||||
## Other Projects Using Bolt
|
||||
|
||||
Below is a list of public, open source projects that use Bolt:
|
||||
|
||||
* [Operation Go: A Routine Mission](http://gocode.io) - An online programming game for Golang using Bolt for user accounts and a leaderboard.
|
||||
* [Bazil](https://bazil.org/) - A file system that lets your data reside where it is most convenient for it to reside.
|
||||
* [DVID](https://github.com/janelia-flyem/dvid) - Added Bolt as optional storage engine and testing it against Basho-tuned leveldb.
|
||||
* [Skybox Analytics](https://github.com/skybox/skybox) - A standalone funnel analysis tool for web analytics.
|
||||
* [Scuttlebutt](https://github.com/benbjohnson/scuttlebutt) - Uses Bolt to store and process all Twitter mentions of GitHub projects.
|
||||
* [Wiki](https://github.com/peterhellberg/wiki) - A tiny wiki using Goji, BoltDB and Blackfriday.
|
||||
* [ChainStore](https://github.com/pressly/chainstore) - Simple key-value interface to a variety of storage engines organized as a chain of operations.
|
||||
* [MetricBase](https://github.com/msiebuhr/MetricBase) - Single-binary version of Graphite.
|
||||
* [Gitchain](https://github.com/gitchain/gitchain) - Decentralized, peer-to-peer Git repositories aka "Git meets Bitcoin".
|
||||
* [event-shuttle](https://github.com/sclasen/event-shuttle) - A Unix system service to collect and reliably deliver messages to Kafka.
|
||||
* [ipxed](https://github.com/kelseyhightower/ipxed) - Web interface and api for ipxed.
|
||||
* [BoltStore](https://github.com/yosssi/boltstore) - Session store using Bolt.
|
||||
* [photosite/session](https://godoc.org/bitbucket.org/kardianos/photosite/session) - Sessions for a photo viewing site.
|
||||
* [LedisDB](https://github.com/siddontang/ledisdb) - A high performance NoSQL, using Bolt as optional storage.
|
||||
* [ipLocator](https://github.com/AndreasBriese/ipLocator) - A fast ip-geo-location-server using bolt with bloom filters.
|
||||
* [cayley](https://github.com/google/cayley) - Cayley is an open-source graph database using Bolt as optional backend.
|
||||
* [bleve](http://www.blevesearch.com/) - A pure Go search engine similar to ElasticSearch that uses Bolt as the default storage backend.
|
||||
* [tentacool](https://github.com/optiflows/tentacool) - REST api server to manage system stuff (IP, DNS, Gateway...) on a linux server.
|
||||
* [SkyDB](https://github.com/skydb/sky) - Behavioral analytics database.
|
||||
* [Seaweed File System](https://github.com/chrislusf/seaweedfs) - Highly scalable distributed key~file system with O(1) disk read.
|
||||
* [InfluxDB](https://influxdata.com) - Scalable datastore for metrics, events, and real-time analytics.
|
||||
* [Freehold](http://tshannon.bitbucket.org/freehold/) - An open, secure, and lightweight platform for your files and data.
|
||||
* [Prometheus Annotation Server](https://github.com/oliver006/prom_annotation_server) - Annotation server for PromDash & Prometheus service monitoring system.
|
||||
* [Consul](https://github.com/hashicorp/consul) - Consul is service discovery and configuration made easy. Distributed, highly available, and datacenter-aware.
|
||||
* [Kala](https://github.com/ajvb/kala) - Kala is a modern job scheduler optimized to run on a single node. It is persistent, JSON over HTTP API, ISO 8601 duration notation, and dependent jobs.
|
||||
* [drive](https://github.com/odeke-em/drive) - drive is an unofficial Google Drive command line client for \*NIX operating systems.
|
||||
* [stow](https://github.com/djherbis/stow) - a persistence manager for objects
|
||||
backed by boltdb.
|
||||
* [buckets](https://github.com/joyrexus/buckets) - a bolt wrapper streamlining
|
||||
simple tx and key scans.
|
||||
* [mbuckets](https://github.com/abhigupta912/mbuckets) - A Bolt wrapper that allows easy operations on multi level (nested) buckets.
|
||||
* [Request Baskets](https://github.com/darklynx/request-baskets) - A web service to collect arbitrary HTTP requests and inspect them via REST API or simple web UI, similar to [RequestBin](http://requestb.in/) service
|
||||
* [Go Report Card](https://goreportcard.com/) - Go code quality report cards as a (free and open source) service.
|
||||
* [Boltdb Boilerplate](https://github.com/bobintornado/boltdb-boilerplate) - Boilerplate wrapper around bolt aiming to make simple calls one-liners.
|
||||
* [lru](https://github.com/crowdriff/lru) - Easy to use Bolt-backed Least-Recently-Used (LRU) read-through cache with chainable remote stores.
|
||||
* [Storm](https://github.com/asdine/storm) - A simple ORM around BoltDB.
|
||||
* [GoWebApp](https://github.com/josephspurrier/gowebapp) - A basic MVC web application in Go using BoltDB.
|
||||
|
||||
If you are using Bolt in a project please send a pull request to add it to the list.
|
||||
18
_vendor/vendor/github.com/boltdb/bolt/appveyor.yml
generated
vendored
18
_vendor/vendor/github.com/boltdb/bolt/appveyor.yml
generated
vendored
@ -1,18 +0,0 @@
|
||||
version: "{build}"
|
||||
|
||||
os: Windows Server 2012 R2
|
||||
|
||||
clone_folder: c:\gopath\src\github.com\boltdb\bolt
|
||||
|
||||
environment:
|
||||
GOPATH: c:\gopath
|
||||
|
||||
install:
|
||||
- echo %PATH%
|
||||
- echo %GOPATH%
|
||||
- go version
|
||||
- go env
|
||||
- go get -v -t ./...
|
||||
|
||||
build_script:
|
||||
- go test -v ./...
|
||||
2
_vendor/vendor/github.com/boltdb/bolt/bolt_windows.go
generated
vendored
2
_vendor/vendor/github.com/boltdb/bolt/bolt_windows.go
generated
vendored
@ -89,7 +89,7 @@ func flock(db *DB, mode os.FileMode, exclusive bool, timeout time.Duration) erro
|
||||
func funlock(db *DB) error {
|
||||
err := unlockFileEx(syscall.Handle(db.lockfile.Fd()), 0, 1, 0, &syscall.Overlapped{})
|
||||
db.lockfile.Close()
|
||||
os.Remove(db.path + lockExt)
|
||||
os.Remove(db.path+lockExt)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
1
_vendor/vendor/github.com/cloudfoundry-incubator/candiedyaml/.gitignore
generated
vendored
1
_vendor/vendor/github.com/cloudfoundry-incubator/candiedyaml/.gitignore
generated
vendored
@ -1 +0,0 @@
|
||||
*.coverprofile
|
||||
12
_vendor/vendor/github.com/cloudfoundry-incubator/candiedyaml/.travis.yml
generated
vendored
12
_vendor/vendor/github.com/cloudfoundry-incubator/candiedyaml/.travis.yml
generated
vendored
@ -1,12 +0,0 @@
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.4.1
|
||||
|
||||
install:
|
||||
- go get -t -v ./...
|
||||
- go install github.com/onsi/ginkgo/ginkgo
|
||||
|
||||
script:
|
||||
- export PATH=$HOME/gopath/bin:$PATH
|
||||
- ginkgo -r -failOnPending -randomizeAllSpecs -race
|
||||
59
_vendor/vendor/github.com/cloudfoundry-incubator/candiedyaml/README.md
generated
vendored
59
_vendor/vendor/github.com/cloudfoundry-incubator/candiedyaml/README.md
generated
vendored
@ -1,59 +0,0 @@
|
||||
[](https://travis-ci.org/cloudfoundry-incubator/candiedyaml)
|
||||
[](https://godoc.org/github.com/cloudfoundry-incubator/candiedyaml)
|
||||
|
||||
|
||||
candiedyaml
|
||||
===========
|
||||
|
||||
YAML for Go
|
||||
|
||||
A YAML 1.1 parser with support for YAML 1.2 features
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
```go
|
||||
package myApp
|
||||
|
||||
import (
|
||||
"github.com/cloudfoundry-incubator/candiedyaml"
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
file, err := os.Open("path/to/some/file.yml")
|
||||
if err != nil {
|
||||
println("File does not exist:", err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
document := new(interface{})
|
||||
decoder := candiedyaml.NewDecoder(file)
|
||||
err = decoder.Decode(document)
|
||||
|
||||
if err != nil {
|
||||
println("Failed to decode document:", err.Error())
|
||||
}
|
||||
|
||||
println("parsed yml into interface:", fmt.Sprintf("%#v", document))
|
||||
|
||||
fileToWrite, err := os.Create("path/to/some/new/file.yml")
|
||||
if err != nil {
|
||||
println("Failed to open file for writing:", err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
defer fileToWrite.Close()
|
||||
|
||||
encoder := candiedyaml.NewEncoder(fileToWrite)
|
||||
err = encoder.Encode(document)
|
||||
|
||||
if err != nil {
|
||||
println("Failed to encode document:", err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
```
|
||||
19
_vendor/vendor/github.com/cloudfoundry-incubator/candiedyaml/libyaml-LICENSE
generated
vendored
19
_vendor/vendor/github.com/cloudfoundry-incubator/candiedyaml/libyaml-LICENSE
generated
vendored
@ -1,19 +0,0 @@
|
||||
Copyright (c) 2006 Kirill Simonov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
37
_vendor/vendor/github.com/coreos/etcd/auth/authpb/auth.proto
generated
vendored
37
_vendor/vendor/github.com/coreos/etcd/auth/authpb/auth.proto
generated
vendored
@ -1,37 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package authpb;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.marshaler_all) = true;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = true;
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
option (gogoproto.goproto_enum_prefix_all) = false;
|
||||
|
||||
// User is a single entry in the bucket authUsers
|
||||
message User {
|
||||
bytes name = 1;
|
||||
bytes password = 2;
|
||||
repeated string roles = 3;
|
||||
}
|
||||
|
||||
// Permission is a single entity
|
||||
message Permission {
|
||||
enum Type {
|
||||
READ = 0;
|
||||
WRITE = 1;
|
||||
READWRITE = 2;
|
||||
}
|
||||
Type permType = 1;
|
||||
|
||||
bytes key = 2;
|
||||
bytes range_end = 3;
|
||||
}
|
||||
|
||||
// Role is a single entry in the bucket authRoles
|
||||
message Role {
|
||||
bytes name = 1;
|
||||
|
||||
repeated Permission keyPermission = 2;
|
||||
}
|
||||
77
_vendor/vendor/github.com/coreos/etcd/clientv3/README.md
generated
vendored
77
_vendor/vendor/github.com/coreos/etcd/clientv3/README.md
generated
vendored
@ -1,77 +0,0 @@
|
||||
# etcd/clientv3
|
||||
|
||||
[](https://godoc.org/github.com/coreos/etcd/clientv3)
|
||||
|
||||
`etcd/clientv3` is the official Go etcd client for v3.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
go get github.com/coreos/etcd/clientv3
|
||||
```
|
||||
|
||||
## Get started
|
||||
|
||||
Create client using `clientv3.New`:
|
||||
|
||||
```go
|
||||
cli, err := clientv3.New(clientv3.Config{
|
||||
Endpoints: []string{"localhost:2379", "localhost:22379", "localhost:32379"},
|
||||
DialTimeout: 5 * time.Second,
|
||||
})
|
||||
if err != nil {
|
||||
// handle error!
|
||||
}
|
||||
defer cli.Close()
|
||||
```
|
||||
|
||||
etcd v3 uses [`gRPC`](http://www.grpc.io) for remote procedure calls. And `clientv3` uses
|
||||
[`grpc-go`](https://github.com/grpc/grpc-go) to connect to etcd. Make sure to close the client after using it.
|
||||
If the client is not closed, the connection will have leaky goroutines. To specify client request timeout,
|
||||
pass `context.WithTimeout` to APIs:
|
||||
|
||||
```go
|
||||
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
||||
resp, err := kvc.Put(ctx, "sample_key", "sample_value")
|
||||
cancel()
|
||||
if err != nil {
|
||||
// handle error!
|
||||
}
|
||||
// use the response
|
||||
```
|
||||
|
||||
etcd uses `cmd/vendor` directory to store external dependencies, which are
|
||||
to be compiled into etcd release binaries. `client` can be imported without
|
||||
vendoring. For full compatibility, it is recommended to vendor builds using
|
||||
etcd's vendored packages, using tools like godep, as in
|
||||
[vendor directories](https://golang.org/cmd/go/#hdr-Vendor_Directories).
|
||||
For more detail, please read [Go vendor design](https://golang.org/s/go15vendor).
|
||||
|
||||
## Error Handling
|
||||
|
||||
etcd client returns 2 types of errors:
|
||||
|
||||
1. context error: canceled or deadline exceeded.
|
||||
2. gRPC error: see [api/v3rpc/rpctypes](https://godoc.org/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes).
|
||||
|
||||
Here is the example code to handle client errors:
|
||||
|
||||
```go
|
||||
resp, err := kvc.Put(ctx, "", "")
|
||||
if err != nil {
|
||||
switch err {
|
||||
case context.Canceled:
|
||||
log.Fatalf("ctx is canceled by another routine: %v", err)
|
||||
case context.DeadlineExceeded:
|
||||
log.Fatalf("ctx is attached with a deadline is exceeded: %v", err)
|
||||
case rpctypes.ErrEmptyKey:
|
||||
log.Fatalf("client-side error: %v", err)
|
||||
default:
|
||||
log.Fatalf("bad cluster endpoints, which are not etcd servers: %v", err)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
More code examples can be found at [GoDoc](https://godoc.org/github.com/coreos/etcd/clientv3).
|
||||
34
_vendor/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/etcdserver.proto
generated
vendored
34
_vendor/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/etcdserver.proto
generated
vendored
@ -1,34 +0,0 @@
|
||||
syntax = "proto2";
|
||||
package etcdserverpb;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.marshaler_all) = true;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = true;
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
|
||||
message Request {
|
||||
optional uint64 ID = 1 [(gogoproto.nullable) = false];
|
||||
optional string Method = 2 [(gogoproto.nullable) = false];
|
||||
optional string Path = 3 [(gogoproto.nullable) = false];
|
||||
optional string Val = 4 [(gogoproto.nullable) = false];
|
||||
optional bool Dir = 5 [(gogoproto.nullable) = false];
|
||||
optional string PrevValue = 6 [(gogoproto.nullable) = false];
|
||||
optional uint64 PrevIndex = 7 [(gogoproto.nullable) = false];
|
||||
optional bool PrevExist = 8 [(gogoproto.nullable) = true];
|
||||
optional int64 Expiration = 9 [(gogoproto.nullable) = false];
|
||||
optional bool Wait = 10 [(gogoproto.nullable) = false];
|
||||
optional uint64 Since = 11 [(gogoproto.nullable) = false];
|
||||
optional bool Recursive = 12 [(gogoproto.nullable) = false];
|
||||
optional bool Sorted = 13 [(gogoproto.nullable) = false];
|
||||
optional bool Quorum = 14 [(gogoproto.nullable) = false];
|
||||
optional int64 Time = 15 [(gogoproto.nullable) = false];
|
||||
optional bool Stream = 16 [(gogoproto.nullable) = false];
|
||||
optional bool Refresh = 17 [(gogoproto.nullable) = true];
|
||||
}
|
||||
|
||||
message Metadata {
|
||||
optional uint64 NodeID = 1 [(gogoproto.nullable) = false];
|
||||
optional uint64 ClusterID = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
74
_vendor/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/raft_internal.proto
generated
vendored
74
_vendor/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/raft_internal.proto
generated
vendored
@ -1,74 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package etcdserverpb;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "etcdserver.proto";
|
||||
import "rpc.proto";
|
||||
|
||||
option (gogoproto.marshaler_all) = true;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = true;
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
|
||||
message RequestHeader {
|
||||
uint64 ID = 1;
|
||||
// username is a username that is associated with an auth token of gRPC connection
|
||||
string username = 2;
|
||||
// auth_revision is a revision number of auth.authStore. It is not related to mvcc
|
||||
uint64 auth_revision = 3;
|
||||
}
|
||||
|
||||
// An InternalRaftRequest is the union of all requests which can be
|
||||
// sent via raft.
|
||||
message InternalRaftRequest {
|
||||
RequestHeader header = 100;
|
||||
uint64 ID = 1;
|
||||
|
||||
Request v2 = 2;
|
||||
|
||||
RangeRequest range = 3;
|
||||
PutRequest put = 4;
|
||||
DeleteRangeRequest delete_range = 5;
|
||||
TxnRequest txn = 6;
|
||||
CompactionRequest compaction = 7;
|
||||
|
||||
LeaseGrantRequest lease_grant = 8;
|
||||
LeaseRevokeRequest lease_revoke = 9;
|
||||
|
||||
AlarmRequest alarm = 10;
|
||||
|
||||
AuthEnableRequest auth_enable = 1000;
|
||||
AuthDisableRequest auth_disable = 1011;
|
||||
|
||||
InternalAuthenticateRequest authenticate = 1012;
|
||||
|
||||
AuthUserAddRequest auth_user_add = 1100;
|
||||
AuthUserDeleteRequest auth_user_delete = 1101;
|
||||
AuthUserGetRequest auth_user_get = 1102;
|
||||
AuthUserChangePasswordRequest auth_user_change_password = 1103;
|
||||
AuthUserGrantRoleRequest auth_user_grant_role = 1104;
|
||||
AuthUserRevokeRoleRequest auth_user_revoke_role = 1105;
|
||||
AuthUserListRequest auth_user_list = 1106;
|
||||
AuthRoleListRequest auth_role_list = 1107;
|
||||
|
||||
AuthRoleAddRequest auth_role_add = 1200;
|
||||
AuthRoleDeleteRequest auth_role_delete = 1201;
|
||||
AuthRoleGetRequest auth_role_get = 1202;
|
||||
AuthRoleGrantPermissionRequest auth_role_grant_permission = 1203;
|
||||
AuthRoleRevokePermissionRequest auth_role_revoke_permission = 1204;
|
||||
}
|
||||
|
||||
message EmptyResponse {
|
||||
}
|
||||
|
||||
// What is the difference between AuthenticateRequest (defined in rpc.proto) and InternalAuthenticateRequest?
|
||||
// InternalAuthenticateRequest has a member that is filled by etcdserver and shouldn't be user-facing.
|
||||
// For avoiding misusage the field, we have an internal version of AuthenticateRequest.
|
||||
message InternalAuthenticateRequest {
|
||||
string name = 1;
|
||||
string password = 2;
|
||||
|
||||
// simple_token is generated in API layer (etcdserver/v3_server.go)
|
||||
string simple_token = 3;
|
||||
}
|
||||
|
||||
919
_vendor/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.proto
generated
vendored
919
_vendor/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.proto
generated
vendored
@ -1,919 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package etcdserverpb;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "etcd/mvcc/mvccpb/kv.proto";
|
||||
import "etcd/auth/authpb/auth.proto";
|
||||
|
||||
// for grpc-gateway
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
option (gogoproto.marshaler_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = true;
|
||||
|
||||
service KV {
|
||||
// Range gets the keys in the range from the key-value store.
|
||||
rpc Range(RangeRequest) returns (RangeResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/kv/range"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Put puts the given key into the key-value store.
|
||||
// A put request increments the revision of the key-value store
|
||||
// and generates one event in the event history.
|
||||
rpc Put(PutRequest) returns (PutResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/kv/put"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// DeleteRange deletes the given range from the key-value store.
|
||||
// A delete request increments the revision of the key-value store
|
||||
// and generates a delete event in the event history for every deleted key.
|
||||
rpc DeleteRange(DeleteRangeRequest) returns (DeleteRangeResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/kv/deleterange"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Txn processes multiple requests in a single transaction.
|
||||
// A txn request increments the revision of the key-value store
|
||||
// and generates events with the same revision for every completed request.
|
||||
// It is not allowed to modify the same key several times within one txn.
|
||||
rpc Txn(TxnRequest) returns (TxnResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/kv/txn"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Compact compacts the event history in the etcd key-value store. The key-value
|
||||
// store should be periodically compacted or the event history will continue to grow
|
||||
// indefinitely.
|
||||
rpc Compact(CompactionRequest) returns (CompactionResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/kv/compaction"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
service Watch {
|
||||
// Watch watches for events happening or that have happened. Both input and output
|
||||
// are streams; the input stream is for creating and canceling watchers and the output
|
||||
// stream sends events. One watch RPC can watch on multiple key ranges, streaming events
|
||||
// for several watches at once. The entire event history can be watched starting from the
|
||||
// last compaction revision.
|
||||
rpc Watch(stream WatchRequest) returns (stream WatchResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/watch"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
service Lease {
|
||||
// LeaseGrant creates a lease which expires if the server does not receive a keepAlive
|
||||
// within a given time to live period. All keys attached to the lease will be expired and
|
||||
// deleted if the lease expires. Each expired key generates a delete event in the event history.
|
||||
rpc LeaseGrant(LeaseGrantRequest) returns (LeaseGrantResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/lease/grant"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// LeaseRevoke revokes a lease. All keys attached to the lease will expire and be deleted.
|
||||
rpc LeaseRevoke(LeaseRevokeRequest) returns (LeaseRevokeResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/kv/lease/revoke"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// LeaseKeepAlive keeps the lease alive by streaming keep alive requests from the client
|
||||
// to the server and streaming keep alive responses from the server to the client.
|
||||
rpc LeaseKeepAlive(stream LeaseKeepAliveRequest) returns (stream LeaseKeepAliveResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/lease/keepalive"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// TODO(xiangli) List all existing Leases?
|
||||
// TODO(xiangli) Get details information (expirations, leased keys, etc.) of a lease?
|
||||
}
|
||||
|
||||
service Cluster {
|
||||
// MemberAdd adds a member into the cluster.
|
||||
rpc MemberAdd(MemberAddRequest) returns (MemberAddResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/cluster/member/add"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// MemberRemove removes an existing member from the cluster.
|
||||
rpc MemberRemove(MemberRemoveRequest) returns (MemberRemoveResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/cluster/member/remove"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// MemberUpdate updates the member configuration.
|
||||
rpc MemberUpdate(MemberUpdateRequest) returns (MemberUpdateResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/cluster/member/update"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// MemberList lists all the members in the cluster.
|
||||
rpc MemberList(MemberListRequest) returns (MemberListResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/cluster/member/list"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
service Maintenance {
|
||||
// Alarm activates, deactivates, and queries alarms regarding cluster health.
|
||||
rpc Alarm(AlarmRequest) returns (AlarmResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/maintenance/alarm"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Status gets the status of the member.
|
||||
rpc Status(StatusRequest) returns (StatusResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/maintenance/status"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Defragment defragments a member's backend database to recover storage space.
|
||||
rpc Defragment(DefragmentRequest) returns (DefragmentResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/maintenance/defragment"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Hash returns the hash of the local KV state for consistency checking purpose.
|
||||
// This is designed for testing; do not use this in production when there
|
||||
// are ongoing transactions.
|
||||
rpc Hash(HashRequest) returns (HashResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/maintenance/hash"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Snapshot sends a snapshot of the entire backend from a member over a stream to a client.
|
||||
rpc Snapshot(SnapshotRequest) returns (stream SnapshotResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/maintenance/snapshot"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
service Auth {
|
||||
// AuthEnable enables authentication.
|
||||
rpc AuthEnable(AuthEnableRequest) returns (AuthEnableResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/auth/enable"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// AuthDisable disables authentication.
|
||||
rpc AuthDisable(AuthDisableRequest) returns (AuthDisableResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/auth/disable"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Authenticate processes an authenticate request.
|
||||
rpc Authenticate(AuthenticateRequest) returns (AuthenticateResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/auth/authenticate"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// UserAdd adds a new user.
|
||||
rpc UserAdd(AuthUserAddRequest) returns (AuthUserAddResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/auth/user/add"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// UserGet gets detailed user information.
|
||||
rpc UserGet(AuthUserGetRequest) returns (AuthUserGetResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/auth/user/get"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// UserList gets a list of all users.
|
||||
rpc UserList(AuthUserListRequest) returns (AuthUserListResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/auth/user/list"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// UserDelete deletes a specified user.
|
||||
rpc UserDelete(AuthUserDeleteRequest) returns (AuthUserDeleteResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/auth/user/delete"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// UserChangePassword changes the password of a specified user.
|
||||
rpc UserChangePassword(AuthUserChangePasswordRequest) returns (AuthUserChangePasswordResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/auth/user/changepw"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// UserGrant grants a role to a specified user.
|
||||
rpc UserGrantRole(AuthUserGrantRoleRequest) returns (AuthUserGrantRoleResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/auth/user/grant"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// UserRevokeRole revokes a role of specified user.
|
||||
rpc UserRevokeRole(AuthUserRevokeRoleRequest) returns (AuthUserRevokeRoleResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/auth/user/revoke"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// RoleAdd adds a new role.
|
||||
rpc RoleAdd(AuthRoleAddRequest) returns (AuthRoleAddResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/auth/role/add"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// RoleGet gets detailed role information.
|
||||
rpc RoleGet(AuthRoleGetRequest) returns (AuthRoleGetResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/auth/role/get"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// RoleList gets lists of all roles.
|
||||
rpc RoleList(AuthRoleListRequest) returns (AuthRoleListResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/auth/role/list"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// RoleDelete deletes a specified role.
|
||||
rpc RoleDelete(AuthRoleDeleteRequest) returns (AuthRoleDeleteResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/auth/role/delete"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// RoleGrantPermission grants a permission of a specified key or range to a specified role.
|
||||
rpc RoleGrantPermission(AuthRoleGrantPermissionRequest) returns (AuthRoleGrantPermissionResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/auth/role/grant"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// RoleRevokePermission revokes a key or range permission of a specified role.
|
||||
rpc RoleRevokePermission(AuthRoleRevokePermissionRequest) returns (AuthRoleRevokePermissionResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v3alpha/auth/role/revoke"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message ResponseHeader {
|
||||
// cluster_id is the ID of the cluster which sent the response.
|
||||
uint64 cluster_id = 1;
|
||||
// member_id is the ID of the member which sent the response.
|
||||
uint64 member_id = 2;
|
||||
// revision is the key-value store revision when the request was applied.
|
||||
int64 revision = 3;
|
||||
// raft_term is the raft term when the request was applied.
|
||||
uint64 raft_term = 4;
|
||||
}
|
||||
|
||||
message RangeRequest {
|
||||
enum SortOrder {
|
||||
NONE = 0; // default, no sorting
|
||||
ASCEND = 1; // lowest target value first
|
||||
DESCEND = 2; // highest target value first
|
||||
}
|
||||
enum SortTarget {
|
||||
KEY = 0;
|
||||
VERSION = 1;
|
||||
CREATE = 2;
|
||||
MOD = 3;
|
||||
VALUE = 4;
|
||||
}
|
||||
|
||||
// key is the first key for the range. If range_end is not given, the request only looks up key.
|
||||
bytes key = 1;
|
||||
// range_end is the upper bound on the requested range [key, range_end).
|
||||
// If range_end is '\0', the range is all keys >= key.
|
||||
// If the range_end is one bit larger than the given key,
|
||||
// then the range requests get the all keys with the prefix (the given key).
|
||||
// If both key and range_end are '\0', then range requests returns all keys.
|
||||
bytes range_end = 2;
|
||||
// limit is a limit on the number of keys returned for the request.
|
||||
int64 limit = 3;
|
||||
// revision is the point-in-time of the key-value store to use for the range.
|
||||
// If revision is less or equal to zero, the range is over the newest key-value store.
|
||||
// If the revision has been compacted, ErrCompacted is returned as a response.
|
||||
int64 revision = 4;
|
||||
|
||||
// sort_order is the order for returned sorted results.
|
||||
SortOrder sort_order = 5;
|
||||
|
||||
// sort_target is the key-value field to use for sorting.
|
||||
SortTarget sort_target = 6;
|
||||
|
||||
// serializable sets the range request to use serializable member-local reads.
|
||||
// Range requests are linearizable by default; linearizable requests have higher
|
||||
// latency and lower throughput than serializable requests but reflect the current
|
||||
// consensus of the cluster. For better performance, in exchange for possible stale reads,
|
||||
// a serializable range request is served locally without needing to reach consensus
|
||||
// with other nodes in the cluster.
|
||||
bool serializable = 7;
|
||||
|
||||
// keys_only when set returns only the keys and not the values.
|
||||
bool keys_only = 8;
|
||||
|
||||
// count_only when set returns only the count of the keys in the range.
|
||||
bool count_only = 9;
|
||||
}
|
||||
|
||||
message RangeResponse {
|
||||
ResponseHeader header = 1;
|
||||
// kvs is the list of key-value pairs matched by the range request.
|
||||
// kvs is empty when count is requested.
|
||||
repeated mvccpb.KeyValue kvs = 2;
|
||||
// more indicates if there are more keys to return in the requested range.
|
||||
bool more = 3;
|
||||
// count is set to the number of keys within the range when requested.
|
||||
int64 count = 4;
|
||||
}
|
||||
|
||||
message PutRequest {
|
||||
// key is the key, in bytes, to put into the key-value store.
|
||||
bytes key = 1;
|
||||
// value is the value, in bytes, to associate with the key in the key-value store.
|
||||
bytes value = 2;
|
||||
// lease is the lease ID to associate with the key in the key-value store. A lease
|
||||
// value of 0 indicates no lease.
|
||||
int64 lease = 3;
|
||||
|
||||
// If prev_kv is set, etcd gets the previous key-value pair before changing it.
|
||||
// The previous key-value pair will be returned in the put response.
|
||||
bool prev_kv = 4;
|
||||
}
|
||||
|
||||
message PutResponse {
|
||||
ResponseHeader header = 1;
|
||||
// if prev_kv is set in the request, the previous key-value pair will be returned.
|
||||
mvccpb.KeyValue prev_kv = 2;
|
||||
}
|
||||
|
||||
message DeleteRangeRequest {
|
||||
// key is the first key to delete in the range.
|
||||
bytes key = 1;
|
||||
// range_end is the key following the last key to delete for the range [key, range_end).
|
||||
// If range_end is not given, the range is defined to contain only the key argument.
|
||||
// If range_end is '\0', the range is all keys greater than or equal to the key argument.
|
||||
bytes range_end = 2;
|
||||
|
||||
// If prev_kv is set, etcd gets the previous key-value pairs before deleting it.
|
||||
// The previous key-value pairs will be returned in the delte response.
|
||||
bool prev_kv = 3;
|
||||
}
|
||||
|
||||
message DeleteRangeResponse {
|
||||
ResponseHeader header = 1;
|
||||
// deleted is the number of keys deleted by the delete range request.
|
||||
int64 deleted = 2;
|
||||
// if prev_kv is set in the request, the previous key-value pairs will be returned.
|
||||
repeated mvccpb.KeyValue prev_kvs = 3;
|
||||
}
|
||||
|
||||
message RequestOp {
|
||||
// request is a union of request types accepted by a transaction.
|
||||
oneof request {
|
||||
RangeRequest request_range = 1;
|
||||
PutRequest request_put = 2;
|
||||
DeleteRangeRequest request_delete_range = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message ResponseOp {
|
||||
// response is a union of response types returned by a transaction.
|
||||
oneof response {
|
||||
RangeResponse response_range = 1;
|
||||
PutResponse response_put = 2;
|
||||
DeleteRangeResponse response_delete_range = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message Compare {
|
||||
enum CompareResult {
|
||||
EQUAL = 0;
|
||||
GREATER = 1;
|
||||
LESS = 2;
|
||||
}
|
||||
enum CompareTarget {
|
||||
VERSION = 0;
|
||||
CREATE = 1;
|
||||
MOD = 2;
|
||||
VALUE= 3;
|
||||
}
|
||||
// result is logical comparison operation for this comparison.
|
||||
CompareResult result = 1;
|
||||
// target is the key-value field to inspect for the comparison.
|
||||
CompareTarget target = 2;
|
||||
// key is the subject key for the comparison operation.
|
||||
bytes key = 3;
|
||||
oneof target_union {
|
||||
// version is the version of the given key
|
||||
int64 version = 4;
|
||||
// create_revision is the creation revision of the given key
|
||||
int64 create_revision = 5;
|
||||
// mod_revision is the last modified revision of the given key.
|
||||
int64 mod_revision = 6;
|
||||
// value is the value of the given key, in bytes.
|
||||
bytes value = 7;
|
||||
}
|
||||
}
|
||||
|
||||
// From google paxosdb paper:
|
||||
// Our implementation hinges around a powerful primitive which we call MultiOp. All other database
|
||||
// operations except for iteration are implemented as a single call to MultiOp. A MultiOp is applied atomically
|
||||
// and consists of three components:
|
||||
// 1. A list of tests called guard. Each test in guard checks a single entry in the database. It may check
|
||||
// for the absence or presence of a value, or compare with a given value. Two different tests in the guard
|
||||
// may apply to the same or different entries in the database. All tests in the guard are applied and
|
||||
// MultiOp returns the results. If all tests are true, MultiOp executes t op (see item 2 below), otherwise
|
||||
// it executes f op (see item 3 below).
|
||||
// 2. A list of database operations called t op. Each operation in the list is either an insert, delete, or
|
||||
// lookup operation, and applies to a single database entry. Two different operations in the list may apply
|
||||
// to the same or different entries in the database. These operations are executed
|
||||
// if guard evaluates to
|
||||
// true.
|
||||
// 3. A list of database operations called f op. Like t op, but executed if guard evaluates to false.
|
||||
message TxnRequest {
|
||||
// compare is a list of predicates representing a conjunction of terms.
|
||||
// If the comparisons succeed, then the success requests will be processed in order,
|
||||
// and the response will contain their respective responses in order.
|
||||
// If the comparisons fail, then the failure requests will be processed in order,
|
||||
// and the response will contain their respective responses in order.
|
||||
repeated Compare compare = 1;
|
||||
// success is a list of requests which will be applied when compare evaluates to true.
|
||||
repeated RequestOp success = 2;
|
||||
// failure is a list of requests which will be applied when compare evaluates to false.
|
||||
repeated RequestOp failure = 3;
|
||||
}
|
||||
|
||||
message TxnResponse {
|
||||
ResponseHeader header = 1;
|
||||
// succeeded is set to true if the compare evaluated to true or false otherwise.
|
||||
bool succeeded = 2;
|
||||
// responses is a list of responses corresponding to the results from applying
|
||||
// success if succeeded is true or failure if succeeded is false.
|
||||
repeated ResponseOp responses = 3;
|
||||
}
|
||||
|
||||
// CompactionRequest compacts the key-value store up to a given revision. All superseded keys
|
||||
// with a revision less than the compaction revision will be removed.
|
||||
message CompactionRequest {
|
||||
// revision is the key-value store revision for the compaction operation.
|
||||
int64 revision = 1;
|
||||
// physical is set so the RPC will wait until the compaction is physically
|
||||
// applied to the local database such that compacted entries are totally
|
||||
// removed from the backend database.
|
||||
bool physical = 2;
|
||||
}
|
||||
|
||||
message CompactionResponse {
|
||||
ResponseHeader header = 1;
|
||||
}
|
||||
|
||||
message HashRequest {
|
||||
}
|
||||
|
||||
message HashResponse {
|
||||
ResponseHeader header = 1;
|
||||
// hash is the hash value computed from the responding member's key-value store.
|
||||
uint32 hash = 2;
|
||||
}
|
||||
|
||||
message SnapshotRequest {
|
||||
}
|
||||
|
||||
message SnapshotResponse {
|
||||
// header has the current key-value store information. The first header in the snapshot
|
||||
// stream indicates the point in time of the snapshot.
|
||||
ResponseHeader header = 1;
|
||||
|
||||
// remaining_bytes is the number of blob bytes to be sent after this message
|
||||
uint64 remaining_bytes = 2;
|
||||
|
||||
// blob contains the next chunk of the snapshot in the snapshot stream.
|
||||
bytes blob = 3;
|
||||
}
|
||||
|
||||
message WatchRequest {
|
||||
// request_union is a request to either create a new watcher or cancel an existing watcher.
|
||||
oneof request_union {
|
||||
WatchCreateRequest create_request = 1;
|
||||
WatchCancelRequest cancel_request = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message WatchCreateRequest {
|
||||
// key is the key to register for watching.
|
||||
bytes key = 1;
|
||||
// range_end is the end of the range [key, range_end) to watch. If range_end is not given,
|
||||
// only the key argument is watched. If range_end is equal to '\0', all keys greater than
|
||||
// or equal to the key argument are watched.
|
||||
bytes range_end = 2;
|
||||
// start_revision is an optional revision to watch from (inclusive). No start_revision is "now".
|
||||
int64 start_revision = 3;
|
||||
// progress_notify is set so that the etcd server will periodically send a WatchResponse with
|
||||
// no events to the new watcher if there are no recent events. It is useful when clients
|
||||
// wish to recover a disconnected watcher starting from a recent known revision.
|
||||
// The etcd server may decide how often it will send notifications based on current load.
|
||||
bool progress_notify = 4;
|
||||
|
||||
enum FilterType {
|
||||
// filter out put event.
|
||||
NOPUT = 0;
|
||||
// filter out delete event.
|
||||
NODELETE = 1;
|
||||
}
|
||||
// filters filter the events at server side before it sends back to the watcher.
|
||||
repeated FilterType filters = 5;
|
||||
|
||||
// If prev_kv is set, created watcher gets the previous KV before the event happens.
|
||||
// If the previous KV is already compacted, nothing will be returned.
|
||||
bool prev_kv = 6;
|
||||
}
|
||||
|
||||
message WatchCancelRequest {
|
||||
// watch_id is the watcher id to cancel so that no more events are transmitted.
|
||||
int64 watch_id = 1;
|
||||
}
|
||||
|
||||
message WatchResponse {
|
||||
ResponseHeader header = 1;
|
||||
// watch_id is the ID of the watcher that corresponds to the response.
|
||||
int64 watch_id = 2;
|
||||
// created is set to true if the response is for a create watch request.
|
||||
// The client should record the watch_id and expect to receive events for
|
||||
// the created watcher from the same stream.
|
||||
// All events sent to the created watcher will attach with the same watch_id.
|
||||
bool created = 3;
|
||||
// canceled is set to true if the response is for a cancel watch request.
|
||||
// No further events will be sent to the canceled watcher.
|
||||
bool canceled = 4;
|
||||
// compact_revision is set to the minimum index if a watcher tries to watch
|
||||
// at a compacted index.
|
||||
//
|
||||
// This happens when creating a watcher at a compacted revision or the watcher cannot
|
||||
// catch up with the progress of the key-value store.
|
||||
//
|
||||
// The client should treat the watcher as canceled and should not try to create any
|
||||
// watcher with the same start_revision again.
|
||||
int64 compact_revision = 5;
|
||||
|
||||
repeated mvccpb.Event events = 11;
|
||||
}
|
||||
|
||||
message LeaseGrantRequest {
|
||||
// TTL is the advisory time-to-live in seconds.
|
||||
int64 TTL = 1;
|
||||
// ID is the requested ID for the lease. If ID is set to 0, the lessor chooses an ID.
|
||||
int64 ID = 2;
|
||||
}
|
||||
|
||||
message LeaseGrantResponse {
|
||||
ResponseHeader header = 1;
|
||||
// ID is the lease ID for the granted lease.
|
||||
int64 ID = 2;
|
||||
// TTL is the server chosen lease time-to-live in seconds.
|
||||
int64 TTL = 3;
|
||||
string error = 4;
|
||||
}
|
||||
|
||||
message LeaseRevokeRequest {
|
||||
// ID is the lease ID to revoke. When the ID is revoked, all associated keys will be deleted.
|
||||
int64 ID = 1;
|
||||
}
|
||||
|
||||
message LeaseRevokeResponse {
|
||||
ResponseHeader header = 1;
|
||||
}
|
||||
|
||||
message LeaseKeepAliveRequest {
|
||||
// ID is the lease ID for the lease to keep alive.
|
||||
int64 ID = 1;
|
||||
}
|
||||
|
||||
message LeaseKeepAliveResponse {
|
||||
ResponseHeader header = 1;
|
||||
// ID is the lease ID from the keep alive request.
|
||||
int64 ID = 2;
|
||||
// TTL is the new time-to-live for the lease.
|
||||
int64 TTL = 3;
|
||||
}
|
||||
|
||||
message Member {
|
||||
// ID is the member ID for this member.
|
||||
uint64 ID = 1;
|
||||
// name is the human-readable name of the member. If the member is not started, the name will be an empty string.
|
||||
string name = 2;
|
||||
// peerURLs is the list of URLs the member exposes to the cluster for communication.
|
||||
repeated string peerURLs = 3;
|
||||
// clientURLs is the list of URLs the member exposes to clients for communication. If the member is not started, clientURLs will be empty.
|
||||
repeated string clientURLs = 4;
|
||||
}
|
||||
|
||||
message MemberAddRequest {
|
||||
// peerURLs is the list of URLs the added member will use to communicate with the cluster.
|
||||
repeated string peerURLs = 1;
|
||||
}
|
||||
|
||||
message MemberAddResponse {
|
||||
ResponseHeader header = 1;
|
||||
// member is the member information for the added member.
|
||||
Member member = 2;
|
||||
}
|
||||
|
||||
message MemberRemoveRequest {
|
||||
// ID is the member ID of the member to remove.
|
||||
uint64 ID = 1;
|
||||
}
|
||||
|
||||
message MemberRemoveResponse {
|
||||
ResponseHeader header = 1;
|
||||
}
|
||||
|
||||
message MemberUpdateRequest {
|
||||
// ID is the member ID of the member to update.
|
||||
uint64 ID = 1;
|
||||
// peerURLs is the new list of URLs the member will use to communicate with the cluster.
|
||||
repeated string peerURLs = 2;
|
||||
}
|
||||
|
||||
message MemberUpdateResponse{
|
||||
ResponseHeader header = 1;
|
||||
}
|
||||
|
||||
message MemberListRequest {
|
||||
}
|
||||
|
||||
message MemberListResponse {
|
||||
ResponseHeader header = 1;
|
||||
// members is a list of all members associated with the cluster.
|
||||
repeated Member members = 2;
|
||||
}
|
||||
|
||||
message DefragmentRequest {
|
||||
}
|
||||
|
||||
message DefragmentResponse {
|
||||
ResponseHeader header = 1;
|
||||
}
|
||||
|
||||
enum AlarmType {
|
||||
NONE = 0; // default, used to query if any alarm is active
|
||||
NOSPACE = 1; // space quota is exhausted
|
||||
}
|
||||
|
||||
message AlarmRequest {
|
||||
enum AlarmAction {
|
||||
GET = 0;
|
||||
ACTIVATE = 1;
|
||||
DEACTIVATE = 2;
|
||||
}
|
||||
// action is the kind of alarm request to issue. The action
|
||||
// may GET alarm statuses, ACTIVATE an alarm, or DEACTIVATE a
|
||||
// raised alarm.
|
||||
AlarmAction action = 1;
|
||||
// memberID is the ID of the member associated with the alarm. If memberID is 0, the
|
||||
// alarm request covers all members.
|
||||
uint64 memberID = 2;
|
||||
// alarm is the type of alarm to consider for this request.
|
||||
AlarmType alarm = 3;
|
||||
}
|
||||
|
||||
message AlarmMember {
|
||||
// memberID is the ID of the member associated with the raised alarm.
|
||||
uint64 memberID = 1;
|
||||
// alarm is the type of alarm which has been raised.
|
||||
AlarmType alarm = 2;
|
||||
}
|
||||
|
||||
message AlarmResponse {
|
||||
ResponseHeader header = 1;
|
||||
// alarms is a list of alarms associated with the alarm request.
|
||||
repeated AlarmMember alarms = 2;
|
||||
}
|
||||
|
||||
message StatusRequest {
|
||||
}
|
||||
|
||||
message StatusResponse {
|
||||
ResponseHeader header = 1;
|
||||
// version is the cluster protocol version used by the responding member.
|
||||
string version = 2;
|
||||
// dbSize is the size of the backend database, in bytes, of the responding member.
|
||||
int64 dbSize = 3;
|
||||
// leader is the member ID which the responding member believes is the current leader.
|
||||
uint64 leader = 4;
|
||||
// raftIndex is the current raft index of the responding member.
|
||||
uint64 raftIndex = 5;
|
||||
// raftTerm is the current raft term of the responding member.
|
||||
uint64 raftTerm = 6;
|
||||
}
|
||||
|
||||
message AuthEnableRequest {
|
||||
}
|
||||
|
||||
message AuthDisableRequest {
|
||||
}
|
||||
|
||||
message AuthenticateRequest {
|
||||
string name = 1;
|
||||
string password = 2;
|
||||
}
|
||||
|
||||
message AuthUserAddRequest {
|
||||
string name = 1;
|
||||
string password = 2;
|
||||
}
|
||||
|
||||
message AuthUserGetRequest {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message AuthUserDeleteRequest {
|
||||
// name is the name of the user to delete.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message AuthUserChangePasswordRequest {
|
||||
// name is the name of the user whose password is being changed.
|
||||
string name = 1;
|
||||
// password is the new password for the user.
|
||||
string password = 2;
|
||||
}
|
||||
|
||||
message AuthUserGrantRoleRequest {
|
||||
// user is the name of the user which should be granted a given role.
|
||||
string user = 1;
|
||||
// role is the name of the role to grant to the user.
|
||||
string role = 2;
|
||||
}
|
||||
|
||||
message AuthUserRevokeRoleRequest {
|
||||
string name = 1;
|
||||
string role = 2;
|
||||
}
|
||||
|
||||
message AuthRoleAddRequest {
|
||||
// name is the name of the role to add to the authentication system.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message AuthRoleGetRequest {
|
||||
string role = 1;
|
||||
}
|
||||
|
||||
message AuthUserListRequest {
|
||||
}
|
||||
|
||||
message AuthRoleListRequest {
|
||||
}
|
||||
|
||||
message AuthRoleDeleteRequest {
|
||||
string role = 1;
|
||||
}
|
||||
|
||||
message AuthRoleGrantPermissionRequest {
|
||||
// name is the name of the role which will be granted the permission.
|
||||
string name = 1;
|
||||
// perm is the permission to grant to the role.
|
||||
authpb.Permission perm = 2;
|
||||
}
|
||||
|
||||
message AuthRoleRevokePermissionRequest {
|
||||
string role = 1;
|
||||
string key = 2;
|
||||
string range_end = 3;
|
||||
}
|
||||
|
||||
message AuthEnableResponse {
|
||||
ResponseHeader header = 1;
|
||||
}
|
||||
|
||||
message AuthDisableResponse {
|
||||
ResponseHeader header = 1;
|
||||
}
|
||||
|
||||
message AuthenticateResponse {
|
||||
ResponseHeader header = 1;
|
||||
// token is an authorized token that can be used in succeeding RPCs
|
||||
string token = 2;
|
||||
}
|
||||
|
||||
message AuthUserAddResponse {
|
||||
ResponseHeader header = 1;
|
||||
}
|
||||
|
||||
message AuthUserGetResponse {
|
||||
ResponseHeader header = 1;
|
||||
|
||||
repeated string roles = 2;
|
||||
}
|
||||
|
||||
message AuthUserDeleteResponse {
|
||||
ResponseHeader header = 1;
|
||||
}
|
||||
|
||||
message AuthUserChangePasswordResponse {
|
||||
ResponseHeader header = 1;
|
||||
}
|
||||
|
||||
message AuthUserGrantRoleResponse {
|
||||
ResponseHeader header = 1;
|
||||
}
|
||||
|
||||
message AuthUserRevokeRoleResponse {
|
||||
ResponseHeader header = 1;
|
||||
}
|
||||
|
||||
message AuthRoleAddResponse {
|
||||
ResponseHeader header = 1;
|
||||
}
|
||||
|
||||
message AuthRoleGetResponse {
|
||||
ResponseHeader header = 1;
|
||||
|
||||
repeated authpb.Permission perm = 2;
|
||||
}
|
||||
|
||||
message AuthRoleListResponse {
|
||||
ResponseHeader header = 1;
|
||||
|
||||
repeated string roles = 2;
|
||||
}
|
||||
|
||||
message AuthUserListResponse {
|
||||
ResponseHeader header = 1;
|
||||
|
||||
repeated string users = 2;
|
||||
}
|
||||
|
||||
message AuthRoleDeleteResponse {
|
||||
ResponseHeader header = 1;
|
||||
}
|
||||
|
||||
message AuthRoleGrantPermissionResponse {
|
||||
ResponseHeader header = 1;
|
||||
}
|
||||
|
||||
message AuthRoleRevokePermissionResponse {
|
||||
ResponseHeader header = 1;
|
||||
}
|
||||
29
_vendor/vendor/github.com/coreos/etcd/main.go
generated
vendored
Normal file
29
_vendor/vendor/github.com/coreos/etcd/main.go
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
// Copyright 2015 The etcd Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Package main is a simple wrapper of the real etcd entrypoint package
|
||||
// (located at github.com/coreos/etcd/etcdmain) to ensure that etcd is still
|
||||
// "go getable"; e.g. `go get github.com/coreos/etcd` works as expected and
|
||||
// builds a binary in $GOBIN/etcd
|
||||
//
|
||||
// This package should NOT be extended or modified in any way; to modify the
|
||||
// etcd binary, work in the `github.com/coreos/etcd/etcdmain` package.
|
||||
//
|
||||
package main
|
||||
|
||||
import "github.com/coreos/etcd/etcdmain"
|
||||
|
||||
func main() {
|
||||
etcdmain.Main()
|
||||
}
|
||||
49
_vendor/vendor/github.com/coreos/etcd/mvcc/mvccpb/kv.proto
generated
vendored
49
_vendor/vendor/github.com/coreos/etcd/mvcc/mvccpb/kv.proto
generated
vendored
@ -1,49 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package mvccpb;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.marshaler_all) = true;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = true;
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
option (gogoproto.goproto_enum_prefix_all) = false;
|
||||
|
||||
message KeyValue {
|
||||
// key is the key in bytes. An empty key is not allowed.
|
||||
bytes key = 1;
|
||||
// create_revision is the revision of last creation on this key.
|
||||
int64 create_revision = 2;
|
||||
// mod_revision is the revision of last modification on this key.
|
||||
int64 mod_revision = 3;
|
||||
// version is the version of the key. A deletion resets
|
||||
// the version to zero and any modification of the key
|
||||
// increases its version.
|
||||
int64 version = 4;
|
||||
// value is the value held by the key, in bytes.
|
||||
bytes value = 5;
|
||||
// lease is the ID of the lease that attached to key.
|
||||
// When the attached lease expires, the key will be deleted.
|
||||
// If lease is 0, then no lease is attached to the key.
|
||||
int64 lease = 6;
|
||||
}
|
||||
|
||||
message Event {
|
||||
enum EventType {
|
||||
PUT = 0;
|
||||
DELETE = 1;
|
||||
}
|
||||
// type is the kind of event. If type is a PUT, it indicates
|
||||
// new data has been stored to the key. If type is a DELETE,
|
||||
// it indicates the key was deleted.
|
||||
EventType type = 1;
|
||||
// kv holds the KeyValue for the event.
|
||||
// A PUT event contains current kv pair.
|
||||
// A PUT event with kv.Version=1 indicates the creation of a key.
|
||||
// A DELETE/EXPIRE event contains the deleted key with
|
||||
// its modification revision set to the revision of deletion.
|
||||
KeyValue kv = 2;
|
||||
|
||||
// prev_kv holds the key-value pair before the event happens.
|
||||
KeyValue prev_kv = 3;
|
||||
}
|
||||
250
_vendor/vendor/github.com/cznic/golex/doc.go
generated
vendored
Normal file
250
_vendor/vendor/github.com/cznic/golex/doc.go
generated
vendored
Normal file
@ -0,0 +1,250 @@
|
||||
// Copyright (c) 2014 The golex Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Golex is a lex/flex like (not fully POSIX lex compatible) utility.
|
||||
// It renders .l formated data (http://flex.sourceforge.net/manual/Format.html#Format) to Go source code.
|
||||
// The .l data can come from a file named in a command line argument.
|
||||
// If no non-opt args are given, golex reads stdin.
|
||||
//
|
||||
// Options:
|
||||
// -DFA print the DFA to stdout and quit
|
||||
// -nodfaopt disable DFA optimization - don't use this for production code
|
||||
// -o fname write to file `fname`, default is `lex.yy.go`
|
||||
// -t write to stdout
|
||||
// -v write some scanner statistics to stderr
|
||||
// -32bit assume unicode rune lexer (partially implemented, disabled)
|
||||
//
|
||||
// To get the latest golex version:
|
||||
//
|
||||
// $ go get -u github.com/cznic/golex
|
||||
//
|
||||
// Run time library
|
||||
//
|
||||
// Please see http://godoc.org/github.com/cznic/golex/lex.
|
||||
//
|
||||
// Changelog
|
||||
//
|
||||
// 2014-11-18: Golex now supports %yym - a hook which can be used to mark an
|
||||
// accepting state.
|
||||
//
|
||||
// Implementing POSIX-like longest match
|
||||
//
|
||||
// Consider for example this .l file:
|
||||
//
|
||||
// $ cat main.l
|
||||
// %{
|
||||
// package main
|
||||
//
|
||||
// import (
|
||||
// "flag"
|
||||
// "fmt"
|
||||
// )
|
||||
//
|
||||
// var (
|
||||
// c byte
|
||||
// src string
|
||||
// in []byte
|
||||
// un []byte
|
||||
// mark int
|
||||
// )
|
||||
//
|
||||
// func lex() (s string) {
|
||||
// %}
|
||||
//
|
||||
// %yyn next()
|
||||
// %yyc c
|
||||
// %yym fmt.Printf("\tstate accepts: %q\n", in); mark = len(in)
|
||||
//
|
||||
// %%
|
||||
// in = in[:0]
|
||||
// mark = -1
|
||||
//
|
||||
// \0
|
||||
// return "EOF"
|
||||
//
|
||||
// a([bcd]*z([efg]*z)?)?
|
||||
// return fmt.Sprintf("match(%q)", in)
|
||||
//
|
||||
// %%
|
||||
// if mark >= 0 {
|
||||
// if len(in) > mark {
|
||||
// unget(c)
|
||||
// for i := len(in)-1; i >= mark; i-- {
|
||||
// unget(in[i])
|
||||
// }
|
||||
// next()
|
||||
// }
|
||||
// in = in[:mark]
|
||||
// goto yyAction // Hook: Execute the semantic action of the last matched rule.
|
||||
// }
|
||||
//
|
||||
// switch n := len(in); n {
|
||||
// case 0: // [] z
|
||||
// s = fmt.Sprintf("%q", c)
|
||||
// next()
|
||||
// case 1: // [x] z
|
||||
// s = fmt.Sprintf("%q", in[0])
|
||||
// default: // [x, y, ...], z
|
||||
// s = fmt.Sprintf("%q", in[0])
|
||||
// unget(c) // z
|
||||
// for i := n - 1; i > 1; i-- {
|
||||
// unget(in[i]) // ...
|
||||
// }
|
||||
// c = in[1] // y
|
||||
// }
|
||||
// return s
|
||||
// }
|
||||
//
|
||||
// func next() {
|
||||
// if len(un) != 0 {
|
||||
// c = un[len(un)-1]
|
||||
// un = un[:len(un)-1]
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// in = append(in, c)
|
||||
// if len(src) == 0 {
|
||||
// c = 0
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// c = src[0]
|
||||
// fmt.Printf("\tnext: %q\n", c)
|
||||
// src = src[1:]
|
||||
// }
|
||||
//
|
||||
// func unget(b byte) {
|
||||
// un = append(un, b)
|
||||
// }
|
||||
//
|
||||
// func main() {
|
||||
// flag.Parse()
|
||||
// if flag.NArg() > 0 {
|
||||
// src = flag.Arg(0)
|
||||
// }
|
||||
// next()
|
||||
// for {
|
||||
// s := lex()
|
||||
// fmt.Println(s)
|
||||
// if s == "EOF" {
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// $
|
||||
//
|
||||
// Execution and output:
|
||||
//
|
||||
// $ golex -o main.go main.l && go run main.go abzez0abzefgxy
|
||||
// next: 'a'
|
||||
// next: 'b'
|
||||
// state accepts: "a"
|
||||
// next: 'z'
|
||||
// next: 'e'
|
||||
// state accepts: "abz"
|
||||
// next: 'z'
|
||||
// next: '0'
|
||||
// state accepts: "abzez"
|
||||
// match("abzez")
|
||||
// next: 'a'
|
||||
// '0'
|
||||
// next: 'b'
|
||||
// state accepts: "a"
|
||||
// next: 'z'
|
||||
// next: 'e'
|
||||
// state accepts: "abz"
|
||||
// next: 'f'
|
||||
// next: 'g'
|
||||
// next: 'x'
|
||||
// match("abz")
|
||||
// 'e'
|
||||
// 'f'
|
||||
// 'g'
|
||||
// next: 'y'
|
||||
// 'x'
|
||||
// 'y'
|
||||
// state accepts: "\x00"
|
||||
// EOF
|
||||
// $
|
||||
//
|
||||
// 2014-11-15: Golex's output is now gofmt'ed, if possible.
|
||||
//
|
||||
// Missing/differing functionality of the current renderer (compared to flex):
|
||||
// - No runtime tokenizer package/environment
|
||||
// (but the freedom to have/write any fitting one's specific task(s)).
|
||||
// - The generated FSM picks the rules in the order of their appearance in the .l source,
|
||||
// but "flex picks the rule that matches the most text".
|
||||
// - And probably more.
|
||||
// Further limitations on the .l source are listed in the cznic/lex package godocs.
|
||||
//
|
||||
// A simple golex program example (make example1 && ./example1):
|
||||
//
|
||||
// %{
|
||||
// package main
|
||||
//
|
||||
// import (
|
||||
// "bufio"
|
||||
// "fmt"
|
||||
// "log"
|
||||
// "os"
|
||||
// )
|
||||
//
|
||||
// var (
|
||||
// src = bufio.NewReader(os.Stdin)
|
||||
// buf []byte
|
||||
// current byte
|
||||
// )
|
||||
//
|
||||
// func getc() byte {
|
||||
// if current != 0 {
|
||||
// buf = append(buf, current)
|
||||
// }
|
||||
// current = 0
|
||||
// if b, err := src.ReadByte(); err == nil {
|
||||
// current = b
|
||||
// }
|
||||
// return current
|
||||
// }
|
||||
//
|
||||
// // %yyc is a "macro" to access the "current" character.
|
||||
// //
|
||||
// // %yyn is a "macro" to move to the "next" character.
|
||||
// //
|
||||
// // %yyb is a "macro" to return the begining-of-line status (a bool typed value).
|
||||
// // It is used for patterns like `^re`.
|
||||
// // Example: %yyb prev == 0 || prev == '\n'
|
||||
// //
|
||||
// // %yyt is a "macro" to return the top/current start condition (an int typed value).
|
||||
// // It is used when there are patterns with conditions like `<cond>re`.
|
||||
// // Example: %yyt startCond
|
||||
//
|
||||
// func main() { // This left brace is closed by *1
|
||||
// c := getc() // init
|
||||
// %}
|
||||
//
|
||||
// %yyc c
|
||||
// %yyn c = getc()
|
||||
//
|
||||
// D [0-9]+
|
||||
//
|
||||
// %%
|
||||
// buf = buf[:0] // Code before the first rule is executed before every scan cycle (state 0 action)
|
||||
//
|
||||
// [ \t\n\r]+ // Ignore whitespace
|
||||
//
|
||||
// {D} fmt.Printf("int %q\n", buf)
|
||||
//
|
||||
// {D}\.{D}?|\.{D} fmt.Printf("float %q\n", buf)
|
||||
//
|
||||
// \0 return // Exit on EOF or any other error
|
||||
//
|
||||
// . fmt.Printf("%q\n", buf) // Printout any other unrecognized stuff
|
||||
//
|
||||
// %%
|
||||
// // The rendered scanner enters top of the user code section when
|
||||
// // lexem recongition fails. In this example it should never happen.
|
||||
// log.Fatal("scanner internal error")
|
||||
//
|
||||
// } // *1 this right brace
|
||||
package main
|
||||
53
_vendor/vendor/github.com/cznic/golex/lex/Makefile
generated
vendored
53
_vendor/vendor/github.com/cznic/golex/lex/Makefile
generated
vendored
@ -1,53 +0,0 @@
|
||||
# Copyright (c) 2015 The golex Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
.PHONY: all clean cover cpu editor internalError later mem nuke todo
|
||||
|
||||
grep=--include=*.go --include=*.l --include=*.y
|
||||
|
||||
all: editor
|
||||
go vet || true
|
||||
golint || true
|
||||
make todo
|
||||
|
||||
clean:
|
||||
go clean
|
||||
rm -f *~ cpu.test mem.test
|
||||
|
||||
cover:
|
||||
t=$(shell tempfile) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t
|
||||
|
||||
cpu:
|
||||
go test -c -o cpu.test
|
||||
./cpu.test -noerr -test.cpuprofile cpu.out
|
||||
go tool pprof --lines cpu.test cpu.out
|
||||
|
||||
editor: example_test.go
|
||||
gofmt -l -s -w *.go
|
||||
go test
|
||||
go install
|
||||
|
||||
example_test.go: example.l
|
||||
golex -o $@ $<
|
||||
|
||||
internalError:
|
||||
egrep -ho '"internal error.*"' *.go | sort | cat -n
|
||||
|
||||
later:
|
||||
@grep -n $(grep) LATER * || true
|
||||
@grep -n $(grep) MAYBE * || true
|
||||
|
||||
mem:
|
||||
go test -c -o mem.test
|
||||
./mem.test -test.bench . -test.memprofile mem.out
|
||||
go tool pprof --lines --web --alloc_space mem.test mem.out
|
||||
|
||||
nuke: clean
|
||||
go clean -i
|
||||
|
||||
todo:
|
||||
@grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * || true
|
||||
@grep -nr $(grep) TODO * || true
|
||||
@grep -nr $(grep) BUG * || true
|
||||
@grep -nr $(grep) [^[:alpha:]]println * || true
|
||||
35
_vendor/vendor/github.com/cznic/golex/lex/dfa
generated
vendored
35
_vendor/vendor/github.com/cznic/golex/lex/dfa
generated
vendored
@ -1,35 +0,0 @@
|
||||
$ golex -DFA example.l
|
||||
StartConditions:
|
||||
INITIAL, scId:0, stateId:1
|
||||
DFA:
|
||||
[1]
|
||||
"\t"..."\n", "\r", " ", --> 2
|
||||
"0"..."9", --> 3
|
||||
"A"..."Z", "_", "a"..."e", "g"..."z", "\u0080", --> 4
|
||||
"f"--> 5
|
||||
[2]
|
||||
"\t"..."\n", "\r", " ", --> 2
|
||||
[3]
|
||||
"0"..."9", --> 3
|
||||
[4]
|
||||
"0"..."9", "A"..."Z", "_", "a"..."z", "\u0080"..."\u0081", --> 4
|
||||
[5]
|
||||
"0"..."9", "A"..."Z", "_", "a"..."t", "v"..."z", "\u0080"..."\u0081", --> 4
|
||||
"u"--> 6
|
||||
[6]
|
||||
"0"..."9", "A"..."Z", "_", "a"..."m", "o"..."z", "\u0080"..."\u0081", --> 4
|
||||
"n"--> 7
|
||||
[7]
|
||||
"0"..."9", "A"..."Z", "_", "a"..."b", "d"..."z", "\u0080"..."\u0081", --> 4
|
||||
"c"--> 8
|
||||
[8]
|
||||
"0"..."9", "A"..."Z", "_", "a"..."z", "\u0080"..."\u0081", --> 4
|
||||
state 2 accepts rule 1
|
||||
state 3 accepts rule 4
|
||||
state 4 accepts rule 3
|
||||
state 5 accepts rule 3
|
||||
state 6 accepts rule 3
|
||||
state 7 accepts rule 3
|
||||
state 8 accepts rule 2
|
||||
|
||||
$
|
||||
175
_vendor/vendor/github.com/cznic/golex/lex/example.l
generated
vendored
175
_vendor/vendor/github.com/cznic/golex/lex/example.l
generated
vendored
@ -1,175 +0,0 @@
|
||||
%yyc c
|
||||
%yyn c = l.Next()
|
||||
%yym l.Mark()
|
||||
|
||||
%{
|
||||
// Copyright (c) 2015 The golex 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 is an example program using golex run time library. It is generated by
|
||||
//
|
||||
// $ golex -o example_test.go example.l
|
||||
//
|
||||
// The complete input file, example.l, is at [3], the scan function excerpt is:
|
||||
//
|
||||
// func (l *lexer) scan() lex.Char {
|
||||
// c := l.Enter()
|
||||
// %}
|
||||
//
|
||||
// digit [0-9]|{unicodeDigit}
|
||||
// identifier {letter}({letter}|{digit})*
|
||||
// int [0-9]+
|
||||
// letter [_a-zA-Z]|{unicodeLetter}
|
||||
// unicodeDigit \x81
|
||||
// unicodeLetter \x80
|
||||
//
|
||||
// %%
|
||||
//
|
||||
// c = l.Rule0()
|
||||
//
|
||||
// [ \t\r\n]+
|
||||
//
|
||||
// func return l.char(FUNC)
|
||||
// {identifier} return l.char(IDENT)
|
||||
// {int} return l.char(INT)
|
||||
//
|
||||
//
|
||||
// %%
|
||||
// if c, ok := l.Abort(); ok {
|
||||
// return l.char(c)
|
||||
// }
|
||||
//
|
||||
// goto yyAction
|
||||
// }
|
||||
package lex_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"go/token"
|
||||
"unicode"
|
||||
|
||||
"github.com/cznic/golex/lex"
|
||||
)
|
||||
|
||||
// Allocate Character classes anywhere in [0x80, 0xFF].
|
||||
const (
|
||||
classUnicodeLeter = iota + 0x80
|
||||
classUnicodeDigit
|
||||
classOther
|
||||
)
|
||||
|
||||
// Parser token values.
|
||||
const (
|
||||
FUNC = iota + 0xE002
|
||||
INT
|
||||
IDENT
|
||||
)
|
||||
|
||||
// For pretty printing.
|
||||
func str(r rune) string {
|
||||
switch r {
|
||||
case FUNC:
|
||||
return "FUNC"
|
||||
case INT:
|
||||
return "INT"
|
||||
case IDENT:
|
||||
return "IDENT"
|
||||
case lex.RuneEOF:
|
||||
return "EOF"
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%q", r)
|
||||
}
|
||||
|
||||
type lexer struct {
|
||||
*lex.Lexer
|
||||
}
|
||||
|
||||
func (l *lexer) char(r int) lex.Char {
|
||||
return lex.NewChar(l.First.Pos(), rune(r))
|
||||
}
|
||||
|
||||
func rune2Class(r rune) int {
|
||||
if r >= 0 && r < 0x80 { // Keep ASCII as it is.
|
||||
return int(r)
|
||||
}
|
||||
|
||||
if unicode.IsLetter(r) {
|
||||
return classUnicodeLeter
|
||||
}
|
||||
|
||||
if unicode.IsDigit(r) {
|
||||
return classUnicodeDigit
|
||||
}
|
||||
|
||||
return classOther
|
||||
}
|
||||
|
||||
const src = `
|
||||
|
||||
func Xφ42() int { return 314 }
|
||||
|
||||
`
|
||||
|
||||
func Example_completeGeneratedProgram() { // main
|
||||
fset := token.NewFileSet()
|
||||
file := fset.AddFile("example.go", -1, len(src))
|
||||
src := bytes.NewBufferString(src)
|
||||
lx, err := lex.New(file, src, lex.RuneClass(rune2Class))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
l := &lexer{lx}
|
||||
for {
|
||||
c := l.scan()
|
||||
fmt.Printf("%v: %v %q\n", file.Position(c.Pos()), str(c.Rune), l.TokenBytes(nil))
|
||||
if c.Rune == lex.RuneEOF {
|
||||
return
|
||||
}
|
||||
}
|
||||
// Output:
|
||||
// example.go:3:1: FUNC "func"
|
||||
// example.go:3:6: IDENT "Xφ42"
|
||||
// example.go:3:11: '(' "("
|
||||
// example.go:3:12: ')' ")"
|
||||
// example.go:3:14: IDENT "int"
|
||||
// example.go:3:18: '{' "{"
|
||||
// example.go:3:20: IDENT "return"
|
||||
// example.go:3:27: INT "314"
|
||||
// example.go:3:31: '}' "}"
|
||||
// example.go:4:2: EOF "\xff"
|
||||
}
|
||||
|
||||
|
||||
func (l *lexer) scan() lex.Char {
|
||||
c := l.Enter()
|
||||
%}
|
||||
|
||||
digit [0-9]|{unicodeDigit}
|
||||
identifier {letter}({letter}|{digit})*
|
||||
int [0-9]+
|
||||
letter [_a-zA-Z]|{unicodeLetter}
|
||||
unicodeDigit \x81
|
||||
unicodeLetter \x80
|
||||
|
||||
%%
|
||||
|
||||
c = l.Rule0()
|
||||
|
||||
[ \t\r\n]+
|
||||
|
||||
func return l.char(FUNC)
|
||||
{identifier} return l.char(IDENT)
|
||||
{int} return l.char(INT)
|
||||
|
||||
|
||||
%%
|
||||
if c, ok := l.Abort(); ok {
|
||||
return l.char(c)
|
||||
}
|
||||
|
||||
goto yyAction
|
||||
}
|
||||
152
_vendor/vendor/github.com/cznic/golex/main.go
generated
vendored
Normal file
152
_vendor/vendor/github.com/cznic/golex/main.go
generated
vendored
Normal file
@ -0,0 +1,152 @@
|
||||
// Copyright (c) 2014 The golex Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"flag"
|
||||
"fmt"
|
||||
"go/format"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/cznic/lex"
|
||||
)
|
||||
|
||||
const (
|
||||
OFILE = "lex.yy.go"
|
||||
)
|
||||
|
||||
var (
|
||||
stdin = bufio.NewReader(os.Stdin)
|
||||
stdout = bufio.NewWriter(os.Stdout)
|
||||
stderr = bufio.NewWriter(os.Stderr)
|
||||
)
|
||||
|
||||
type renderer interface {
|
||||
render(srcname string, l *lex.L)
|
||||
}
|
||||
|
||||
type writer interface {
|
||||
io.Writer
|
||||
wprintf(s string, args ...interface{}) (n int, err error)
|
||||
}
|
||||
|
||||
type noRender struct {
|
||||
w io.Writer
|
||||
}
|
||||
|
||||
func (r *noRender) Write(p []byte) (n int, err error) {
|
||||
return r.w.Write(p)
|
||||
}
|
||||
|
||||
func (r *noRender) wprintf(s string, args ...interface{}) (n int, err error) {
|
||||
n, err = io.WriteString(r.w, fmt.Sprintf(s, args...))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func q(c uint32) string {
|
||||
switch c {
|
||||
default:
|
||||
s := fmt.Sprintf("%q", string(c))
|
||||
return "'" + s[1:len(s)-1] + "'"
|
||||
case '\'':
|
||||
return "'\\''"
|
||||
case '"':
|
||||
return "'\"'"
|
||||
}
|
||||
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
func main() {
|
||||
log.SetFlags(log.Flags() | log.Lshortfile)
|
||||
oflag := ""
|
||||
var dfaflag, hflag, tflag, vflag, nodfaopt, bits32 bool
|
||||
|
||||
flag.BoolVar(&dfaflag, "DFA", false, "write DFA on stdout and quit")
|
||||
flag.BoolVar(&hflag, "h", false, "show help and exit")
|
||||
flag.StringVar(&oflag, "o", OFILE, "lexer output")
|
||||
flag.BoolVar(&tflag, "t", false, "write scanner on stdout instead of "+OFILE)
|
||||
flag.BoolVar(&vflag, "v", false, "write summary of scanner statistics to stderr")
|
||||
flag.BoolVar(&nodfaopt, "nodfaopt", false, "disable DFA optimization - don't use this for production code")
|
||||
//flag.BoolVar(&bits32, "32bit", false, "assume unicode rune lexer (partially implemented)")
|
||||
flag.Parse()
|
||||
if hflag || flag.NArg() > 1 {
|
||||
flag.Usage()
|
||||
fmt.Fprintf(stderr, "\n%s [-o out_name] [other_options] [in_name]\n", os.Args[0])
|
||||
fmt.Fprintln(stderr, " If no in_name is given then read from stdin.")
|
||||
stderr.Flush()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
var (
|
||||
lfile *bufio.Reader // source .l
|
||||
gofile *bufio.Writer // dest .go
|
||||
)
|
||||
|
||||
lname := flag.Arg(0)
|
||||
if lname == "" {
|
||||
lfile = stdin
|
||||
} else {
|
||||
l, err := os.Open(lname)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
defer l.Close()
|
||||
lfile = bufio.NewReader(l)
|
||||
}
|
||||
|
||||
l, err := lex.NewL(lname, lfile, nodfaopt, bits32)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if dfaflag {
|
||||
fmt.Println(l.DfaString())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if tflag {
|
||||
gofile = stdout
|
||||
} else {
|
||||
if oflag == "" {
|
||||
oflag = OFILE
|
||||
}
|
||||
g, err := os.Create(oflag)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
defer g.Close()
|
||||
gofile = bufio.NewWriter(g)
|
||||
}
|
||||
defer gofile.Flush()
|
||||
var buf bytes.Buffer
|
||||
renderGo{noRender{&buf}, map[int]bool{}}.render(lname, l)
|
||||
dst, err := format.Source(buf.Bytes())
|
||||
switch {
|
||||
case err != nil:
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
if _, err := gofile.Write(buf.Bytes()); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
default:
|
||||
if _, err := gofile.Write(dst); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
if vflag {
|
||||
fmt.Fprintln(os.Stderr, l.String())
|
||||
}
|
||||
}
|
||||
280
_vendor/vendor/github.com/cznic/golex/render.go
generated
vendored
Normal file
280
_vendor/vendor/github.com/cznic/golex/render.go
generated
vendored
Normal file
@ -0,0 +1,280 @@
|
||||
// Copyright (c) 2014 The golex Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/cznic/lex"
|
||||
"github.com/cznic/lexer"
|
||||
"log"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type renderGo struct {
|
||||
noRender
|
||||
scStates map[int]bool
|
||||
}
|
||||
|
||||
func (r *renderGo) prolog(l *lex.L) {
|
||||
for _, state := range l.StartConditionsStates {
|
||||
r.scStates[int(state.Index)] = true
|
||||
}
|
||||
for _, state := range l.StartConditionsBolStates {
|
||||
r.scStates[int(state.Index)] = true
|
||||
}
|
||||
r.w.Write([]byte("// CAUTION: Generated file - DO NOT EDIT.\n\n"))
|
||||
for _, line := range l.DefCode {
|
||||
r.w.Write([]byte(line))
|
||||
}
|
||||
r.wprintf("\nyystate0:\n")
|
||||
if l.YYM != "yym" {
|
||||
r.wprintf("yyrule := -1\n_ = yyrule")
|
||||
}
|
||||
if action0 := l.Rules[0].Action; action0 != "" {
|
||||
r.w.Write([]byte(action0))
|
||||
}
|
||||
scNames := map[int]string{}
|
||||
for name, i := range l.StartConditions {
|
||||
scNames[i] = name
|
||||
}
|
||||
if len(l.StartConditionsStates) > 1 || len(l.StartConditionsBolStates) != 0 {
|
||||
if len(l.StartConditionsBolStates) == 0 {
|
||||
r.wprintf("\n\nswitch yyt := %s; yyt {\n", l.YYT)
|
||||
} else {
|
||||
r.wprintf("\n\nswitch yyt, yyb := %s, %s; yyt {\n", l.YYT, l.YYB)
|
||||
}
|
||||
r.wprintf("default:\npanic(fmt.Errorf(`invalid start condition %%d`, yyt))\n")
|
||||
|
||||
// Stabilize map ranging
|
||||
x := []int{}
|
||||
for sc := range l.StartConditionsStates {
|
||||
x = append(x, sc)
|
||||
}
|
||||
sort.Ints(x)
|
||||
|
||||
for _, sc := range x {
|
||||
state := l.StartConditionsStates[sc]
|
||||
r.wprintf("case %d: // start condition: %s\n", sc, scNames[sc])
|
||||
if state, ok := l.StartConditionsBolStates[sc]; ok {
|
||||
r.wprintf("if yyb { goto yystart%d }\n", state.Index)
|
||||
}
|
||||
r.wprintf("goto yystart%d\n", state.Index)
|
||||
}
|
||||
r.wprintf("}\n\n")
|
||||
} else {
|
||||
r.wprintf("\n\ngoto yystart%d\n\n", l.StartConditionsStates[0].Index)
|
||||
}
|
||||
}
|
||||
|
||||
func isReturn(code string) bool {
|
||||
const ret = "return"
|
||||
lenret := len(ret)
|
||||
lines := strings.Split(code, "\n")
|
||||
for {
|
||||
l := len(lines)
|
||||
if l == 0 {
|
||||
break
|
||||
}
|
||||
|
||||
line := strings.TrimSpace(lines[l-1])
|
||||
if line == "" {
|
||||
lines = lines[:l-1]
|
||||
continue
|
||||
}
|
||||
|
||||
if len(line) >= lenret && line[:lenret] == ret {
|
||||
if len(line) == lenret {
|
||||
return true
|
||||
}
|
||||
|
||||
if c := line[lenret]; c == ' ' || c == '\t' {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
break
|
||||
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (r *renderGo) rules(l *lex.L) {
|
||||
for i := 1; i < len(l.Rules); i++ {
|
||||
rule := l.Rules[i]
|
||||
r.wprintf("yyrule%d: // %s\n", i, rule.Pattern)
|
||||
act := strings.TrimSpace(rule.Action)
|
||||
if act != "" && act != "|" {
|
||||
r.wprintf("{\n")
|
||||
r.w.Write([]byte(rule.Action))
|
||||
}
|
||||
if act != "|" {
|
||||
r.wprintf("\n")
|
||||
if !isReturn(rule.Action) {
|
||||
r.wprintf("goto yystate0\n")
|
||||
}
|
||||
}
|
||||
if act != "" && act != "|" {
|
||||
r.wprintf("}\n")
|
||||
}
|
||||
}
|
||||
r.wprintf(`panic("unreachable")` + "\n")
|
||||
}
|
||||
|
||||
func (r *renderGo) scanFail(l *lex.L) {
|
||||
r.wprintf("\ngoto yyabort // silence unused label error\n")
|
||||
r.wprintf("\nyyabort: // no lexem recognized\n")
|
||||
}
|
||||
|
||||
func (r *renderGo) userCode(l *lex.L) {
|
||||
if userCode := l.UserCode; userCode != "" {
|
||||
r.w.Write([]byte(userCode))
|
||||
}
|
||||
}
|
||||
|
||||
func (r *renderGo) defaultTransition(l *lex.L, state *lexer.NfaState) (defaultEdge *lexer.RangesEdge) {
|
||||
r.wprintf("default:\n")
|
||||
if rule, ok := l.Accepts[state]; ok {
|
||||
r.wprintf("goto yyrule%d\n", rule)
|
||||
return
|
||||
}
|
||||
|
||||
cases := map[rune]bool{}
|
||||
for i := 0; i < 256; i++ {
|
||||
cases[rune(i)] = true
|
||||
}
|
||||
for _, edge0 := range state.Consuming {
|
||||
switch edge := edge0.(type) {
|
||||
default:
|
||||
log.Fatalf("unexpected type %T", edge0)
|
||||
case *lexer.RuneEdge:
|
||||
delete(cases, edge.Rune)
|
||||
case *lexer.RangesEdge:
|
||||
if defaultEdge == nil || len(edge.Ranges.R32) > len(defaultEdge.Ranges.R32) {
|
||||
defaultEdge = edge
|
||||
}
|
||||
for _, rng := range edge.Ranges.R32 {
|
||||
for c := rng.Lo; c <= rng.Hi; c += rng.Stride {
|
||||
delete(cases, rune(c))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(cases) != 0 {
|
||||
r.wprintf("goto yyabort\n")
|
||||
return nil
|
||||
}
|
||||
|
||||
if defaultEdge != nil {
|
||||
r.wprintf("goto yystate%d // %s\n", defaultEdge.Target().Index, r.rangesEdgeString(defaultEdge, l))
|
||||
return
|
||||
}
|
||||
|
||||
panic("internal error")
|
||||
}
|
||||
|
||||
func (r *renderGo) rangesEdgeString(edge *lexer.RangesEdge, l *lex.L) string {
|
||||
a := []string{}
|
||||
for _, rng := range edge.Ranges.R32 {
|
||||
if rng.Stride != 1 {
|
||||
panic("internal error")
|
||||
}
|
||||
|
||||
if rng.Hi-rng.Lo == 1 {
|
||||
a = append(a, fmt.Sprintf("%s == %s || %s == %s", l.YYC, q(rng.Lo), l.YYC, q(rng.Hi)))
|
||||
continue
|
||||
}
|
||||
|
||||
if rng.Hi-rng.Lo > 0 {
|
||||
a = append(a, fmt.Sprintf("%s >= %s && %s <= %s", l.YYC, q(rng.Lo), l.YYC, q(rng.Hi)))
|
||||
continue
|
||||
}
|
||||
|
||||
// rng.Hi == rng.Lo
|
||||
a = append(a, fmt.Sprintf("%s == %s", l.YYC, q(rng.Lo)))
|
||||
}
|
||||
return strings.Replace(strings.Join(a, " || "), "%", "%%", -1)
|
||||
}
|
||||
|
||||
func (r *renderGo) transitions(l *lex.L, state *lexer.NfaState) {
|
||||
r.wprintf("switch {\n")
|
||||
var defaultEdge lexer.Edger = r.defaultTransition(l, state)
|
||||
|
||||
// Stabilize case order
|
||||
a := []string{}
|
||||
m := map[string]uint{}
|
||||
for _, edge0 := range state.Consuming {
|
||||
if edge0 == defaultEdge {
|
||||
continue
|
||||
}
|
||||
|
||||
s := ""
|
||||
switch edge := edge0.(type) {
|
||||
default:
|
||||
log.Fatalf("unexpected type %T", edge0)
|
||||
case *lexer.RuneEdge:
|
||||
s = fmt.Sprintf("%s == %s", l.YYC, q(uint32(edge.Rune)))
|
||||
case *lexer.RangesEdge:
|
||||
s = fmt.Sprintf(r.rangesEdgeString(edge, l))
|
||||
}
|
||||
a = append(a, s)
|
||||
m[s] = edge0.Target().Index
|
||||
}
|
||||
sort.Strings(a)
|
||||
for _, s := range a {
|
||||
r.wprintf("case %s:\ngoto yystate%d\n", s, m[s])
|
||||
}
|
||||
|
||||
r.wprintf("}\n\n")
|
||||
}
|
||||
|
||||
func (r *renderGo) states(l *lex.L) {
|
||||
yym := l.YYM != "yym"
|
||||
r.wprintf("goto yystate%d // silence unused label error\n", 0)
|
||||
if yym {
|
||||
r.wprintf("goto yyAction // silence unused label error\n")
|
||||
r.wprintf("yyAction:\n")
|
||||
r.wprintf("switch yyrule {\n")
|
||||
for i := range l.Rules[1:] {
|
||||
r.wprintf("case %d:\ngoto yyrule%d\n", i+1, i+1)
|
||||
}
|
||||
r.wprintf("}\n")
|
||||
}
|
||||
for _, state := range l.Dfa {
|
||||
iState := int(state.Index)
|
||||
if _, ok := r.scStates[iState]; ok {
|
||||
r.wprintf("goto yystate%d // silence unused label error\n", iState)
|
||||
}
|
||||
r.wprintf("yystate%d:\n", iState)
|
||||
rule, ok := l.Accepts[state]
|
||||
if !ok || !l.Rules[rule].EOL {
|
||||
r.wprintf("%s\n", l.YYN)
|
||||
}
|
||||
if ok && l.YYM != "yym" {
|
||||
r.wprintf("yyrule = %d\n", rule)
|
||||
r.wprintf("%s\n", l.YYM)
|
||||
}
|
||||
if _, ok := r.scStates[iState]; ok {
|
||||
r.wprintf("yystart%d:\n", iState)
|
||||
}
|
||||
if len(state.Consuming) != 0 {
|
||||
r.transitions(l, state)
|
||||
} else {
|
||||
if rule, ok := l.Accepts[state]; ok {
|
||||
r.wprintf("goto yyrule%d\n\n", rule)
|
||||
} else {
|
||||
panic("internal error")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (r renderGo) render(srcname string, l *lex.L) {
|
||||
r.prolog(l)
|
||||
r.states(l)
|
||||
r.rules(l)
|
||||
r.scanFail(l)
|
||||
r.userCode(l)
|
||||
}
|
||||
12
_vendor/vendor/github.com/cznic/mathutil/AUTHORS
generated
vendored
12
_vendor/vendor/github.com/cznic/mathutil/AUTHORS
generated
vendored
@ -1,12 +0,0 @@
|
||||
# This file lists authors for copyright purposes. This file is distinct from
|
||||
# the CONTRIBUTORS files. See the latter for an explanation.
|
||||
#
|
||||
# Names should be added to this file as:
|
||||
# Name or Organization <email address>
|
||||
#
|
||||
# The email address is not required for organizations.
|
||||
#
|
||||
# Please keep the list sorted.
|
||||
|
||||
CZ.NIC z.s.p.o. <kontakt@nic.cz>
|
||||
Jan Mercl <0xjnml@gmail.com>
|
||||
10
_vendor/vendor/github.com/cznic/mathutil/CONTRIBUTORS
generated
vendored
10
_vendor/vendor/github.com/cznic/mathutil/CONTRIBUTORS
generated
vendored
@ -1,10 +0,0 @@
|
||||
# This file lists people who contributed code to this repository. The AUTHORS
|
||||
# file lists the copyright holders; this file lists people.
|
||||
#
|
||||
# Names should be added to this file like so:
|
||||
# Name <email address>
|
||||
#
|
||||
# Please keep the list sorted.
|
||||
|
||||
Gary Burd <gary@beagledreams.com>
|
||||
Jan Mercl <0xjnml@gmail.com>
|
||||
31
_vendor/vendor/github.com/cznic/mathutil/Makefile
generated
vendored
31
_vendor/vendor/github.com/cznic/mathutil/Makefile
generated
vendored
@ -1,31 +0,0 @@
|
||||
# Copyright (c) 2014 The mathutil Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
.PHONY: all todo clean nuke
|
||||
|
||||
grep=--include=*.go --include=*.run --include=*.y
|
||||
|
||||
all: editor
|
||||
go build
|
||||
go vet || true
|
||||
golint .
|
||||
go install
|
||||
make todo
|
||||
|
||||
clean:
|
||||
go clean
|
||||
|
||||
editor:
|
||||
go fmt
|
||||
go test -i
|
||||
go test
|
||||
|
||||
todo:
|
||||
@grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * || true
|
||||
@grep -nr $(grep) TODO * || true
|
||||
@grep -nr $(grep) BUG * || true
|
||||
@grep -nr $(grep) println * || true
|
||||
|
||||
nuke: clean
|
||||
go clean -i
|
||||
10
_vendor/vendor/github.com/cznic/mathutil/README
generated
vendored
10
_vendor/vendor/github.com/cznic/mathutil/README
generated
vendored
@ -1,10 +0,0 @@
|
||||
This is a goinstall-able mirror of modified code already published at:
|
||||
http://git.nic.cz/redmine/projects/gornd/repository
|
||||
|
||||
Packages in this repository:
|
||||
|
||||
Install: $ go get github.com/cznic/mathutil
|
||||
Godocs: http://godoc.org/github.com/cznic/mathutil
|
||||
|
||||
Install: $ go get github.com/cznic/mathutil/mersenne
|
||||
Godocs: http://godoc.org/github.com/cznic/mathutil/mersenne
|
||||
267
_vendor/vendor/github.com/cznic/mathutil/nist-sts-2-1-1-report
generated
vendored
267
_vendor/vendor/github.com/cznic/mathutil/nist-sts-2-1-1-report
generated
vendored
@ -1,267 +0,0 @@
|
||||
$ ./example -max 100000000 > rnd.dat
|
||||
$ ./assess 1000000
|
||||
G E N E R A T O R S E L E C T I O N
|
||||
______________________________________
|
||||
|
||||
[0] Input File [1] Linear Congruential
|
||||
[2] Quadratic Congruential I [3] Quadratic Congruential II
|
||||
[4] Cubic Congruential [5] XOR
|
||||
[6] Modular Exponentiation [7] Blum-Blum-Shub
|
||||
[8] Micali-Schnorr [9] G Using SHA-1
|
||||
|
||||
Enter Choice: 0
|
||||
|
||||
|
||||
User Prescribed Input File: rnd.dat
|
||||
|
||||
S T A T I S T I C A L T E S T S
|
||||
_________________________________
|
||||
|
||||
[01] Frequency [02] Block Frequency
|
||||
[03] Cumulative Sums [04] Runs
|
||||
[05] Longest Run of Ones [06] Rank
|
||||
[07] Discrete Fourier Transform [08] Nonperiodic Template Matchings
|
||||
[09] Overlapping Template Matchings [10] Universal Statistical
|
||||
[11] Approximate Entropy [12] Random Excursions
|
||||
[13] Random Excursions Variant [14] Serial
|
||||
[15] Linear Complexity
|
||||
|
||||
INSTRUCTIONS
|
||||
Enter 0 if you DO NOT want to apply all of the
|
||||
statistical tests to each sequence and 1 if you DO.
|
||||
|
||||
Enter Choice: 1
|
||||
|
||||
P a r a m e t e r A d j u s t m e n t s
|
||||
-----------------------------------------
|
||||
[1] Block Frequency Test - block length(M): 128
|
||||
[2] NonOverlapping Template Test - block length(m): 9
|
||||
[3] Overlapping Template Test - block length(m): 9
|
||||
[4] Approximate Entropy Test - block length(m): 10
|
||||
[5] Serial Test - block length(m): 16
|
||||
[6] Linear Complexity Test - block length(M): 500
|
||||
|
||||
Select Test (0 to continue): 0
|
||||
|
||||
How many bitstreams? 200
|
||||
|
||||
Input File Format:
|
||||
[0] ASCII - A sequence of ASCII 0's and 1's
|
||||
[1] Binary - Each byte in data file contains 8 bits of data
|
||||
|
||||
Select input mode: 1
|
||||
|
||||
Statistical Testing In Progress.........
|
||||
|
||||
Statistical Testing Complete!!!!!!!!!!!!
|
||||
|
||||
$ cat experiments/AlgorithmTesting/finalAnalysisReport.txt
|
||||
------------------------------------------------------------------------------
|
||||
RESULTS FOR THE UNIFORMITY OF P-VALUES AND THE PROPORTION OF PASSING SEQUENCES
|
||||
------------------------------------------------------------------------------
|
||||
generator is <rnd.dat>
|
||||
------------------------------------------------------------------------------
|
||||
C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 P-VALUE PROPORTION STATISTICAL TEST
|
||||
------------------------------------------------------------------------------
|
||||
28 22 17 19 15 8 24 23 19 25 0.093720 198/200 Frequency
|
||||
20 18 24 14 18 17 16 28 21 24 0.504219 199/200 BlockFrequency
|
||||
25 22 17 24 19 21 22 15 16 19 0.825505 197/200 CumulativeSums
|
||||
27 17 16 22 14 26 14 25 19 20 0.304126 199/200 CumulativeSums
|
||||
22 19 14 23 22 22 13 28 13 24 0.224821 199/200 Runs
|
||||
20 24 18 21 15 13 22 23 24 20 0.719747 197/200 LongestRun
|
||||
22 26 18 22 26 15 17 22 20 12 0.410055 199/200 Rank
|
||||
25 22 26 22 20 16 20 20 16 13 0.585209 195/200 FFT
|
||||
22 11 15 26 33 24 21 13 14 21 0.013102 197/200 NonOverlappingTemplate
|
||||
17 11 16 27 19 24 19 20 28 19 0.219006 200/200 NonOverlappingTemplate
|
||||
23 27 24 15 21 11 18 27 15 19 0.162606 197/200 NonOverlappingTemplate
|
||||
21 18 13 20 19 23 20 17 26 23 0.749884 197/200 NonOverlappingTemplate
|
||||
24 22 24 24 24 21 13 15 17 16 0.494392 196/200 NonOverlappingTemplate
|
||||
24 16 23 15 23 18 25 16 18 22 0.699313 199/200 NonOverlappingTemplate
|
||||
19 23 21 16 27 18 17 20 18 21 0.859637 198/200 NonOverlappingTemplate
|
||||
12 20 16 19 26 14 30 20 24 19 0.141256 198/200 NonOverlappingTemplate
|
||||
18 21 17 21 20 14 25 19 24 21 0.859637 198/200 NonOverlappingTemplate
|
||||
24 25 21 18 23 15 23 17 16 18 0.749884 199/200 NonOverlappingTemplate
|
||||
20 22 22 18 16 22 28 16 14 22 0.574903 198/200 NonOverlappingTemplate
|
||||
18 23 22 17 24 25 19 16 23 13 0.626709 199/200 NonOverlappingTemplate
|
||||
17 22 14 19 21 21 18 19 24 25 0.842937 198/200 NonOverlappingTemplate
|
||||
18 17 26 21 22 15 22 18 21 20 0.883171 197/200 NonOverlappingTemplate
|
||||
19 25 16 32 15 19 20 18 16 20 0.236810 199/200 NonOverlappingTemplate
|
||||
19 18 15 21 24 22 18 21 20 22 0.964295 200/200 NonOverlappingTemplate
|
||||
21 14 17 23 26 19 20 22 20 18 0.834308 196/200 NonOverlappingTemplate
|
||||
15 21 17 27 26 23 21 17 24 9 0.129620 198/200 NonOverlappingTemplate
|
||||
25 17 19 19 18 22 21 22 21 16 0.951205 196/200 NonOverlappingTemplate
|
||||
20 19 24 21 19 24 16 18 17 22 0.946308 197/200 NonOverlappingTemplate
|
||||
27 16 19 18 23 19 22 17 22 17 0.807412 197/200 NonOverlappingTemplate
|
||||
14 18 21 23 23 20 14 22 20 25 0.719747 198/200 NonOverlappingTemplate
|
||||
18 22 19 12 24 25 25 22 18 15 0.474986 198/200 NonOverlappingTemplate
|
||||
21 18 23 17 19 18 28 19 20 17 0.825505 198/200 NonOverlappingTemplate
|
||||
20 19 15 16 27 20 26 17 20 20 0.657933 198/200 NonOverlappingTemplate
|
||||
17 25 21 21 11 19 22 16 27 21 0.401199 198/200 NonOverlappingTemplate
|
||||
19 16 15 18 24 19 25 25 19 20 0.769527 199/200 NonOverlappingTemplate
|
||||
18 20 20 26 20 12 24 25 19 16 0.524101 198/200 NonOverlappingTemplate
|
||||
14 16 18 23 21 21 19 19 28 21 0.668321 197/200 NonOverlappingTemplate
|
||||
21 20 23 25 21 22 19 17 14 18 0.875539 197/200 NonOverlappingTemplate
|
||||
14 16 29 22 23 13 20 29 17 17 0.099513 197/200 NonOverlappingTemplate
|
||||
14 19 27 19 17 23 18 24 20 19 0.709558 199/200 NonOverlappingTemplate
|
||||
18 15 21 19 27 22 21 23 17 17 0.779188 198/200 NonOverlappingTemplate
|
||||
13 23 13 22 22 23 22 21 21 20 0.689019 199/200 NonOverlappingTemplate
|
||||
17 14 26 26 16 21 30 15 21 14 0.096578 199/200 NonOverlappingTemplate
|
||||
18 21 24 23 21 13 23 23 19 15 0.719747 197/200 NonOverlappingTemplate
|
||||
19 21 14 32 20 15 16 18 24 21 0.202268 199/200 NonOverlappingTemplate
|
||||
27 22 20 21 21 14 15 22 14 24 0.474986 196/200 NonOverlappingTemplate
|
||||
31 12 25 11 21 18 19 16 24 23 0.050305 197/200 NonOverlappingTemplate
|
||||
17 26 20 22 15 27 22 19 12 20 0.383827 199/200 NonOverlappingTemplate
|
||||
15 22 14 14 31 15 27 18 23 21 0.078086 194/200 NonOverlappingTemplate
|
||||
19 19 14 15 24 21 25 21 20 22 0.788728 197/200 NonOverlappingTemplate
|
||||
20 21 19 22 25 18 13 24 28 10 0.153763 195/200 NonOverlappingTemplate
|
||||
23 17 21 25 21 20 13 30 14 16 0.196920 196/200 NonOverlappingTemplate
|
||||
17 31 17 22 16 15 28 23 11 20 0.050305 197/200 NonOverlappingTemplate
|
||||
15 21 26 27 15 18 19 21 18 20 0.605916 198/200 NonOverlappingTemplate
|
||||
23 18 15 14 20 21 20 20 20 29 0.554420 200/200 NonOverlappingTemplate
|
||||
22 19 19 18 19 17 22 21 31 12 0.311542 199/200 NonOverlappingTemplate
|
||||
16 22 23 21 19 19 18 24 21 17 0.960198 197/200 NonOverlappingTemplate
|
||||
21 21 17 20 16 23 25 22 18 17 0.917870 200/200 NonOverlappingTemplate
|
||||
27 17 17 16 21 20 22 18 21 21 0.859637 197/200 NonOverlappingTemplate
|
||||
18 24 15 27 18 21 18 16 24 19 0.657933 199/200 NonOverlappingTemplate
|
||||
13 16 21 21 15 25 18 22 29 20 0.326749 198/200 NonOverlappingTemplate
|
||||
18 17 23 23 15 19 26 30 11 18 0.125927 198/200 NonOverlappingTemplate
|
||||
30 21 18 22 17 21 15 17 21 18 0.544254 195/200 NonOverlappingTemplate
|
||||
12 18 19 24 16 24 18 24 28 17 0.311542 199/200 NonOverlappingTemplate
|
||||
20 15 23 15 18 30 23 18 17 21 0.410055 196/200 NonOverlappingTemplate
|
||||
15 18 23 16 29 21 22 16 19 21 0.544254 200/200 NonOverlappingTemplate
|
||||
18 16 27 13 21 22 22 21 16 24 0.534146 199/200 NonOverlappingTemplate
|
||||
20 25 18 21 16 21 17 28 21 13 0.484646 200/200 NonOverlappingTemplate
|
||||
23 22 13 22 14 20 26 18 19 23 0.574903 197/200 NonOverlappingTemplate
|
||||
21 24 25 13 19 22 18 13 24 21 0.504219 199/200 NonOverlappingTemplate
|
||||
19 13 18 25 22 15 23 28 19 18 0.410055 195/200 NonOverlappingTemplate
|
||||
20 15 27 22 26 26 14 13 21 16 0.181557 198/200 NonOverlappingTemplate
|
||||
18 18 19 23 18 20 19 21 24 20 0.991468 200/200 NonOverlappingTemplate
|
||||
18 23 17 14 20 25 22 22 22 17 0.816537 198/200 NonOverlappingTemplate
|
||||
26 15 15 11 23 21 21 16 36 16 0.005557 196/200 NonOverlappingTemplate
|
||||
27 13 21 23 21 16 19 20 16 24 0.544254 198/200 NonOverlappingTemplate
|
||||
16 15 32 17 20 23 22 19 20 16 0.262249 200/200 NonOverlappingTemplate
|
||||
26 19 24 13 24 16 18 18 13 29 0.137282 199/200 NonOverlappingTemplate
|
||||
15 18 14 27 32 21 15 20 19 19 0.112047 198/200 NonOverlappingTemplate
|
||||
22 23 22 18 20 23 19 22 16 15 0.924076 196/200 NonOverlappingTemplate
|
||||
18 17 21 22 14 17 22 24 20 25 0.798139 199/200 NonOverlappingTemplate
|
||||
15 17 19 24 21 23 17 25 23 16 0.739918 196/200 NonOverlappingTemplate
|
||||
22 11 15 26 32 25 21 13 14 21 0.017305 197/200 NonOverlappingTemplate
|
||||
22 16 19 23 22 21 21 19 17 20 0.985788 200/200 NonOverlappingTemplate
|
||||
22 28 18 24 14 20 23 21 20 10 0.230755 198/200 NonOverlappingTemplate
|
||||
14 13 22 28 14 28 17 22 23 19 0.129620 197/200 NonOverlappingTemplate
|
||||
22 16 22 20 21 21 16 19 18 25 0.935716 198/200 NonOverlappingTemplate
|
||||
15 20 23 17 19 22 21 23 18 22 0.951205 200/200 NonOverlappingTemplate
|
||||
20 24 21 19 17 19 19 24 15 22 0.930026 198/200 NonOverlappingTemplate
|
||||
18 21 15 21 17 28 24 22 20 14 0.534146 200/200 NonOverlappingTemplate
|
||||
19 15 19 19 20 20 15 25 23 25 0.779188 198/200 NonOverlappingTemplate
|
||||
17 24 25 16 15 21 18 19 23 22 0.788728 198/200 NonOverlappingTemplate
|
||||
15 20 18 25 24 15 21 31 18 13 0.141256 200/200 NonOverlappingTemplate
|
||||
24 17 19 20 18 21 15 22 24 20 0.924076 196/200 NonOverlappingTemplate
|
||||
23 18 17 21 17 28 23 21 18 14 0.605916 197/200 NonOverlappingTemplate
|
||||
21 19 22 23 16 17 20 21 22 19 0.985788 200/200 NonOverlappingTemplate
|
||||
27 17 21 27 24 15 15 17 15 22 0.304126 199/200 NonOverlappingTemplate
|
||||
25 28 20 24 13 14 16 22 19 19 0.304126 197/200 NonOverlappingTemplate
|
||||
27 16 14 24 22 18 24 20 18 17 0.564639 196/200 NonOverlappingTemplate
|
||||
18 18 24 19 19 19 26 11 27 19 0.375313 195/200 NonOverlappingTemplate
|
||||
20 15 29 19 26 16 21 11 18 25 0.141256 197/200 NonOverlappingTemplate
|
||||
19 14 21 25 11 23 22 25 26 14 0.176657 199/200 NonOverlappingTemplate
|
||||
18 23 20 17 19 18 29 22 26 8 0.102526 199/200 NonOverlappingTemplate
|
||||
22 17 18 16 18 20 19 19 25 26 0.834308 198/200 NonOverlappingTemplate
|
||||
25 18 14 16 16 24 18 18 30 21 0.268917 198/200 NonOverlappingTemplate
|
||||
24 21 23 13 12 22 20 23 20 22 0.554420 196/200 NonOverlappingTemplate
|
||||
18 21 21 30 22 17 19 14 18 20 0.534146 197/200 NonOverlappingTemplate
|
||||
25 20 22 21 15 18 17 20 17 25 0.825505 199/200 NonOverlappingTemplate
|
||||
18 21 22 21 18 20 26 16 20 18 0.941144 197/200 NonOverlappingTemplate
|
||||
23 18 22 25 12 16 17 19 26 22 0.474986 198/200 NonOverlappingTemplate
|
||||
22 18 29 23 19 23 17 17 15 17 0.534146 198/200 NonOverlappingTemplate
|
||||
19 21 17 26 18 15 22 26 15 21 0.626709 197/200 NonOverlappingTemplate
|
||||
16 20 20 23 18 21 18 18 25 21 0.955835 199/200 NonOverlappingTemplate
|
||||
23 21 20 21 22 10 15 27 15 26 0.186566 198/200 NonOverlappingTemplate
|
||||
18 26 20 26 26 18 17 17 20 12 0.358641 198/200 NonOverlappingTemplate
|
||||
24 20 21 18 24 12 19 27 14 21 0.401199 195/200 NonOverlappingTemplate
|
||||
16 25 15 21 24 18 18 25 22 16 0.657933 199/200 NonOverlappingTemplate
|
||||
24 14 17 26 15 17 17 25 21 24 0.428095 200/200 NonOverlappingTemplate
|
||||
22 24 11 20 22 24 19 18 12 28 0.176657 196/200 NonOverlappingTemplate
|
||||
27 16 27 18 27 14 13 16 21 21 0.141256 197/200 NonOverlappingTemplate
|
||||
23 25 20 18 23 17 15 23 19 17 0.834308 196/200 NonOverlappingTemplate
|
||||
19 21 20 27 16 16 18 25 16 22 0.678686 199/200 NonOverlappingTemplate
|
||||
25 22 21 19 15 19 22 19 25 13 0.657933 197/200 NonOverlappingTemplate
|
||||
19 28 21 25 20 12 18 13 29 15 0.073417 198/200 NonOverlappingTemplate
|
||||
20 24 21 19 21 15 17 24 20 19 0.941144 198/200 NonOverlappingTemplate
|
||||
18 29 23 17 24 19 17 18 16 19 0.585209 200/200 NonOverlappingTemplate
|
||||
18 28 18 16 25 21 18 20 14 22 0.544254 198/200 NonOverlappingTemplate
|
||||
22 19 23 22 22 21 21 26 12 12 0.401199 199/200 NonOverlappingTemplate
|
||||
22 15 25 16 21 27 14 22 21 17 0.484646 199/200 NonOverlappingTemplate
|
||||
18 25 20 23 30 17 13 22 18 14 0.213309 200/200 NonOverlappingTemplate
|
||||
20 23 21 21 23 29 16 13 16 18 0.410055 199/200 NonOverlappingTemplate
|
||||
21 19 16 22 31 18 20 17 18 18 0.514124 198/200 NonOverlappingTemplate
|
||||
26 22 12 14 23 17 21 24 21 20 0.455937 197/200 NonOverlappingTemplate
|
||||
21 17 18 17 14 32 21 26 18 16 0.162606 197/200 NonOverlappingTemplate
|
||||
22 24 22 23 11 15 17 18 29 19 0.230755 198/200 NonOverlappingTemplate
|
||||
19 27 20 19 23 15 24 15 21 17 0.657933 198/200 NonOverlappingTemplate
|
||||
20 25 16 10 24 13 23 21 21 27 0.149495 200/200 NonOverlappingTemplate
|
||||
19 21 21 27 17 17 19 21 21 17 0.904708 200/200 NonOverlappingTemplate
|
||||
18 23 15 19 24 21 23 21 13 23 0.719747 198/200 NonOverlappingTemplate
|
||||
26 16 28 19 19 18 17 17 16 24 0.474986 199/200 NonOverlappingTemplate
|
||||
24 32 17 18 20 13 18 18 19 21 0.236810 195/200 NonOverlappingTemplate
|
||||
26 25 18 17 12 19 20 23 21 19 0.585209 196/200 NonOverlappingTemplate
|
||||
18 26 25 12 18 16 24 19 18 24 0.410055 199/200 NonOverlappingTemplate
|
||||
27 21 22 27 21 14 18 14 23 13 0.219006 197/200 NonOverlappingTemplate
|
||||
18 23 24 16 19 21 16 26 20 17 0.798139 199/200 NonOverlappingTemplate
|
||||
19 30 15 27 14 19 24 11 22 19 0.073417 198/200 NonOverlappingTemplate
|
||||
20 23 22 20 22 15 22 21 18 17 0.964295 198/200 NonOverlappingTemplate
|
||||
22 31 16 26 13 19 17 22 24 10 0.037566 197/200 NonOverlappingTemplate
|
||||
18 24 22 14 23 19 16 18 19 27 0.637119 197/200 NonOverlappingTemplate
|
||||
19 20 21 22 21 18 19 22 20 18 0.999438 198/200 NonOverlappingTemplate
|
||||
27 15 21 18 28 18 15 23 18 17 0.375313 195/200 NonOverlappingTemplate
|
||||
26 23 20 20 23 19 20 23 14 12 0.514124 199/200 NonOverlappingTemplate
|
||||
18 19 11 15 21 24 20 26 23 23 0.428095 198/200 NonOverlappingTemplate
|
||||
19 16 21 25 19 21 15 24 24 16 0.749884 197/200 NonOverlappingTemplate
|
||||
17 26 23 18 20 26 23 14 18 15 0.494392 198/200 NonOverlappingTemplate
|
||||
15 17 19 24 21 23 17 25 23 16 0.739918 196/200 NonOverlappingTemplate
|
||||
26 19 20 20 24 22 22 13 14 20 0.605916 198/200 OverlappingTemplate
|
||||
29 24 17 21 18 13 18 21 17 22 0.446556 196/200 Universal
|
||||
22 18 22 20 20 21 22 21 18 16 0.992952 198/200 ApproximateEntropy
|
||||
14 8 13 9 11 13 13 8 7 10 0.719747 106/106 RandomExcursions
|
||||
13 18 9 7 12 12 9 6 12 8 0.236810 104/106 RandomExcursions
|
||||
11 15 10 7 11 14 9 6 12 11 0.595549 106/106 RandomExcursions
|
||||
15 7 12 12 9 11 16 8 10 6 0.350485 106/106 RandomExcursions
|
||||
10 10 12 16 10 12 10 7 13 6 0.554420 106/106 RandomExcursions
|
||||
8 7 12 10 11 16 11 13 10 8 0.657933 106/106 RandomExcursions
|
||||
9 6 12 12 14 9 11 13 10 10 0.816537 104/106 RandomExcursions
|
||||
10 10 7 12 11 9 10 13 14 10 0.911413 105/106 RandomExcursions
|
||||
8 8 12 9 10 5 13 12 17 12 0.319084 104/106 RandomExcursionsVariant
|
||||
5 11 10 11 7 11 10 15 11 15 0.455937 104/106 RandomExcursionsVariant
|
||||
6 12 11 8 12 12 12 13 13 7 0.699313 104/106 RandomExcursionsVariant
|
||||
14 10 11 6 12 9 8 12 11 13 0.779188 104/106 RandomExcursionsVariant
|
||||
12 12 10 7 17 6 6 12 13 11 0.262249 103/106 RandomExcursionsVariant
|
||||
13 8 14 13 7 6 6 13 15 11 0.249284 102/106 RandomExcursionsVariant
|
||||
12 12 12 13 7 9 6 13 12 10 0.739918 105/106 RandomExcursionsVariant
|
||||
13 15 12 8 9 10 6 9 14 10 0.574903 106/106 RandomExcursionsVariant
|
||||
10 15 9 12 14 10 8 11 7 10 0.739918 105/106 RandomExcursionsVariant
|
||||
13 12 8 11 12 11 9 10 11 9 0.978072 103/106 RandomExcursionsVariant
|
||||
10 13 12 12 8 13 8 9 14 7 0.739918 104/106 RandomExcursionsVariant
|
||||
12 10 10 14 7 8 7 13 14 11 0.657933 106/106 RandomExcursionsVariant
|
||||
10 13 10 10 13 10 12 6 10 12 0.897763 106/106 RandomExcursionsVariant
|
||||
9 12 15 8 13 8 12 8 11 10 0.779188 106/106 RandomExcursionsVariant
|
||||
9 13 15 10 10 10 8 14 6 11 0.616305 106/106 RandomExcursionsVariant
|
||||
7 17 9 12 9 11 10 16 4 11 0.129620 106/106 RandomExcursionsVariant
|
||||
10 9 10 15 7 12 7 8 12 16 0.419021 106/106 RandomExcursionsVariant
|
||||
9 12 11 8 8 9 15 12 9 13 0.798139 106/106 RandomExcursionsVariant
|
||||
17 34 11 22 22 17 19 20 13 25 0.026057 199/200 Serial
|
||||
22 20 16 22 20 18 20 18 23 21 0.989786 199/200 Serial
|
||||
12 33 25 29 21 11 21 15 14 19 0.003996 199/200 LinearComplexity
|
||||
|
||||
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
The minimum pass rate for each statistical test with the exception of the
|
||||
random excursion (variant) test is approximately = 193 for a
|
||||
sample size = 200 binary sequences.
|
||||
|
||||
The minimum pass rate for the random excursion (variant) test
|
||||
is approximately = 101 for a sample size = 106 binary sequences.
|
||||
|
||||
For further guidelines construct a probability table using the MAPLE program
|
||||
provided in the addendum section of the documentation.
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
$
|
||||
11
_vendor/vendor/github.com/cznic/parser/yacc/AUTHORS
generated
vendored
11
_vendor/vendor/github.com/cznic/parser/yacc/AUTHORS
generated
vendored
@ -1,11 +0,0 @@
|
||||
# This file lists authors for copyright purposes. This file is distinct from
|
||||
# the CONTRIBUTORS files. See the latter for an explanation.
|
||||
#
|
||||
# Names should be added to this file as:
|
||||
# Name or Organization <email address>
|
||||
#
|
||||
# The email address is not required for organizations.
|
||||
#
|
||||
# Please keep the list sorted.
|
||||
|
||||
Jan Mercl <0xjnml@gmail.com>
|
||||
9
_vendor/vendor/github.com/cznic/parser/yacc/CONTRIBUTORS
generated
vendored
9
_vendor/vendor/github.com/cznic/parser/yacc/CONTRIBUTORS
generated
vendored
@ -1,9 +0,0 @@
|
||||
# This file lists people who contributed code to this repository. The AUTHORS
|
||||
# file lists the copyright holders; this file lists people.
|
||||
#
|
||||
# Names should be added to this file like so:
|
||||
# Name <email address>
|
||||
#
|
||||
# Please keep the list sorted.
|
||||
|
||||
Jan Mercl <0xjnml@gmail.com>
|
||||
58
_vendor/vendor/github.com/cznic/parser/yacc/Makefile
generated
vendored
58
_vendor/vendor/github.com/cznic/parser/yacc/Makefile
generated
vendored
@ -1,58 +0,0 @@
|
||||
# Copyright 2015 The parser Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
.PHONY: all clean cover cpu editor internalError later mem nuke todo edit
|
||||
|
||||
grep=--include=*.go --include=*.l --include=*.y --include=*.yy
|
||||
|
||||
all: editor
|
||||
go vet || true
|
||||
golint || true
|
||||
make todo
|
||||
|
||||
clean:
|
||||
go clean
|
||||
rm -f *~ cpu.test mem.test
|
||||
|
||||
cover:
|
||||
t=$(shell tempfile) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t
|
||||
|
||||
cpu:
|
||||
go test -c -o cpu.test
|
||||
./cpu.test -noerr -test.cpuprofile cpu.out
|
||||
go tool pprof --lines cpu.test cpu.out
|
||||
|
||||
edit:
|
||||
gvim -p Makefile *.l *.yy *.y *.output *.go
|
||||
|
||||
editor: scanner.go goscanner.go parser.go
|
||||
gofmt -l -s -w *.go
|
||||
go test
|
||||
go install
|
||||
|
||||
internalError:
|
||||
egrep -ho '"internal error.*"' *.go | sort | cat -n
|
||||
|
||||
later:
|
||||
@grep -n $(grep) LATER * || true
|
||||
@grep -n $(grep) MAYBE * || true
|
||||
|
||||
mem:
|
||||
go test -c -o mem.test
|
||||
./mem.test -test.bench . -test.memprofile mem.out
|
||||
go tool pprof --lines --web --alloc_space mem.test mem.out
|
||||
|
||||
nuke: clean
|
||||
go clean -i
|
||||
|
||||
|
||||
parser.go scanner.go goscanner.go: parser.yy go.l y.l
|
||||
go test -i
|
||||
go generate
|
||||
|
||||
todo:
|
||||
@grep -n $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * || true
|
||||
@grep -n $(grep) TODO * || true
|
||||
@grep -n $(grep) BUG * || true
|
||||
@grep -n $(grep) [^[:alpha:]]println * || true
|
||||
65
_vendor/vendor/github.com/cznic/parser/yacc/go.l
generated
vendored
65
_vendor/vendor/github.com/cznic/parser/yacc/go.l
generated
vendored
@ -1,65 +0,0 @@
|
||||
%{
|
||||
// Copyright 2015 The parser Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// CAUTION: Generated file (unless this is go.l) - DO NOT EDIT!
|
||||
|
||||
package parser
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/cznic/golex/lex"
|
||||
)
|
||||
|
||||
func (l *lexer) scanGo() lex.Char {
|
||||
c := l.Enter()
|
||||
%}
|
||||
|
||||
%yyc c
|
||||
%yyn c = l.Next()
|
||||
%yym l.Mark()
|
||||
%yyt l.state
|
||||
|
||||
eof \x80
|
||||
other \x81
|
||||
|
||||
intlit [0-9]+
|
||||
punct [-!#%&()*+.:;<=>?@[-_|~]|"/"[^/\*]
|
||||
runelit '(\\[^\n\r\x80]|[^\\'\x80\n\r])*'
|
||||
strlit \x22(\\[^\n\r\x80]|[^\\\x22\x80\n\r])*\x22
|
||||
white [ \t\n\r]+
|
||||
comment "//"[^\x80\n\r]*|"/*"([^*\x80]|\*+[^*/\x80])*\*+\/
|
||||
|
||||
n -?{intlit}
|
||||
tag [_a-zA-Z][_a-zA-Z0-9]*
|
||||
|
||||
%x DLR
|
||||
|
||||
%%
|
||||
|
||||
<*>"{" return l.char('{')
|
||||
<*>"}" return l.char('}')
|
||||
|
||||
"$" |
|
||||
<*>{intlit} |
|
||||
<*>{punct} |
|
||||
<*>{runelit} |
|
||||
<*>{strlit} |
|
||||
<*>{white} |
|
||||
<*>{comment} |
|
||||
<*>{other}+ return l.char(' ')
|
||||
|
||||
<DLR>"$$" return l.char(' ')
|
||||
<DLR>"$"<{tag}>"$" return l.char(' ')
|
||||
<DLR>"$"{n} return l.char(' ')
|
||||
<DLR>"$"<{tag}>{n} return l.char(' ')
|
||||
|
||||
%%
|
||||
if c, ok := l.Abort(); ok {
|
||||
return l.char(c)
|
||||
}
|
||||
|
||||
goto yyAction
|
||||
}
|
||||
456
_vendor/vendor/github.com/cznic/parser/yacc/parser.y
generated
vendored
456
_vendor/vendor/github.com/cznic/parser/yacc/parser.y
generated
vendored
@ -1,456 +0,0 @@
|
||||
// CAUTION: Generated by yy - DO NOT EDIT.
|
||||
|
||||
%{
|
||||
// Copyright 2015 The parser 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 is a derived work base on the original at
|
||||
//
|
||||
// http://pubs.opengroup.org/onlinepubs/009695399/utilities/yacc.html
|
||||
//
|
||||
// The original work is
|
||||
//
|
||||
// Copyright © 2001-2004 The IEEE and The Open Group, All Rights reserved.
|
||||
//
|
||||
// Grammar for the input to yacc.
|
||||
|
||||
package parser
|
||||
|
||||
import (
|
||||
"go/token"
|
||||
)
|
||||
%}
|
||||
|
||||
%union {
|
||||
node Node
|
||||
Token *Token
|
||||
}
|
||||
|
||||
%token <Token>
|
||||
','
|
||||
';'
|
||||
'<'
|
||||
'>'
|
||||
'{'
|
||||
'|'
|
||||
'}'
|
||||
COMMENT
|
||||
C_IDENTIFIER "rule name"
|
||||
ERROR_VERBOSE "%error-verbose"
|
||||
IDENTIFIER "identifier"
|
||||
LCURL "%{"
|
||||
LEFT "%left"
|
||||
MARK "%%"
|
||||
NONASSOC "%nonassoc"
|
||||
NUMBER "number"
|
||||
PREC "%prec"
|
||||
PRECEDENCE "%precedence"
|
||||
RCURL "%}"
|
||||
RIGHT "%right"
|
||||
START "%start"
|
||||
STRING_LITERAL "string literal"
|
||||
TOKEN "%token"
|
||||
TYPE "%type"
|
||||
UNION "%union"
|
||||
|
||||
%type <node>
|
||||
Action
|
||||
Definition
|
||||
DefinitionList
|
||||
LiteralStringOpt
|
||||
Name
|
||||
NameList
|
||||
Precedence
|
||||
ReservedWord
|
||||
Rule
|
||||
RuleItemList
|
||||
RuleList
|
||||
Specification
|
||||
Tag
|
||||
Tail
|
||||
|
||||
%start Specification
|
||||
|
||||
%%
|
||||
|
||||
Action:
|
||||
'{'
|
||||
{
|
||||
lx := yylex.(*lexer)
|
||||
lx.values2 = append([]string(nil), lx.values...)
|
||||
lx.positions2 = append([]token.Pos(nil), lx.positions...)
|
||||
}
|
||||
'}'
|
||||
{
|
||||
lx := yylex.(*lexer)
|
||||
lhs := &Action{
|
||||
Token: $1,
|
||||
Token2: $3,
|
||||
}
|
||||
$$ = lhs
|
||||
for i, v := range lx.values2 {
|
||||
a := lx.parseActionValue(lx.positions2[i], v)
|
||||
if a != nil {
|
||||
lhs.Values = append(lhs.Values, a)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Definition:
|
||||
START IDENTIFIER
|
||||
{
|
||||
$$ = &Definition{
|
||||
Token: $1,
|
||||
Token2: $2,
|
||||
}
|
||||
}
|
||||
| UNION
|
||||
{
|
||||
lx := yylex.(*lexer)
|
||||
lhs := &Definition{
|
||||
Case: 1,
|
||||
Token: $1,
|
||||
}
|
||||
$$ = lhs
|
||||
lhs.Value = lx.value
|
||||
}
|
||||
| LCURL
|
||||
{
|
||||
lx := yylex.(*lexer)
|
||||
lx.pos2 = lx.pos
|
||||
lx.value2 = lx.value
|
||||
}
|
||||
RCURL
|
||||
{
|
||||
lx := yylex.(*lexer)
|
||||
lhs := &Definition{
|
||||
Case: 2,
|
||||
Token: $1,
|
||||
Token2: $3,
|
||||
}
|
||||
$$ = lhs
|
||||
lhs.Value = lx.value2
|
||||
}
|
||||
| ReservedWord Tag NameList
|
||||
{
|
||||
lhs := &Definition{
|
||||
Case: 3,
|
||||
ReservedWord: $1.(*ReservedWord),
|
||||
Tag: $2.(*Tag),
|
||||
NameList: $3.(*NameList).reverse(),
|
||||
}
|
||||
$$ = lhs
|
||||
for n := lhs.NameList; n != nil; n = n.NameList {
|
||||
lhs.Nlist = append(lhs.Nlist, n.Name)
|
||||
}
|
||||
}
|
||||
| ReservedWord Tag
|
||||
{
|
||||
$$ = &Definition{
|
||||
Case: 4,
|
||||
ReservedWord: $1.(*ReservedWord),
|
||||
Tag: $2.(*Tag),
|
||||
}
|
||||
}
|
||||
| ERROR_VERBOSE
|
||||
{
|
||||
$$ = &Definition{
|
||||
Case: 5,
|
||||
Token: $1,
|
||||
}
|
||||
}
|
||||
|
||||
DefinitionList:
|
||||
/* empty */
|
||||
{
|
||||
$$ = (*DefinitionList)(nil)
|
||||
}
|
||||
| DefinitionList Definition
|
||||
{
|
||||
lx := yylex.(*lexer)
|
||||
lhs := &DefinitionList{
|
||||
DefinitionList: $1.(*DefinitionList),
|
||||
Definition: $2.(*Definition),
|
||||
}
|
||||
$$ = lhs
|
||||
lx.defs = append(lx.defs, lhs.Definition)
|
||||
}
|
||||
|
||||
LiteralStringOpt:
|
||||
/* empty */
|
||||
{
|
||||
$$ = (*LiteralStringOpt)(nil)
|
||||
}
|
||||
| STRING_LITERAL
|
||||
{
|
||||
$$ = &LiteralStringOpt{
|
||||
Token: $1,
|
||||
}
|
||||
}
|
||||
|
||||
Name:
|
||||
IDENTIFIER LiteralStringOpt
|
||||
{
|
||||
lx := yylex.(*lexer)
|
||||
lhs := &Name{
|
||||
Token: $1,
|
||||
LiteralStringOpt: $2.(*LiteralStringOpt),
|
||||
}
|
||||
$$ = lhs
|
||||
lhs.Identifier = lx.ident(lhs.Token)
|
||||
lhs.Number = -1
|
||||
}
|
||||
| IDENTIFIER NUMBER LiteralStringOpt
|
||||
{
|
||||
lx := yylex.(*lexer)
|
||||
lhs := &Name{
|
||||
Case: 1,
|
||||
Token: $1,
|
||||
Token2: $2,
|
||||
LiteralStringOpt: $3.(*LiteralStringOpt),
|
||||
}
|
||||
$$ = lhs
|
||||
lhs.Identifier = lx.ident(lhs.Token)
|
||||
lhs.Number = lx.number(lhs.Token2)
|
||||
}
|
||||
|
||||
NameList:
|
||||
Name
|
||||
{
|
||||
$$ = &NameList{
|
||||
Name: $1.(*Name),
|
||||
}
|
||||
}
|
||||
| NameList Name
|
||||
{
|
||||
$$ = &NameList{
|
||||
Case: 1,
|
||||
NameList: $1.(*NameList),
|
||||
Name: $2.(*Name),
|
||||
}
|
||||
}
|
||||
| NameList ',' Name
|
||||
{
|
||||
$$ = &NameList{
|
||||
Case: 2,
|
||||
NameList: $1.(*NameList),
|
||||
Token: $2,
|
||||
Name: $3.(*Name),
|
||||
}
|
||||
}
|
||||
|
||||
Precedence:
|
||||
/* empty */
|
||||
{
|
||||
$$ = (*Precedence)(nil)
|
||||
}
|
||||
| PREC IDENTIFIER
|
||||
{
|
||||
lx := yylex.(*lexer)
|
||||
lhs := &Precedence{
|
||||
Case: 1,
|
||||
Token: $1,
|
||||
Token2: $2,
|
||||
}
|
||||
$$ = lhs
|
||||
lhs.Identifier = lx.ident(lhs.Token2)
|
||||
}
|
||||
| PREC IDENTIFIER Action
|
||||
{
|
||||
lx := yylex.(*lexer)
|
||||
lhs := &Precedence{
|
||||
Case: 2,
|
||||
Token: $1,
|
||||
Token2: $2,
|
||||
Action: $3.(*Action),
|
||||
}
|
||||
$$ = lhs
|
||||
lhs.Identifier = lx.ident(lhs.Token2)
|
||||
}
|
||||
| Precedence ';'
|
||||
{
|
||||
$$ = &Precedence{
|
||||
Case: 3,
|
||||
Precedence: $1.(*Precedence),
|
||||
Token: $2,
|
||||
}
|
||||
}
|
||||
|
||||
ReservedWord:
|
||||
TOKEN
|
||||
{
|
||||
$$ = &ReservedWord{
|
||||
Token: $1,
|
||||
}
|
||||
}
|
||||
| LEFT
|
||||
{
|
||||
$$ = &ReservedWord{
|
||||
Case: 1,
|
||||
Token: $1,
|
||||
}
|
||||
}
|
||||
| RIGHT
|
||||
{
|
||||
$$ = &ReservedWord{
|
||||
Case: 2,
|
||||
Token: $1,
|
||||
}
|
||||
}
|
||||
| NONASSOC
|
||||
{
|
||||
$$ = &ReservedWord{
|
||||
Case: 3,
|
||||
Token: $1,
|
||||
}
|
||||
}
|
||||
| TYPE
|
||||
{
|
||||
$$ = &ReservedWord{
|
||||
Case: 4,
|
||||
Token: $1,
|
||||
}
|
||||
}
|
||||
| PRECEDENCE
|
||||
{
|
||||
$$ = &ReservedWord{
|
||||
Case: 5,
|
||||
Token: $1,
|
||||
}
|
||||
}
|
||||
|
||||
Rule:
|
||||
C_IDENTIFIER RuleItemList Precedence
|
||||
{
|
||||
lx := yylex.(*lexer)
|
||||
lhs := &Rule{
|
||||
Token: $1,
|
||||
RuleItemList: $2.(*RuleItemList).reverse(),
|
||||
Precedence: $3.(*Precedence),
|
||||
}
|
||||
$$ = lhs
|
||||
lx.ruleName = lhs.Token
|
||||
lhs.Name = lhs.Token
|
||||
}
|
||||
| '|' RuleItemList Precedence
|
||||
{
|
||||
lx := yylex.(*lexer)
|
||||
lhs := &Rule{
|
||||
Case: 1,
|
||||
Token: $1,
|
||||
RuleItemList: $2.(*RuleItemList).reverse(),
|
||||
Precedence: $3.(*Precedence),
|
||||
}
|
||||
$$ = lhs
|
||||
lhs.Name = lx.ruleName
|
||||
}
|
||||
|
||||
RuleItemList:
|
||||
/* empty */
|
||||
{
|
||||
$$ = (*RuleItemList)(nil)
|
||||
}
|
||||
| RuleItemList IDENTIFIER
|
||||
{
|
||||
$$ = &RuleItemList{
|
||||
Case: 1,
|
||||
RuleItemList: $1.(*RuleItemList),
|
||||
Token: $2,
|
||||
}
|
||||
}
|
||||
| RuleItemList Action
|
||||
{
|
||||
$$ = &RuleItemList{
|
||||
Case: 2,
|
||||
RuleItemList: $1.(*RuleItemList),
|
||||
Action: $2.(*Action),
|
||||
}
|
||||
}
|
||||
| RuleItemList STRING_LITERAL
|
||||
{
|
||||
$$ = &RuleItemList{
|
||||
Case: 3,
|
||||
RuleItemList: $1.(*RuleItemList),
|
||||
Token: $2,
|
||||
}
|
||||
}
|
||||
|
||||
RuleList:
|
||||
C_IDENTIFIER RuleItemList Precedence
|
||||
{
|
||||
lx := yylex.(*lexer)
|
||||
lhs := &RuleList{
|
||||
Token: $1,
|
||||
RuleItemList: $2.(*RuleItemList).reverse(),
|
||||
Precedence: $3.(*Precedence),
|
||||
}
|
||||
$$ = lhs
|
||||
lx.ruleName = lhs.Token
|
||||
rule := &Rule{
|
||||
Token: lhs.Token,
|
||||
Name: lhs.Token,
|
||||
RuleItemList: lhs.RuleItemList,
|
||||
Precedence: lhs.Precedence,
|
||||
}
|
||||
rule.collect()
|
||||
lx.rules = append(lx.rules, rule)
|
||||
}
|
||||
| RuleList Rule
|
||||
{
|
||||
lx := yylex.(*lexer)
|
||||
lhs := &RuleList{
|
||||
Case: 1,
|
||||
RuleList: $1.(*RuleList),
|
||||
Rule: $2.(*Rule),
|
||||
}
|
||||
$$ = lhs
|
||||
rule := lhs.Rule
|
||||
rule.collect()
|
||||
lx.rules = append(lx.rules, rule)
|
||||
}
|
||||
|
||||
Specification:
|
||||
DefinitionList "%%" RuleList Tail
|
||||
{
|
||||
lx := yylex.(*lexer)
|
||||
lhs := &Specification{
|
||||
DefinitionList: $1.(*DefinitionList).reverse(),
|
||||
Token: $2,
|
||||
RuleList: $3.(*RuleList).reverse(),
|
||||
Tail: $4.(*Tail),
|
||||
}
|
||||
$$ = lhs
|
||||
lhs.Defs = lx.defs
|
||||
lhs.Rules = lx.rules
|
||||
lx.spec = lhs
|
||||
}
|
||||
|
||||
Tag:
|
||||
/* empty */
|
||||
{
|
||||
$$ = (*Tag)(nil)
|
||||
}
|
||||
| '<' IDENTIFIER '>'
|
||||
{
|
||||
$$ = &Tag{
|
||||
Token: $1,
|
||||
Token2: $2,
|
||||
Token3: $3,
|
||||
}
|
||||
}
|
||||
|
||||
Tail:
|
||||
"%%"
|
||||
{
|
||||
lx := yylex.(*lexer)
|
||||
lhs := &Tail{
|
||||
Token: $1,
|
||||
}
|
||||
$$ = lhs
|
||||
lhs.Value = lx.value
|
||||
}
|
||||
| /* empty */
|
||||
{
|
||||
$$ = (*Tail)(nil)
|
||||
}
|
||||
203
_vendor/vendor/github.com/cznic/parser/yacc/parser.yy
generated
vendored
203
_vendor/vendor/github.com/cznic/parser/yacc/parser.yy
generated
vendored
@ -1,203 +0,0 @@
|
||||
%{
|
||||
// Copyright 2015 The parser 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 is a derived work base on the original at
|
||||
//
|
||||
// http://pubs.opengroup.org/onlinepubs/009695399/utilities/yacc.html
|
||||
//
|
||||
// The original work is
|
||||
//
|
||||
// Copyright © 2001-2004 The IEEE and The Open Group, All Rights reserved.
|
||||
//
|
||||
// Grammar for the input to yacc.
|
||||
|
||||
package parser
|
||||
|
||||
import (
|
||||
"go/token"
|
||||
)
|
||||
%}
|
||||
|
||||
%union {
|
||||
node Node
|
||||
Token *Token
|
||||
}
|
||||
|
||||
%token <Token>
|
||||
/*yy:token "%c:" */ C_IDENTIFIER "rule name"
|
||||
/*yy:token "%c" */ IDENTIFIER "identifier"
|
||||
/*yy:token "\"%c\"" */ STRING_LITERAL "string literal"
|
||||
/*yy:token "%d" */ NUMBER "number"
|
||||
|
||||
COMMENT
|
||||
ERROR_VERBOSE "%error-verbose"
|
||||
LCURL "%{"
|
||||
LEFT "%left"
|
||||
MARK "%%"
|
||||
NONASSOC "%nonassoc"
|
||||
PREC "%prec"
|
||||
PRECEDENCE "%precedence"
|
||||
RCURL "%}"
|
||||
RIGHT "%right"
|
||||
START "%start"
|
||||
TOKEN "%token"
|
||||
TYPE "%type"
|
||||
UNION "%union"
|
||||
|
||||
%start Specification
|
||||
|
||||
%%
|
||||
|
||||
//yy:field Values []*ActionValue // For backward compatibility.
|
||||
Action:
|
||||
'{'
|
||||
{
|
||||
lx.values2 = append([]string(nil), lx.values...)
|
||||
lx.positions2 = append([]token.Pos(nil), lx.positions...)
|
||||
}
|
||||
'}'
|
||||
{
|
||||
for i, v := range lx.values2 {
|
||||
a := lx.parseActionValue(lx.positions2[i], v)
|
||||
if a != nil {
|
||||
lhs.Values = append(lhs.Values, a)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//yy:field Nlist []*Name // For backward compatibility.
|
||||
//yy:field Value string
|
||||
Definition:
|
||||
START IDENTIFIER
|
||||
//yy:example "%union{int i} %%"
|
||||
| UNION
|
||||
{
|
||||
lhs.Value = lx.value
|
||||
}
|
||||
| LCURL
|
||||
{
|
||||
lx.pos2 = lx.pos
|
||||
lx.value2 = lx.value
|
||||
}
|
||||
RCURL
|
||||
{
|
||||
lhs.Value = lx.value2
|
||||
}
|
||||
| ReservedWord Tag NameList
|
||||
{
|
||||
for n := lhs.NameList; n != nil; n = n.NameList {
|
||||
lhs.Nlist = append(lhs.Nlist, n.Name)
|
||||
}
|
||||
}
|
||||
| ReservedWord Tag
|
||||
| ERROR_VERBOSE
|
||||
|
||||
DefinitionList:
|
||||
| DefinitionList Definition
|
||||
{
|
||||
lx.defs = append(lx.defs, lhs.Definition)
|
||||
}
|
||||
|
||||
LiteralStringOpt:
|
||||
| STRING_LITERAL
|
||||
|
||||
//yy:field Identifier interface{} // For backward compatibility.
|
||||
//yy:field Number int // For backward compatibility.
|
||||
Name:
|
||||
IDENTIFIER LiteralStringOpt
|
||||
{
|
||||
lhs.Identifier = lx.ident(lhs.Token)
|
||||
lhs.Number = -1
|
||||
}
|
||||
| IDENTIFIER NUMBER LiteralStringOpt
|
||||
{
|
||||
lhs.Identifier = lx.ident(lhs.Token)
|
||||
lhs.Number = lx.number(lhs.Token2)
|
||||
}
|
||||
|
||||
NameList:
|
||||
Name
|
||||
| NameList Name
|
||||
| NameList ',' Name
|
||||
|
||||
//yy:field Identifier interface{} // Name string or literal int.
|
||||
Precedence:
|
||||
/* empty */ {}
|
||||
| PREC IDENTIFIER
|
||||
{
|
||||
lhs.Identifier = lx.ident(lhs.Token2)
|
||||
}
|
||||
| PREC IDENTIFIER Action
|
||||
{
|
||||
lhs.Identifier = lx.ident(lhs.Token2)
|
||||
}
|
||||
| Precedence ';'
|
||||
|
||||
ReservedWord:
|
||||
TOKEN
|
||||
| LEFT
|
||||
| RIGHT
|
||||
| NONASSOC
|
||||
| TYPE
|
||||
| PRECEDENCE
|
||||
|
||||
//yy:field Body []interface{} // For backward compatibility.
|
||||
//yy:field Name *Token
|
||||
Rule:
|
||||
C_IDENTIFIER RuleItemList Precedence
|
||||
{
|
||||
lx.ruleName = lhs.Token
|
||||
lhs.Name = lhs.Token
|
||||
}
|
||||
| '|' RuleItemList Precedence
|
||||
{
|
||||
lhs.Name = lx.ruleName
|
||||
}
|
||||
|
||||
RuleItemList:
|
||||
| RuleItemList IDENTIFIER
|
||||
| RuleItemList Action
|
||||
| RuleItemList STRING_LITERAL
|
||||
|
||||
RuleList:
|
||||
C_IDENTIFIER RuleItemList Precedence
|
||||
{
|
||||
lx.ruleName = lhs.Token
|
||||
rule := &Rule{
|
||||
Token: lhs.Token,
|
||||
Name: lhs.Token,
|
||||
RuleItemList: lhs.RuleItemList,
|
||||
Precedence: lhs.Precedence,
|
||||
}
|
||||
rule.collect()
|
||||
lx.rules = append(lx.rules, rule)
|
||||
}
|
||||
| RuleList Rule
|
||||
{
|
||||
rule := lhs.Rule
|
||||
rule.collect()
|
||||
lx.rules = append(lx.rules, rule)
|
||||
}
|
||||
|
||||
//yy:field Defs []*Definition // For backward compatibility.
|
||||
//yy:field Rules []*Rule // For backward compatibility.
|
||||
Specification:
|
||||
DefinitionList "%%" RuleList Tail
|
||||
{
|
||||
lhs.Defs = lx.defs
|
||||
lhs.Rules = lx.rules
|
||||
lx.spec = lhs
|
||||
}
|
||||
|
||||
Tag:
|
||||
| '<' IDENTIFIER '>'
|
||||
|
||||
//yy:field Value string
|
||||
Tail:
|
||||
"%%"
|
||||
{
|
||||
lhs.Value = lx.value
|
||||
}
|
||||
| /* empty */
|
||||
0
_vendor/vendor/github.com/cznic/parser/yacc/xerrors
generated
vendored
0
_vendor/vendor/github.com/cznic/parser/yacc/xerrors
generated
vendored
65
_vendor/vendor/github.com/cznic/parser/yacc/y.l
generated
vendored
65
_vendor/vendor/github.com/cznic/parser/yacc/y.l
generated
vendored
@ -1,65 +0,0 @@
|
||||
%{
|
||||
// Copyright 2015 The parser Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// CAUTION: Generated file (unless this is y.l) - DO NOT EDIT!
|
||||
|
||||
package parser
|
||||
|
||||
import (
|
||||
"github.com/cznic/golex/lex"
|
||||
)
|
||||
|
||||
func (l *lexer) scan() lex.Char {
|
||||
c := l.Enter()
|
||||
%}
|
||||
|
||||
%yyc c
|
||||
%yyn c = l.Next()
|
||||
%yym l.Mark()
|
||||
|
||||
eof \x80
|
||||
|
||||
identifier {name}|{literal}
|
||||
literal '(\\[^\n\r\x80]|[^\\'\n\r\x80])*'
|
||||
name {name-first}{name-next}*
|
||||
name-first [_a-zA-Z]
|
||||
name-next {name-first}|[0-9.]
|
||||
str-literal \x22(\\[^\n\r\x80]|[^\\\x22\x80\n\r])*\x22
|
||||
|
||||
%%
|
||||
|
||||
c = l.Rule0()
|
||||
|
||||
[ \n\r\t\f]
|
||||
|
||||
"//"[^\x80\n\r]* |
|
||||
"/*"([^*\x80]|\*+[^*/\x80])*\*+\/
|
||||
return l.char(COMMENT)
|
||||
|
||||
%"{" return l.char(LCURL)
|
||||
%"}" return l.char(RCURL)
|
||||
%% return l.char(MARK)
|
||||
%left return l.char(LEFT)
|
||||
%nonassoc return l.char(NONASSOC)
|
||||
%prec return l.char(PREC)
|
||||
%precedence return l.char(PRECEDENCE)
|
||||
%right return l.char(RIGHT)
|
||||
%start return l.char(START)
|
||||
%token return l.char(TOKEN)
|
||||
%type return l.char(TYPE)
|
||||
%union return l.char(UNION)
|
||||
%error-verbose return l.char(ERROR_VERBOSE)
|
||||
|
||||
[0-9]+ return l.char(NUMBER)
|
||||
{identifier} return l.char(IDENTIFIER)
|
||||
{str-literal} return l.char(STRING_LITERAL)
|
||||
|
||||
%%
|
||||
if c, ok := l.Abort(); ok {
|
||||
return l.char(c)
|
||||
}
|
||||
|
||||
goto yyAction
|
||||
}
|
||||
11
_vendor/vendor/github.com/cznic/sortutil/AUTHORS
generated
vendored
11
_vendor/vendor/github.com/cznic/sortutil/AUTHORS
generated
vendored
@ -1,11 +0,0 @@
|
||||
# This file lists authors for copyright purposes. This file is distinct from
|
||||
# the CONTRIBUTORS files. See the latter for an explanation.
|
||||
#
|
||||
# Names should be added to this file as:
|
||||
# Name or Organization <email address>
|
||||
#
|
||||
# The email address is not required for organizations.
|
||||
#
|
||||
# Please keep the list sorted.
|
||||
|
||||
Jan Mercl <0xjnml@gmail.com>
|
||||
10
_vendor/vendor/github.com/cznic/sortutil/CONTRIBUTORS
generated
vendored
10
_vendor/vendor/github.com/cznic/sortutil/CONTRIBUTORS
generated
vendored
@ -1,10 +0,0 @@
|
||||
# This file lists people who contributed code to this repository. The AUTHORS
|
||||
# file lists the copyright holders; this file lists people.
|
||||
#
|
||||
# Names should be added to this file like so:
|
||||
# Name <email address>
|
||||
#
|
||||
# Please keep the list sorted.
|
||||
|
||||
Gary Burd <gary@beagledreams.com>
|
||||
Jan Mercl <0xjnml@gmail.com>
|
||||
35
_vendor/vendor/github.com/cznic/sortutil/Makefile
generated
vendored
35
_vendor/vendor/github.com/cznic/sortutil/Makefile
generated
vendored
@ -1,35 +0,0 @@
|
||||
# Copyright 2014 The sortutil Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
.PHONY: all clean editor later nuke todo
|
||||
|
||||
grep=--include=*.go
|
||||
|
||||
all: editor
|
||||
go vet
|
||||
golint .
|
||||
make todo
|
||||
|
||||
clean:
|
||||
go clean
|
||||
rm -f *~
|
||||
|
||||
editor:
|
||||
gofmt -s -l -w *.go
|
||||
go test -i
|
||||
go test
|
||||
go build
|
||||
|
||||
later:
|
||||
@grep -n $(grep) LATER * || true
|
||||
@grep -n $(grep) MAYBE * || true
|
||||
|
||||
nuke: clean
|
||||
go clean -i
|
||||
|
||||
todo:
|
||||
@grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * || true
|
||||
@grep -nr $(grep) TODO * || true
|
||||
@grep -nr $(grep) BUG * || true
|
||||
@grep -nr $(grep) println * || true
|
||||
4
_vendor/vendor/github.com/cznic/sortutil/README
generated
vendored
4
_vendor/vendor/github.com/cznic/sortutil/README
generated
vendored
@ -1,4 +0,0 @@
|
||||
Packages in this repository:
|
||||
|
||||
Install: $ go get github.com/cznic/sortutil
|
||||
Godocs: http://godoc.org/github.com/cznic/sortutil
|
||||
12
_vendor/vendor/github.com/cznic/strutil/AUTHORS
generated
vendored
12
_vendor/vendor/github.com/cznic/strutil/AUTHORS
generated
vendored
@ -1,12 +0,0 @@
|
||||
# This file lists authors for copyright purposes. This file is distinct from
|
||||
# the CONTRIBUTORS files. See the latter for an explanation.
|
||||
#
|
||||
# Names should be added to this file as:
|
||||
# Name or Organization <email address>
|
||||
#
|
||||
# The email address is not required for organizations.
|
||||
#
|
||||
# Please keep the list sorted.
|
||||
|
||||
CZ.NIC z.s.p.o. <kontakt@nic.cz>
|
||||
Jan Mercl <0xjnml@gmail.com>
|
||||
9
_vendor/vendor/github.com/cznic/strutil/CONTRIBUTORS
generated
vendored
9
_vendor/vendor/github.com/cznic/strutil/CONTRIBUTORS
generated
vendored
@ -1,9 +0,0 @@
|
||||
# This file lists people who contributed code to this repository. The AUTHORS
|
||||
# file lists the copyright holders; this file lists people.
|
||||
#
|
||||
# Names should be added to this file like so:
|
||||
# Name <email address>
|
||||
#
|
||||
# Please keep the list sorted.
|
||||
|
||||
Jan Mercl <0xjnml@gmail.com>
|
||||
50
_vendor/vendor/github.com/cznic/strutil/Makefile
generated
vendored
50
_vendor/vendor/github.com/cznic/strutil/Makefile
generated
vendored
@ -1,50 +0,0 @@
|
||||
# Copyright (c) 2014 The sortutil Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
.PHONY: all clean cover cpu editor internalError later mem nuke todo
|
||||
|
||||
grep=--include=*.go --include=*.l --include=*.y
|
||||
|
||||
all: editor
|
||||
go vet || true
|
||||
golint || true
|
||||
make todo
|
||||
|
||||
clean:
|
||||
go clean
|
||||
rm -f *~ cpu.test mem.test
|
||||
|
||||
cover:
|
||||
t=$(shell tempfile) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t
|
||||
|
||||
cpu:
|
||||
go test -c -o cpu.test
|
||||
./cpu.test -noerr -test.cpuprofile cpu.out
|
||||
go tool pprof --lines cpu.test cpu.out
|
||||
|
||||
editor:
|
||||
gofmt -l -s -w *.go
|
||||
go test
|
||||
go install
|
||||
|
||||
internalError:
|
||||
egrep -ho '"internal error.*"' *.go | sort | cat -n
|
||||
|
||||
later:
|
||||
@grep -n $(grep) LATER * || true
|
||||
@grep -n $(grep) MAYBE * || true
|
||||
|
||||
mem:
|
||||
go test -c -o mem.test
|
||||
./mem.test -test.bench . -test.memprofile mem.out
|
||||
go tool pprof --lines --web --alloc_space mem.test mem.out
|
||||
|
||||
nuke: clean
|
||||
go clean -i
|
||||
|
||||
todo:
|
||||
@grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * || true
|
||||
@grep -nr $(grep) TODO * || true
|
||||
@grep -nr $(grep) BUG * || true
|
||||
@grep -nr $(grep) [^[:alpha:]]println * || true
|
||||
8
_vendor/vendor/github.com/cznic/strutil/README
generated
vendored
8
_vendor/vendor/github.com/cznic/strutil/README
generated
vendored
@ -1,8 +0,0 @@
|
||||
This is a goinstall-able mirror of modified code already published at:
|
||||
http://git.nic.cz/redmine/projects/gostrutil/repository
|
||||
|
||||
Online godoc documentation for this package (should be) available at:
|
||||
http://gopkgdoc.appspot.com/pkg/github.com/cznic/strutil
|
||||
|
||||
Installation:
|
||||
$ go get github.com/cznic/strutil
|
||||
11
_vendor/vendor/github.com/cznic/y/AUTHORS
generated
vendored
11
_vendor/vendor/github.com/cznic/y/AUTHORS
generated
vendored
@ -1,11 +0,0 @@
|
||||
# This file lists authors for copyright purposes. This file is distinct from
|
||||
# the CONTRIBUTORS files. See the latter for an explanation.
|
||||
#
|
||||
# Names should be added to this file as:
|
||||
# Name or Organization <email address>
|
||||
#
|
||||
# The email address is not required for organizations.
|
||||
#
|
||||
# Please keep the list sorted.
|
||||
|
||||
Jan Mercl <0xjnml@gmail.com>
|
||||
9
_vendor/vendor/github.com/cznic/y/CONTRIBUTORS
generated
vendored
9
_vendor/vendor/github.com/cznic/y/CONTRIBUTORS
generated
vendored
@ -1,9 +0,0 @@
|
||||
# This file lists people who contributed code to this repository. The AUTHORS
|
||||
# file lists the copyright holders; this file lists people.
|
||||
#
|
||||
# Names should be added to this file like so:
|
||||
# Name <email address>
|
||||
#
|
||||
# Please keep the list sorted.
|
||||
|
||||
Jan Mercl <0xjnml@gmail.com>
|
||||
55
_vendor/vendor/github.com/cznic/y/Makefile
generated
vendored
55
_vendor/vendor/github.com/cznic/y/Makefile
generated
vendored
@ -1,55 +0,0 @@
|
||||
# Copyright 2014 The y Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
.PHONY: all clean editor later nuke todo internalError cover mem cpu y.test bison
|
||||
|
||||
grep=--include=*.go
|
||||
|
||||
all: editor
|
||||
go tool vet -printfuncs "Log:0,Logf:1" *.go
|
||||
golint .
|
||||
make todo
|
||||
|
||||
bison:
|
||||
find -name \*.y -execdir bison -r all --report-file {}.bison -o/dev/null {} \;
|
||||
|
||||
clean:
|
||||
go clean
|
||||
rm -f *~ y.output mem.out cpu.out y.test
|
||||
|
||||
cover:
|
||||
t=$(shell tempfile) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t
|
||||
|
||||
cpu: y.test
|
||||
./$< -noerr -test.cpuprofile cpu.out
|
||||
go tool pprof --lines $< cpu.out
|
||||
|
||||
editor:
|
||||
gofmt -l -s -w .
|
||||
go test -i
|
||||
go test
|
||||
go install
|
||||
|
||||
internalError:
|
||||
egrep -ho '".*internal error.*"' *.go | sort | cat -n
|
||||
|
||||
later:
|
||||
@grep -n $(grep) LATER * || true
|
||||
@grep -n $(grep) MAYBE * || true
|
||||
|
||||
mem: y.test
|
||||
./$< -noerr -test.memprofile mem.out -test.v # -test.memprofilerate 1
|
||||
go tool pprof --lines --alloc_space $< mem.out
|
||||
|
||||
nuke: clean
|
||||
go clean -i
|
||||
|
||||
todo:
|
||||
@grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * || true
|
||||
@grep -nr $(grep) TODO * || true
|
||||
@grep -nr $(grep) BUG * || true
|
||||
@grep -nr $(grep) [^[:alpha:]]println * || true
|
||||
|
||||
y.test:
|
||||
go test -c
|
||||
10
_vendor/vendor/github.com/cznic/y/README.md
generated
vendored
10
_vendor/vendor/github.com/cznic/y/README.md
generated
vendored
@ -1,10 +0,0 @@
|
||||
y
|
||||
=
|
||||
|
||||
Package y converts yacc source code to data structures suitable for a parser generator.
|
||||
|
||||
Installation
|
||||
|
||||
$ go get github.com/cznic/y
|
||||
|
||||
Documentation: [godoc.org/github.com/cznic/y](http://godoc.org/github.com/cznic/y)
|
||||
1
_vendor/vendor/github.com/gengo/grpc-gateway/runtime/errors.go
generated
vendored
1
_vendor/vendor/github.com/gengo/grpc-gateway/runtime/errors.go
generated
vendored
@ -104,6 +104,7 @@ func DefaultHTTPError(ctx context.Context, marshaler Marshaler, w http.ResponseW
|
||||
}
|
||||
|
||||
handleForwardResponseServerMetadata(w, md)
|
||||
handleForwardResponseTrailerHeader(w, md)
|
||||
st := HTTPStatusFromCode(grpc.Code(err))
|
||||
w.WriteHeader(st)
|
||||
if _, err := w.Write(buf); err != nil {
|
||||
|
||||
2
_vendor/vendor/github.com/gengo/grpc-gateway/runtime/handler.go
generated
vendored
2
_vendor/vendor/github.com/gengo/grpc-gateway/runtime/handler.go
generated
vendored
@ -6,8 +6,8 @@ import (
|
||||
"net/http"
|
||||
"net/textproto"
|
||||
|
||||
"github.com/gengo/grpc-gateway/runtime/internal"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime/internal"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
|
||||
28
_vendor/vendor/github.com/gengo/grpc-gateway/runtime/internal/stream_chunk.pb.go
generated
vendored
28
_vendor/vendor/github.com/gengo/grpc-gateway/runtime/internal/stream_chunk.pb.go
generated
vendored
@ -43,23 +43,23 @@ func (*StreamError) ProtoMessage() {}
|
||||
func (*StreamError) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*StreamError)(nil), "gengo.grpc.gateway.runtime.StreamError")
|
||||
proto.RegisterType((*StreamError)(nil), "grpc.gateway.runtime.StreamError")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("runtime/internal/stream_chunk.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 182 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x34, 0x8e, 0x3d, 0xef, 0x82, 0x30,
|
||||
0x10, 0x87, 0xc3, 0xff, 0x15, 0x8e, 0x8d, 0xa9, 0xd1, 0x41, 0xa3, 0x8b, 0x53, 0x19, 0xfc, 0x06,
|
||||
0x1a, 0xbf, 0x00, 0x6c, 0x2e, 0xa4, 0xe2, 0xa5, 0x10, 0xa5, 0x25, 0xd7, 0x23, 0xc6, 0xd5, 0x4f,
|
||||
0x2e, 0x2d, 0x32, 0xde, 0xf3, 0xdc, 0x93, 0xfc, 0x60, 0x4b, 0x83, 0xe1, 0xb6, 0xc3, 0xbc, 0x35,
|
||||
0x8c, 0x64, 0xd4, 0x3d, 0x77, 0x4c, 0xa8, 0xba, 0xaa, 0x6e, 0x06, 0x73, 0x93, 0x3d, 0x59, 0xb6,
|
||||
0xd9, 0x42, 0xa3, 0xd1, 0x56, 0x6a, 0xea, 0x6b, 0xa9, 0x15, 0xe3, 0x43, 0x3d, 0xe5, 0xa7, 0xdb,
|
||||
0xbc, 0x22, 0x48, 0xcb, 0x90, 0x9c, 0x88, 0x2c, 0x65, 0x4b, 0x48, 0xfc, 0x5f, 0x55, 0xdb, 0x2b,
|
||||
0x8a, 0x68, 0x1d, 0xed, 0x7e, 0x8b, 0xd8, 0x83, 0xe3, 0x78, 0x7b, 0xd9, 0x30, 0xf7, 0x93, 0xfc,
|
||||
0x9a, 0xa4, 0x07, 0x41, 0x0a, 0xf8, 0xef, 0xd0, 0x39, 0xa5, 0x51, 0x7c, 0x8f, 0x2a, 0x29, 0xe6,
|
||||
0x33, 0x5b, 0x41, 0x1a, 0x32, 0xc7, 0x8a, 0x07, 0x27, 0x7e, 0x82, 0x05, 0x8f, 0xca, 0x40, 0x0e,
|
||||
0x70, 0x8e, 0xe7, 0xfd, 0x97, 0xbf, 0xb0, 0x79, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xf8, 0x7f,
|
||||
0x7d, 0x56, 0xda, 0x00, 0x00, 0x00,
|
||||
// 180 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x52, 0x2e, 0x2a, 0xcd, 0x2b,
|
||||
0xc9, 0xcc, 0x4d, 0xd5, 0xcf, 0xcc, 0x2b, 0x49, 0x2d, 0xca, 0x4b, 0xcc, 0xd1, 0x2f, 0x2e, 0x29,
|
||||
0x4a, 0x4d, 0xcc, 0x8d, 0x4f, 0xce, 0x28, 0xcd, 0xcb, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17,
|
||||
0x12, 0x49, 0x2f, 0x2a, 0x48, 0xd6, 0x4b, 0x4f, 0x2c, 0x49, 0x2d, 0x4f, 0xac, 0xd4, 0x83, 0xea,
|
||||
0x50, 0x6a, 0x62, 0xe4, 0xe2, 0x0e, 0x06, 0x2b, 0x76, 0x2d, 0x2a, 0xca, 0x2f, 0x12, 0x92, 0xe6,
|
||||
0xe2, 0x04, 0xa9, 0x8b, 0x4f, 0xce, 0x4f, 0x49, 0x95, 0x60, 0x54, 0x60, 0xd4, 0x60, 0x0d, 0xe2,
|
||||
0x00, 0x09, 0x38, 0x03, 0xf9, 0x20, 0xc9, 0x8c, 0x92, 0x92, 0x02, 0x88, 0x24, 0x13, 0x44, 0x12,
|
||||
0x24, 0x00, 0x96, 0x94, 0xe0, 0x62, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0x95, 0x60, 0x06,
|
||||
0x4a, 0x71, 0x06, 0xc1, 0xb8, 0x42, 0xf2, 0x5c, 0xdc, 0x60, 0x6d, 0xc5, 0x25, 0x89, 0x25, 0xa5,
|
||||
0xc5, 0x12, 0x2c, 0x60, 0x59, 0x2e, 0x90, 0x50, 0x30, 0x58, 0xc4, 0x89, 0x2b, 0x8a, 0x03, 0xe6,
|
||||
0xf2, 0x24, 0x36, 0xb0, 0x6b, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa9, 0x07, 0x92, 0xb6,
|
||||
0xd4, 0x00, 0x00, 0x00,
|
||||
}
|
||||
|
||||
12
_vendor/vendor/github.com/gengo/grpc-gateway/runtime/internal/stream_chunk.proto
generated
vendored
12
_vendor/vendor/github.com/gengo/grpc-gateway/runtime/internal/stream_chunk.proto
generated
vendored
@ -1,12 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package gengo.grpc.gateway.runtime;
|
||||
option go_package = "internal";
|
||||
|
||||
// StreamError is a response type which is returned when
|
||||
// streaming rpc returns an error.
|
||||
message StreamError {
|
||||
int32 grpc_code = 1;
|
||||
int32 http_code = 2;
|
||||
string message = 3;
|
||||
string http_status = 4;
|
||||
}
|
||||
2
_vendor/vendor/github.com/gengo/grpc-gateway/runtime/pattern.go
generated
vendored
2
_vendor/vendor/github.com/gengo/grpc-gateway/runtime/pattern.go
generated
vendored
@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/gengo/grpc-gateway/utilities"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
)
|
||||
|
||||
|
||||
2
_vendor/vendor/github.com/gengo/grpc-gateway/runtime/query.go
generated
vendored
2
_vendor/vendor/github.com/gengo/grpc-gateway/runtime/query.go
generated
vendored
@ -6,8 +6,8 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/gengo/grpc-gateway/utilities"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
)
|
||||
|
||||
|
||||
20
_vendor/vendor/github.com/ghodss/yaml/.gitignore
generated
vendored
20
_vendor/vendor/github.com/ghodss/yaml/.gitignore
generated
vendored
@ -1,20 +0,0 @@
|
||||
# OSX leaves these everywhere on SMB shares
|
||||
._*
|
||||
|
||||
# Eclipse files
|
||||
.classpath
|
||||
.project
|
||||
.settings/**
|
||||
|
||||
# Emacs save files
|
||||
*~
|
||||
|
||||
# Vim-related files
|
||||
[._]*.s[a-w][a-z]
|
||||
[._]s[a-w][a-z]
|
||||
*.un~
|
||||
Session.vim
|
||||
.netrwhist
|
||||
|
||||
# Go test binaries
|
||||
*.test
|
||||
7
_vendor/vendor/github.com/ghodss/yaml/.travis.yml
generated
vendored
7
_vendor/vendor/github.com/ghodss/yaml/.travis.yml
generated
vendored
@ -1,7 +0,0 @@
|
||||
language: go
|
||||
go:
|
||||
- 1.3
|
||||
- 1.4
|
||||
script:
|
||||
- go test
|
||||
- go build
|
||||
116
_vendor/vendor/github.com/ghodss/yaml/README.md
generated
vendored
116
_vendor/vendor/github.com/ghodss/yaml/README.md
generated
vendored
@ -1,116 +0,0 @@
|
||||
# YAML marshaling and unmarshaling support for Go
|
||||
|
||||
[](https://travis-ci.org/ghodss/yaml)
|
||||
|
||||
## Introduction
|
||||
|
||||
A wrapper around [candiedyaml](https://github.com/cloudfoundry-incubator/candiedyaml) designed to enable a better way of handling YAML when marshaling to and from structs.
|
||||
|
||||
In short, this library first converts YAML to JSON using candiedyaml and then uses `json.Marshal` and `json.Unmarshal` to convert to or from the struct. This means that it effectively reuses the JSON struct tags as well as the custom JSON methods `MarshalJSON` and `UnmarshalJSON` unlike candiedyaml. For a detailed overview of the rationale behind this method, [see this blog post](http://ghodss.com/2014/the-right-way-to-handle-yaml-in-golang/).
|
||||
|
||||
## Compatibility
|
||||
|
||||
This package uses [candiedyaml](https://github.com/cloudfoundry-incubator/candiedyaml) and therefore supports [everything candiedyaml supports](https://github.com/cloudfoundry-incubator/candiedyaml#candiedyaml).
|
||||
|
||||
## Caveats
|
||||
|
||||
**Caveat #1:** When using `yaml.Marshal` and `yaml.Unmarshal`, binary data should NOT be preceded with the `!!binary` YAML tag. If you do, candiedyaml will convert the binary data from base64 to native binary data, which is not compatible with JSON. You can still use binary in your YAML files though - just store them without the `!!binary` tag and decode the base64 in your code (e.g. in the custom JSON methods `MarshalJSON` and `UnmarshalJSON`). This also has the benefit that your YAML and your JSON binary data will be decoded exactly the same way. As an example:
|
||||
|
||||
```
|
||||
BAD:
|
||||
exampleKey: !!binary gIGC
|
||||
|
||||
GOOD:
|
||||
exampleKey: gIGC
|
||||
... and decode the base64 data in your code.
|
||||
```
|
||||
|
||||
**Caveat #2:** When using `YAMLToJSON` directly, maps with keys that are maps will result in an error since this is not supported by JSON. This error will occur in `Unmarshal` as well since you can't unmarshal map keys anyways since struct fields can't be keys.
|
||||
|
||||
## Installation and usage
|
||||
|
||||
To install, run:
|
||||
|
||||
```
|
||||
$ go get github.com/ghodss/yaml
|
||||
```
|
||||
|
||||
And import using:
|
||||
|
||||
```
|
||||
import "github.com/ghodss/yaml"
|
||||
```
|
||||
|
||||
Usage is very similar to the JSON library:
|
||||
|
||||
```go
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ghodss/yaml"
|
||||
)
|
||||
|
||||
type Person struct {
|
||||
Name string `json:"name"` // Affects YAML field names too.
|
||||
Age int `json:"name"`
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Marshal a Person struct to YAML.
|
||||
p := Person{"John", 30}
|
||||
y, err := yaml.Marshal(p)
|
||||
if err != nil {
|
||||
fmt.Printf("err: %v\n", err)
|
||||
return
|
||||
}
|
||||
fmt.Println(string(y))
|
||||
/* Output:
|
||||
name: John
|
||||
age: 30
|
||||
*/
|
||||
|
||||
// Unmarshal the YAML back into a Person struct.
|
||||
var p2 Person
|
||||
err := yaml.Unmarshal(y, &p2)
|
||||
if err != nil {
|
||||
fmt.Printf("err: %v\n", err)
|
||||
return
|
||||
}
|
||||
fmt.Println(p2)
|
||||
/* Output:
|
||||
{John 30}
|
||||
*/
|
||||
}
|
||||
```
|
||||
|
||||
`yaml.YAMLToJSON` and `yaml.JSONToYAML` methods are also available:
|
||||
|
||||
```go
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ghodss/yaml"
|
||||
)
|
||||
func main() {
|
||||
j := []byte(`{"name": "John", "age": 30}`)
|
||||
y, err := yaml.JSONToYAML(j)
|
||||
if err != nil {
|
||||
fmt.Printf("err: %v\n", err)
|
||||
return
|
||||
}
|
||||
fmt.Println(string(y))
|
||||
/* Output:
|
||||
name: John
|
||||
age: 30
|
||||
*/
|
||||
j2, err := yaml.YAMLToJSON(y)
|
||||
if err != nil {
|
||||
fmt.Printf("err: %v\n", err)
|
||||
return
|
||||
}
|
||||
fmt.Println(string(j2))
|
||||
/* Output:
|
||||
{"age":30,"name":"John"}
|
||||
*/
|
||||
}
|
||||
```
|
||||
8
_vendor/vendor/github.com/go-sql-driver/mysql/.gitignore
generated
vendored
8
_vendor/vendor/github.com/go-sql-driver/mysql/.gitignore
generated
vendored
@ -1,8 +0,0 @@
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
Icon?
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
10
_vendor/vendor/github.com/go-sql-driver/mysql/.travis.yml
generated
vendored
10
_vendor/vendor/github.com/go-sql-driver/mysql/.travis.yml
generated
vendored
@ -1,10 +0,0 @@
|
||||
sudo: false
|
||||
language: go
|
||||
go:
|
||||
- 1.2
|
||||
- 1.3
|
||||
- 1.4
|
||||
- tip
|
||||
|
||||
before_script:
|
||||
- mysql -e 'create database gotest;'
|
||||
44
_vendor/vendor/github.com/go-sql-driver/mysql/AUTHORS
generated
vendored
44
_vendor/vendor/github.com/go-sql-driver/mysql/AUTHORS
generated
vendored
@ -1,44 +0,0 @@
|
||||
# This is the official list of Go-MySQL-Driver authors for copyright purposes.
|
||||
|
||||
# If you are submitting a patch, please add your name or the name of the
|
||||
# organization which holds the copyright to this list in alphabetical order.
|
||||
|
||||
# Names should be added to this file as
|
||||
# Name <email address>
|
||||
# The email address is not required for organizations.
|
||||
# Please keep the list sorted.
|
||||
|
||||
|
||||
# Individual Persons
|
||||
|
||||
Aaron Hopkins <go-sql-driver at die.net>
|
||||
Arne Hormann <arnehormann at gmail.com>
|
||||
Carlos Nieto <jose.carlos at menteslibres.net>
|
||||
Chris Moos <chris at tech9computers.com>
|
||||
DisposaBoy <disposaboy at dby.me>
|
||||
Frederick Mayle <frederickmayle at gmail.com>
|
||||
Gustavo Kristic <gkristic at gmail.com>
|
||||
Hanno Braun <mail at hannobraun.com>
|
||||
Henri Yandell <flamefew at gmail.com>
|
||||
INADA Naoki <songofacandy at gmail.com>
|
||||
James Harr <james.harr at gmail.com>
|
||||
Jian Zhen <zhenjl at gmail.com>
|
||||
Joshua Prunier <joshua.prunier at gmail.com>
|
||||
Julien Schmidt <go-sql-driver at julienschmidt.com>
|
||||
Kamil Dziedzic <kamil at klecza.pl>
|
||||
Leonardo YongUk Kim <dalinaum at gmail.com>
|
||||
Lucas Liu <extrafliu at gmail.com>
|
||||
Luke Scott <luke at webconnex.com>
|
||||
Michael Woolnough <michael.woolnough at gmail.com>
|
||||
Nicola Peduzzi <thenikso at gmail.com>
|
||||
Runrioter Wung <runrioter at gmail.com>
|
||||
Soroush Pour <me at soroushjp.com>
|
||||
Stan Putrya <root.vagner at gmail.com>
|
||||
Xiaobing Jiang <s7v7nislands at gmail.com>
|
||||
Xiuming Chen <cc at cxm.cc>
|
||||
|
||||
# Organizations
|
||||
|
||||
Barracuda Networks, Inc.
|
||||
Google Inc.
|
||||
Stripe Inc.
|
||||
92
_vendor/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md
generated
vendored
92
_vendor/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md
generated
vendored
@ -1,92 +0,0 @@
|
||||
## HEAD
|
||||
|
||||
Changes:
|
||||
|
||||
- Go 1.1 is no longer supported
|
||||
- Use decimals field from MySQL to format time types (#249)
|
||||
- Buffer optimizations (#269)
|
||||
- TLS ServerName defaults to the host (#283)
|
||||
|
||||
Bugfixes:
|
||||
|
||||
- Enable microsecond resolution on TIME, DATETIME and TIMESTAMP (#249)
|
||||
- Fixed handling of queries without columns and rows (#255)
|
||||
- Fixed a panic when SetKeepAlive() failed (#298)
|
||||
|
||||
New Features:
|
||||
- Support for returning table alias on Columns() (#289)
|
||||
- Placeholder interpolation, can be actived with the DSN parameter `interpolateParams=true` (#309, #318)
|
||||
|
||||
|
||||
## Version 1.2 (2014-06-03)
|
||||
|
||||
Changes:
|
||||
|
||||
- We switched back to a "rolling release". `go get` installs the current master branch again
|
||||
- Version v1 of the driver will not be maintained anymore. Go 1.0 is no longer supported by this driver
|
||||
- Exported errors to allow easy checking from application code
|
||||
- Enabled TCP Keepalives on TCP connections
|
||||
- Optimized INFILE handling (better buffer size calculation, lazy init, ...)
|
||||
- The DSN parser also checks for a missing separating slash
|
||||
- Faster binary date / datetime to string formatting
|
||||
- Also exported the MySQLWarning type
|
||||
- mysqlConn.Close returns the first error encountered instead of ignoring all errors
|
||||
- writePacket() automatically writes the packet size to the header
|
||||
- readPacket() uses an iterative approach instead of the recursive approach to merge splitted packets
|
||||
|
||||
New Features:
|
||||
|
||||
- `RegisterDial` allows the usage of a custom dial function to establish the network connection
|
||||
- Setting the connection collation is possible with the `collation` DSN parameter. This parameter should be preferred over the `charset` parameter
|
||||
- Logging of critical errors is configurable with `SetLogger`
|
||||
- Google CloudSQL support
|
||||
|
||||
Bugfixes:
|
||||
|
||||
- Allow more than 32 parameters in prepared statements
|
||||
- Various old_password fixes
|
||||
- Fixed TestConcurrent test to pass Go's race detection
|
||||
- Fixed appendLengthEncodedInteger for large numbers
|
||||
- Renamed readLengthEnodedString to readLengthEncodedString and skipLengthEnodedString to skipLengthEncodedString (fixed typo)
|
||||
|
||||
|
||||
## Version 1.1 (2013-11-02)
|
||||
|
||||
Changes:
|
||||
|
||||
- Go-MySQL-Driver now requires Go 1.1
|
||||
- Connections now use the collation `utf8_general_ci` by default. Adding `&charset=UTF8` to the DSN should not be necessary anymore
|
||||
- Made closing rows and connections error tolerant. This allows for example deferring rows.Close() without checking for errors
|
||||
- `[]byte(nil)` is now treated as a NULL value. Before, it was treated like an empty string / `[]byte("")`
|
||||
- DSN parameter values must now be url.QueryEscape'ed. This allows text values to contain special characters, such as '&'.
|
||||
- Use the IO buffer also for writing. This results in zero allocations (by the driver) for most queries
|
||||
- Optimized the buffer for reading
|
||||
- stmt.Query now caches column metadata
|
||||
- New Logo
|
||||
- Changed the copyright header to include all contributors
|
||||
- Improved the LOAD INFILE documentation
|
||||
- The driver struct is now exported to make the driver directly accessible
|
||||
- Refactored the driver tests
|
||||
- Added more benchmarks and moved all to a separate file
|
||||
- Other small refactoring
|
||||
|
||||
New Features:
|
||||
|
||||
- Added *old_passwords* support: Required in some cases, but must be enabled by adding `allowOldPasswords=true` to the DSN since it is insecure
|
||||
- Added a `clientFoundRows` parameter: Return the number of matching rows instead of the number of rows changed on UPDATEs
|
||||
- Added TLS/SSL support: Use a TLS/SSL encrypted connection to the server. Custom TLS configs can be registered and used
|
||||
|
||||
Bugfixes:
|
||||
|
||||
- Fixed MySQL 4.1 support: MySQL 4.1 sends packets with lengths which differ from the specification
|
||||
- Convert to DB timezone when inserting `time.Time`
|
||||
- Splitted packets (more than 16MB) are now merged correctly
|
||||
- Fixed false positive `io.EOF` errors when the data was fully read
|
||||
- Avoid panics on reuse of closed connections
|
||||
- Fixed empty string producing false nil values
|
||||
- Fixed sign byte for positive TIME fields
|
||||
|
||||
|
||||
## Version 1.0 (2013-05-14)
|
||||
|
||||
Initial Release
|
||||
40
_vendor/vendor/github.com/go-sql-driver/mysql/CONTRIBUTING.md
generated
vendored
40
_vendor/vendor/github.com/go-sql-driver/mysql/CONTRIBUTING.md
generated
vendored
@ -1,40 +0,0 @@
|
||||
# Contributing Guidelines
|
||||
|
||||
## Reporting Issues
|
||||
|
||||
Before creating a new Issue, please check first if a similar Issue [already exists](https://github.com/go-sql-driver/mysql/issues?state=open) or was [recently closed](https://github.com/go-sql-driver/mysql/issues?direction=desc&page=1&sort=updated&state=closed).
|
||||
|
||||
Please provide the following minimum information:
|
||||
* Your Go-MySQL-Driver version (or git SHA)
|
||||
* Your Go version (run `go version` in your console)
|
||||
* A detailed issue description
|
||||
* Error Log if present
|
||||
* If possible, a short example
|
||||
|
||||
|
||||
## Contributing Code
|
||||
|
||||
By contributing to this project, you share your code under the Mozilla Public License 2, as specified in the LICENSE file.
|
||||
Don't forget to add yourself to the AUTHORS file.
|
||||
|
||||
### Pull Requests Checklist
|
||||
|
||||
Please check the following points before submitting your pull request:
|
||||
- [x] Code compiles correctly
|
||||
- [x] Created tests, if possible
|
||||
- [x] All tests pass
|
||||
- [x] Extended the README / documentation, if necessary
|
||||
- [x] Added yourself to the AUTHORS file
|
||||
|
||||
### Code Review
|
||||
|
||||
Everyone is invited to review and comment on pull requests.
|
||||
If it looks fine to you, comment with "LGTM" (Looks good to me).
|
||||
|
||||
If changes are required, notice the reviewers with "PTAL" (Please take another look) after committing the fixes.
|
||||
|
||||
Before merging the Pull Request, at least one [team member](https://github.com/go-sql-driver?tab=members) must have commented with "LGTM".
|
||||
|
||||
## Development Ideas
|
||||
|
||||
If you are looking for ideas for code contributions, please check our [Development Ideas](https://github.com/go-sql-driver/mysql/wiki/Development-Ideas) Wiki page.
|
||||
386
_vendor/vendor/github.com/go-sql-driver/mysql/README.md
generated
vendored
386
_vendor/vendor/github.com/go-sql-driver/mysql/README.md
generated
vendored
@ -1,386 +0,0 @@
|
||||
# Go-MySQL-Driver
|
||||
|
||||
A MySQL-Driver for Go's [database/sql](http://golang.org/pkg/database/sql) package
|
||||
|
||||

|
||||
|
||||
**Latest stable Release:** [Version 1.2 (June 03, 2014)](https://github.com/go-sql-driver/mysql/releases)
|
||||
|
||||
[](https://travis-ci.org/go-sql-driver/mysql)
|
||||
|
||||
---------------------------------------
|
||||
* [Features](#features)
|
||||
* [Requirements](#requirements)
|
||||
* [Installation](#installation)
|
||||
* [Usage](#usage)
|
||||
* [DSN (Data Source Name)](#dsn-data-source-name)
|
||||
* [Password](#password)
|
||||
* [Protocol](#protocol)
|
||||
* [Address](#address)
|
||||
* [Parameters](#parameters)
|
||||
* [Examples](#examples)
|
||||
* [LOAD DATA LOCAL INFILE support](#load-data-local-infile-support)
|
||||
* [time.Time support](#timetime-support)
|
||||
* [Unicode support](#unicode-support)
|
||||
* [Testing / Development](#testing--development)
|
||||
* [License](#license)
|
||||
|
||||
---------------------------------------
|
||||
|
||||
## Features
|
||||
* Lightweight and [fast](https://github.com/go-sql-driver/sql-benchmark "golang MySQL-Driver performance")
|
||||
* Native Go implementation. No C-bindings, just pure Go
|
||||
* Connections over TCP/IPv4, TCP/IPv6 or Unix domain sockets
|
||||
* Automatic handling of broken connections
|
||||
* Automatic Connection Pooling *(by database/sql package)*
|
||||
* Supports queries larger than 16MB
|
||||
* Full [`sql.RawBytes`](http://golang.org/pkg/database/sql/#RawBytes) support.
|
||||
* Intelligent `LONG DATA` handling in prepared statements
|
||||
* Secure `LOAD DATA LOCAL INFILE` support with file Whitelisting and `io.Reader` support
|
||||
* Optional `time.Time` parsing
|
||||
* Optional placeholder interpolation
|
||||
|
||||
## Requirements
|
||||
* Go 1.2 or higher
|
||||
* MySQL (4.1+), MariaDB, Percona Server, Google CloudSQL or Sphinx (2.2.3+)
|
||||
|
||||
---------------------------------------
|
||||
|
||||
## Installation
|
||||
Simple install the package to your [$GOPATH](http://code.google.com/p/go-wiki/wiki/GOPATH "GOPATH") with the [go tool](http://golang.org/cmd/go/ "go command") from shell:
|
||||
```bash
|
||||
$ go get github.com/go-sql-driver/mysql
|
||||
```
|
||||
Make sure [Git is installed](http://git-scm.com/downloads) on your machine and in your system's `PATH`.
|
||||
|
||||
## Usage
|
||||
_Go MySQL Driver_ is an implementation of Go's `database/sql/driver` interface. You only need to import the driver and can use the full [`database/sql`](http://golang.org/pkg/database/sql) API then.
|
||||
|
||||
Use `mysql` as `driverName` and a valid [DSN](#dsn-data-source-name) as `dataSourceName`:
|
||||
```go
|
||||
import "database/sql"
|
||||
import _ "github.com/go-sql-driver/mysql"
|
||||
|
||||
db, err := sql.Open("mysql", "user:password@/dbname")
|
||||
```
|
||||
|
||||
[Examples are available in our Wiki](https://github.com/go-sql-driver/mysql/wiki/Examples "Go-MySQL-Driver Examples").
|
||||
|
||||
|
||||
### DSN (Data Source Name)
|
||||
|
||||
The Data Source Name has a common format, like e.g. [PEAR DB](http://pear.php.net/manual/en/package.database.db.intro-dsn.php) uses it, but without type-prefix (optional parts marked by squared brackets):
|
||||
```
|
||||
[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...¶mN=valueN]
|
||||
```
|
||||
|
||||
A DSN in its fullest form:
|
||||
```
|
||||
username:password@protocol(address)/dbname?param=value
|
||||
```
|
||||
|
||||
Except for the databasename, all values are optional. So the minimal DSN is:
|
||||
```
|
||||
/dbname
|
||||
```
|
||||
|
||||
If you do not want to preselect a database, leave `dbname` empty:
|
||||
```
|
||||
/
|
||||
```
|
||||
This has the same effect as an empty DSN string:
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
#### Password
|
||||
Passwords can consist of any character. Escaping is **not** necessary.
|
||||
|
||||
#### Protocol
|
||||
See [net.Dial](http://golang.org/pkg/net/#Dial) for more information which networks are available.
|
||||
In general you should use an Unix domain socket if available and TCP otherwise for best performance.
|
||||
|
||||
#### Address
|
||||
For TCP and UDP networks, addresses have the form `host:port`.
|
||||
If `host` is a literal IPv6 address, it must be enclosed in square brackets.
|
||||
The functions [net.JoinHostPort](http://golang.org/pkg/net/#JoinHostPort) and [net.SplitHostPort](http://golang.org/pkg/net/#SplitHostPort) manipulate addresses in this form.
|
||||
|
||||
For Unix domain sockets the address is the absolute path to the MySQL-Server-socket, e.g. `/var/run/mysqld/mysqld.sock` or `/tmp/mysql.sock`.
|
||||
|
||||
#### Parameters
|
||||
*Parameters are case-sensitive!*
|
||||
|
||||
Notice that any of `true`, `TRUE`, `True` or `1` is accepted to stand for a true boolean value. Not surprisingly, false can be specified as any of: `false`, `FALSE`, `False` or `0`.
|
||||
|
||||
##### `allowAllFiles`
|
||||
|
||||
```
|
||||
Type: bool
|
||||
Valid Values: true, false
|
||||
Default: false
|
||||
```
|
||||
|
||||
`allowAllFiles=true` disables the file Whitelist for `LOAD DATA LOCAL INFILE` and allows *all* files.
|
||||
[*Might be insecure!*](http://dev.mysql.com/doc/refman/5.7/en/load-data-local.html)
|
||||
|
||||
##### `allowCleartextPasswords`
|
||||
|
||||
```
|
||||
Type: bool
|
||||
Valid Values: true, false
|
||||
Default: false
|
||||
```
|
||||
|
||||
`allowCleartextPasswords=true` allows using the [cleartext client side plugin](http://dev.mysql.com/doc/en/cleartext-authentication-plugin.html) if required by an account, such as one defined with the [PAM authentication plugin](http://dev.mysql.com/doc/en/pam-authentication-plugin.html). Sending passwords in clear text may be a security problem in some configurations. To avoid problems if there is any possibility that the password would be intercepted, clients should connect to MySQL Server using a method that protects the password. Possibilities include [TLS / SSL](#tls), IPsec, or a private network.
|
||||
|
||||
##### `allowOldPasswords`
|
||||
|
||||
```
|
||||
Type: bool
|
||||
Valid Values: true, false
|
||||
Default: false
|
||||
```
|
||||
`allowOldPasswords=true` allows the usage of the insecure old password method. This should be avoided, but is necessary in some cases. See also [the old_passwords wiki page](https://github.com/go-sql-driver/mysql/wiki/old_passwords).
|
||||
|
||||
##### `charset`
|
||||
|
||||
```
|
||||
Type: string
|
||||
Valid Values: <name>
|
||||
Default: none
|
||||
```
|
||||
|
||||
Sets the charset used for client-server interaction (`"SET NAMES <value>"`). If multiple charsets are set (separated by a comma), the following charset is used if setting the charset failes. This enables for example support for `utf8mb4` ([introduced in MySQL 5.5.3](http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html)) with fallback to `utf8` for older servers (`charset=utf8mb4,utf8`).
|
||||
|
||||
Usage of the `charset` parameter is discouraged because it issues additional queries to the server.
|
||||
Unless you need the fallback behavior, please use `collation` instead.
|
||||
|
||||
##### `collation`
|
||||
|
||||
```
|
||||
Type: string
|
||||
Valid Values: <name>
|
||||
Default: utf8_general_ci
|
||||
```
|
||||
|
||||
Sets the collation used for client-server interaction on connection. In contrast to `charset`, `collation` does not issue additional queries. If the specified collation is unavailable on the target server, the connection will fail.
|
||||
|
||||
A list of valid charsets for a server is retrievable with `SHOW COLLATION`.
|
||||
|
||||
##### `clientFoundRows`
|
||||
|
||||
```
|
||||
Type: bool
|
||||
Valid Values: true, false
|
||||
Default: false
|
||||
```
|
||||
|
||||
`clientFoundRows=true` causes an UPDATE to return the number of matching rows instead of the number of rows changed.
|
||||
|
||||
##### `columnsWithAlias`
|
||||
|
||||
```
|
||||
Type: bool
|
||||
Valid Values: true, false
|
||||
Default: false
|
||||
```
|
||||
|
||||
When `columnsWithAlias` is true, calls to `sql.Rows.Columns()` will return the table alias and the column name separated by a dot. For example:
|
||||
|
||||
```
|
||||
SELECT u.id FROM users as u
|
||||
```
|
||||
|
||||
will return `u.id` instead of just `id` if `columnsWithAlias=true`.
|
||||
|
||||
##### `interpolateParams`
|
||||
|
||||
```
|
||||
Type: bool
|
||||
Valid Values: true, false
|
||||
Default: false
|
||||
```
|
||||
|
||||
If `interpolateParams` is true, placeholders (`?`) in calls to `db.Query()` and `db.Exec()` are interpolated into a single query string with given parameters. This reduces the number of roundtrips, since the driver has to prepare a statement, execute it with given parameters and close the statement again with `interpolateParams=false`.
|
||||
|
||||
*This can not be used together with the multibyte encodings BIG5, CP932, GB2312, GBK or SJIS. These are blacklisted as they may [introduce a SQL injection vulnerability](http://stackoverflow.com/a/12118602/3430118)!*
|
||||
|
||||
##### `loc`
|
||||
|
||||
```
|
||||
Type: string
|
||||
Valid Values: <escaped name>
|
||||
Default: UTC
|
||||
```
|
||||
|
||||
Sets the location for time.Time values (when using `parseTime=true`). *"Local"* sets the system's location. See [time.LoadLocation](http://golang.org/pkg/time/#LoadLocation) for details.
|
||||
|
||||
Note that this sets the location for time.Time values but does not change MySQL's [time_zone setting](https://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html). For that see the [time_zone system variable](#system-variables), which can also be set as a DSN parameter.
|
||||
|
||||
Please keep in mind, that param values must be [url.QueryEscape](http://golang.org/pkg/net/url/#QueryEscape)'ed. Alternatively you can manually replace the `/` with `%2F`. For example `US/Pacific` would be `loc=US%2FPacific`.
|
||||
|
||||
|
||||
##### `parseTime`
|
||||
|
||||
```
|
||||
Type: bool
|
||||
Valid Values: true, false
|
||||
Default: false
|
||||
```
|
||||
|
||||
`parseTime=true` changes the output type of `DATE` and `DATETIME` values to `time.Time` instead of `[]byte` / `string`
|
||||
|
||||
|
||||
##### `strict`
|
||||
|
||||
```
|
||||
Type: bool
|
||||
Valid Values: true, false
|
||||
Default: false
|
||||
```
|
||||
|
||||
`strict=true` enables the strict mode in which MySQL warnings are treated as errors.
|
||||
|
||||
By default MySQL also treats notes as warnings. Use [`sql_notes=false`](http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_sql_notes) to ignore notes. See the [examples](#examples) for an DSN example.
|
||||
|
||||
|
||||
##### `timeout`
|
||||
|
||||
```
|
||||
Type: decimal number
|
||||
Default: OS default
|
||||
```
|
||||
|
||||
*Driver* side connection timeout. The value must be a string of decimal numbers, each with optional fraction and a unit suffix ( *"ms"*, *"s"*, *"m"*, *"h"* ), such as *"30s"*, *"0.5m"* or *"1m30s"*. To set a server side timeout, use the parameter [`wait_timeout`](http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_wait_timeout).
|
||||
|
||||
|
||||
##### `tls`
|
||||
|
||||
```
|
||||
Type: bool / string
|
||||
Valid Values: true, false, skip-verify, <name>
|
||||
Default: false
|
||||
```
|
||||
|
||||
`tls=true` enables TLS / SSL encrypted connection to the server. Use `skip-verify` if you want to use a self-signed or invalid certificate (server side). Use a custom value registered with [`mysql.RegisterTLSConfig`](http://godoc.org/github.com/go-sql-driver/mysql#RegisterTLSConfig).
|
||||
|
||||
|
||||
##### System Variables
|
||||
|
||||
All other parameters are interpreted as system variables:
|
||||
* `autocommit`: `"SET autocommit=<value>"`
|
||||
* [`time_zone`](https://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html): `"SET time_zone=<value>"`
|
||||
* [`tx_isolation`](https://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_tx_isolation): `"SET tx_isolation=<value>"`
|
||||
* `param`: `"SET <param>=<value>"`
|
||||
|
||||
*The values must be [url.QueryEscape](http://golang.org/pkg/net/url/#QueryEscape)'ed!*
|
||||
|
||||
#### Examples
|
||||
```
|
||||
user@unix(/path/to/socket)/dbname
|
||||
```
|
||||
|
||||
```
|
||||
root:pw@unix(/tmp/mysql.sock)/myDatabase?loc=Local
|
||||
```
|
||||
|
||||
```
|
||||
user:password@tcp(localhost:5555)/dbname?tls=skip-verify&autocommit=true
|
||||
```
|
||||
|
||||
Use the [strict mode](#strict) but ignore notes:
|
||||
```
|
||||
user:password@/dbname?strict=true&sql_notes=false
|
||||
```
|
||||
|
||||
TCP via IPv6:
|
||||
```
|
||||
user:password@tcp([de:ad:be:ef::ca:fe]:80)/dbname?timeout=90s&collation=utf8mb4_unicode_ci
|
||||
```
|
||||
|
||||
TCP on a remote host, e.g. Amazon RDS:
|
||||
```
|
||||
id:password@tcp(your-amazonaws-uri.com:3306)/dbname
|
||||
```
|
||||
|
||||
Google Cloud SQL on App Engine:
|
||||
```
|
||||
user@cloudsql(project-id:instance-name)/dbname
|
||||
```
|
||||
|
||||
TCP using default port (3306) on localhost:
|
||||
```
|
||||
user:password@tcp/dbname?charset=utf8mb4,utf8&sys_var=esc%40ped
|
||||
```
|
||||
|
||||
Use the default protocol (tcp) and host (localhost:3306):
|
||||
```
|
||||
user:password@/dbname
|
||||
```
|
||||
|
||||
No Database preselected:
|
||||
```
|
||||
user:password@/
|
||||
```
|
||||
|
||||
### `LOAD DATA LOCAL INFILE` support
|
||||
For this feature you need direct access to the package. Therefore you must change the import path (no `_`):
|
||||
```go
|
||||
import "github.com/go-sql-driver/mysql"
|
||||
```
|
||||
|
||||
Files must be whitelisted by registering them with `mysql.RegisterLocalFile(filepath)` (recommended) or the Whitelist check must be deactivated by using the DSN parameter `allowAllFiles=true` ([*Might be insecure!*](http://dev.mysql.com/doc/refman/5.7/en/load-data-local.html)).
|
||||
|
||||
To use a `io.Reader` a handler function must be registered with `mysql.RegisterReaderHandler(name, handler)` which returns a `io.Reader` or `io.ReadCloser`. The Reader is available with the filepath `Reader::<name>` then.
|
||||
|
||||
See the [godoc of Go-MySQL-Driver](http://godoc.org/github.com/go-sql-driver/mysql "golang mysql driver documentation") for details.
|
||||
|
||||
|
||||
### `time.Time` support
|
||||
The default internal output type of MySQL `DATE` and `DATETIME` values is `[]byte` which allows you to scan the value into a `[]byte`, `string` or `sql.RawBytes` variable in your programm.
|
||||
|
||||
However, many want to scan MySQL `DATE` and `DATETIME` values into `time.Time` variables, which is the logical opposite in Go to `DATE` and `DATETIME` in MySQL. You can do that by changing the internal output type from `[]byte` to `time.Time` with the DSN parameter `parseTime=true`. You can set the default [`time.Time` location](http://golang.org/pkg/time/#Location) with the `loc` DSN parameter.
|
||||
|
||||
**Caution:** As of Go 1.1, this makes `time.Time` the only variable type you can scan `DATE` and `DATETIME` values into. This breaks for example [`sql.RawBytes` support](https://github.com/go-sql-driver/mysql/wiki/Examples#rawbytes).
|
||||
|
||||
Alternatively you can use the [`NullTime`](http://godoc.org/github.com/go-sql-driver/mysql#NullTime) type as the scan destination, which works with both `time.Time` and `string` / `[]byte`.
|
||||
|
||||
|
||||
### Unicode support
|
||||
Since version 1.1 Go-MySQL-Driver automatically uses the collation `utf8_general_ci` by default.
|
||||
|
||||
Other collations / charsets can be set using the [`collation`](#collation) DSN parameter.
|
||||
|
||||
Version 1.0 of the driver recommended adding `&charset=utf8` (alias for `SET NAMES utf8`) to the DSN to enable proper UTF-8 support. This is not necessary anymore. The [`collation`](#collation) parameter should be preferred to set another collation / charset than the default.
|
||||
|
||||
See http://dev.mysql.com/doc/refman/5.7/en/charset-unicode.html for more details on MySQL's Unicode support.
|
||||
|
||||
|
||||
## Testing / Development
|
||||
To run the driver tests you may need to adjust the configuration. See the [Testing Wiki-Page](https://github.com/go-sql-driver/mysql/wiki/Testing "Testing") for details.
|
||||
|
||||
Go-MySQL-Driver is not feature-complete yet. Your help is very appreciated.
|
||||
If you want to contribute, you can work on an [open issue](https://github.com/go-sql-driver/mysql/issues?state=open) or review a [pull request](https://github.com/go-sql-driver/mysql/pulls).
|
||||
|
||||
See the [Contribution Guidelines](https://github.com/go-sql-driver/mysql/blob/master/CONTRIBUTING.md) for details.
|
||||
|
||||
---------------------------------------
|
||||
|
||||
## License
|
||||
Go-MySQL-Driver is licensed under the [Mozilla Public License Version 2.0](https://raw.github.com/go-sql-driver/mysql/master/LICENSE)
|
||||
|
||||
Mozilla summarizes the license scope as follows:
|
||||
> MPL: The copyleft applies to any files containing MPLed code.
|
||||
|
||||
|
||||
That means:
|
||||
* You can **use** the **unchanged** source code both in private and commercially
|
||||
* When distributing, you **must publish** the source code of any **changed files** licensed under the MPL 2.0 under a) the MPL 2.0 itself or b) a compatible license (e.g. GPL 3.0 or Apache License 2.0)
|
||||
* You **needn't publish** the source code of your library as long as the files licensed under the MPL 2.0 are **unchanged**
|
||||
|
||||
Please read the [MPL 2.0 FAQ](http://www.mozilla.org/MPL/2.0/FAQ.html) if you have further questions regarding the license.
|
||||
|
||||
You can read the full terms here: [LICENSE](https://raw.github.com/go-sql-driver/mysql/master/LICENSE)
|
||||
|
||||

|
||||
|
||||
6
_vendor/vendor/github.com/gogo/protobuf/LICENSE
generated
vendored
6
_vendor/vendor/github.com/gogo/protobuf/LICENSE
generated
vendored
@ -1,7 +1,7 @@
|
||||
Extensions for Protocol Buffers to create more go like structures.
|
||||
Protocol Buffers for Go with Gadgets
|
||||
|
||||
Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
|
||||
http://github.com/gogo/protobuf/gogoproto
|
||||
Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
http://github.com/gogo/protobuf
|
||||
|
||||
Go support for Protocol Buffers - Google's data interchange format
|
||||
|
||||
|
||||
43
_vendor/vendor/github.com/gogo/protobuf/proto/Makefile
generated
vendored
43
_vendor/vendor/github.com/gogo/protobuf/proto/Makefile
generated
vendored
@ -1,43 +0,0 @@
|
||||
# Go support for Protocol Buffers - Google's data interchange format
|
||||
#
|
||||
# Copyright 2010 The Go Authors. All rights reserved.
|
||||
# https://github.com/golang/protobuf
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the name of Google Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
install:
|
||||
go install
|
||||
|
||||
test: install generate-test-pbs
|
||||
go test
|
||||
|
||||
|
||||
generate-test-pbs:
|
||||
make install
|
||||
make -C testdata
|
||||
protoc-min-version --version="3.0.0" --proto_path=.:../../../../ --gogo_out=. proto3_proto/proto3.proto
|
||||
make
|
||||
14
_vendor/vendor/github.com/gogo/protobuf/proto/clone.go
generated
vendored
14
_vendor/vendor/github.com/gogo/protobuf/proto/clone.go
generated
vendored
@ -84,14 +84,20 @@ func mergeStruct(out, in reflect.Value) {
|
||||
mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i])
|
||||
}
|
||||
|
||||
if emIn, ok := in.Addr().Interface().(extensionsMap); ok {
|
||||
emOut := out.Addr().Interface().(extensionsMap)
|
||||
mergeExtension(emOut.ExtensionMap(), emIn.ExtensionMap())
|
||||
} else if emIn, ok := in.Addr().Interface().(extensionsBytes); ok {
|
||||
if emIn, ok := in.Addr().Interface().(extensionsBytes); ok {
|
||||
emOut := out.Addr().Interface().(extensionsBytes)
|
||||
bIn := emIn.GetExtensions()
|
||||
bOut := emOut.GetExtensions()
|
||||
*bOut = append(*bOut, *bIn...)
|
||||
} else if emIn, ok := extendable(in.Addr().Interface()); ok {
|
||||
emOut, _ := extendable(out.Addr().Interface())
|
||||
mIn, muIn := emIn.extensionsRead()
|
||||
if mIn != nil {
|
||||
mOut := emOut.extensionsWrite()
|
||||
muIn.Lock()
|
||||
mergeExtension(mOut, mIn)
|
||||
muIn.Unlock()
|
||||
}
|
||||
}
|
||||
|
||||
uf := in.FieldByName("XXX_unrecognized")
|
||||
|
||||
34
_vendor/vendor/github.com/gogo/protobuf/proto/decode.go
generated
vendored
34
_vendor/vendor/github.com/gogo/protobuf/proto/decode.go
generated
vendored
@ -378,6 +378,11 @@ func (o *Buffer) unmarshalType(st reflect.Type, prop *StructProperties, is_group
|
||||
wire := int(u & 0x7)
|
||||
if wire == WireEndGroup {
|
||||
if is_group {
|
||||
if required > 0 {
|
||||
// Not enough information to determine the exact field.
|
||||
// (See below.)
|
||||
return &RequiredNotSetError{"{Unknown}"}
|
||||
}
|
||||
return nil // input is satisfied
|
||||
}
|
||||
return fmt.Errorf("proto: %s: wiretype end group for non-group", st)
|
||||
@ -390,16 +395,20 @@ func (o *Buffer) unmarshalType(st reflect.Type, prop *StructProperties, is_group
|
||||
if !ok {
|
||||
// Maybe it's an extension?
|
||||
if prop.extendable {
|
||||
if e := structPointer_Interface(base, st).(extendableProto); isExtensionField(e, int32(tag)) {
|
||||
if err = o.skip(st, tag, wire); err == nil {
|
||||
if ee, eok := e.(extensionsMap); eok {
|
||||
ext := ee.ExtensionMap()[int32(tag)] // may be missing
|
||||
ext.enc = append(ext.enc, o.buf[oi:o.index]...)
|
||||
ee.ExtensionMap()[int32(tag)] = ext
|
||||
} else if ee, eok := e.(extensionsBytes); eok {
|
||||
ext := ee.GetExtensions()
|
||||
if e, eok := structPointer_Interface(base, st).(extensionsBytes); eok {
|
||||
if isExtensionField(e, int32(tag)) {
|
||||
if err = o.skip(st, tag, wire); err == nil {
|
||||
ext := e.GetExtensions()
|
||||
*ext = append(*ext, o.buf[oi:o.index]...)
|
||||
}
|
||||
continue
|
||||
}
|
||||
} else if e, _ := extendable(structPointer_Interface(base, st)); isExtensionField(e, int32(tag)) {
|
||||
if err = o.skip(st, tag, wire); err == nil {
|
||||
extmap := e.extensionsWrite()
|
||||
ext := extmap[int32(tag)] // may be missing
|
||||
ext.enc = append(ext.enc, o.buf[oi:o.index]...)
|
||||
extmap[int32(tag)] = ext
|
||||
}
|
||||
continue
|
||||
}
|
||||
@ -773,10 +782,11 @@ func (o *Buffer) dec_new_map(p *Properties, base structPointer) error {
|
||||
}
|
||||
}
|
||||
keyelem, valelem := keyptr.Elem(), valptr.Elem()
|
||||
if !keyelem.IsValid() || !valelem.IsValid() {
|
||||
// We did not decode the key or the value in the map entry.
|
||||
// Either way, it's an invalid map entry.
|
||||
return fmt.Errorf("proto: bad map data: missing key/val")
|
||||
if !keyelem.IsValid() {
|
||||
keyelem = reflect.Zero(p.mtype.Key())
|
||||
}
|
||||
if !valelem.IsValid() {
|
||||
valelem = reflect.Zero(p.mtype.Elem())
|
||||
}
|
||||
|
||||
v.SetMapIndex(keyelem, valelem)
|
||||
|
||||
6
_vendor/vendor/github.com/gogo/protobuf/proto/decode_gogo.go
generated
vendored
6
_vendor/vendor/github.com/gogo/protobuf/proto/decode_gogo.go
generated
vendored
@ -1,5 +1,7 @@
|
||||
// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
|
||||
// http://github.com/gogo/protobuf/gogoproto
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
||||
60
_vendor/vendor/github.com/gogo/protobuf/proto/encode.go
generated
vendored
60
_vendor/vendor/github.com/gogo/protobuf/proto/encode.go
generated
vendored
@ -64,8 +64,16 @@ var (
|
||||
// a struct with a repeated field containing a nil element.
|
||||
errRepeatedHasNil = errors.New("proto: repeated field has nil element")
|
||||
|
||||
// errOneofHasNil is the error returned if Marshal is called with
|
||||
// a struct with a oneof field containing a nil element.
|
||||
errOneofHasNil = errors.New("proto: oneof field has nil value")
|
||||
|
||||
// ErrNil is the error returned if Marshal is called with nil.
|
||||
ErrNil = errors.New("proto: Marshal called with nil")
|
||||
|
||||
// ErrTooLarge is the error returned if Marshal is called with a
|
||||
// message that encodes to >2GB.
|
||||
ErrTooLarge = errors.New("proto: message encodes to over 2 GB")
|
||||
)
|
||||
|
||||
// The fundamental encoders that put bytes on the wire.
|
||||
@ -74,6 +82,10 @@ var (
|
||||
|
||||
const maxVarintBytes = 10 // maximum length of a varint
|
||||
|
||||
// maxMarshalSize is the largest allowed size of an encoded protobuf,
|
||||
// since C++ and Java use signed int32s for the size.
|
||||
const maxMarshalSize = 1<<31 - 1
|
||||
|
||||
// EncodeVarint returns the varint encoding of x.
|
||||
// This is the format for the
|
||||
// int32, int64, uint32, uint64, bool, and enum
|
||||
@ -273,6 +285,9 @@ func (p *Buffer) Marshal(pb Message) error {
|
||||
stats.Encode++
|
||||
}
|
||||
|
||||
if len(p.buf) > maxMarshalSize {
|
||||
return ErrTooLarge
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@ -1058,10 +1073,25 @@ func size_slice_struct_group(p *Properties, base structPointer) (n int) {
|
||||
|
||||
// Encode an extension map.
|
||||
func (o *Buffer) enc_map(p *Properties, base structPointer) error {
|
||||
v := *structPointer_ExtMap(base, p.field)
|
||||
if err := encodeExtensionMap(v); err != nil {
|
||||
exts := structPointer_ExtMap(base, p.field)
|
||||
if err := encodeExtensionsMap(*exts); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return o.enc_map_body(*exts)
|
||||
}
|
||||
|
||||
func (o *Buffer) enc_exts(p *Properties, base structPointer) error {
|
||||
exts := structPointer_Extensions(base, p.field)
|
||||
if err := encodeExtensions(exts); err != nil {
|
||||
return err
|
||||
}
|
||||
v, _ := exts.extensionsRead()
|
||||
|
||||
return o.enc_map_body(v)
|
||||
}
|
||||
|
||||
func (o *Buffer) enc_map_body(v map[int32]Extension) error {
|
||||
// Fast-path for common cases: zero or one extensions.
|
||||
if len(v) <= 1 {
|
||||
for _, e := range v {
|
||||
@ -1084,8 +1114,13 @@ func (o *Buffer) enc_map(p *Properties, base structPointer) error {
|
||||
}
|
||||
|
||||
func size_map(p *Properties, base structPointer) int {
|
||||
v := *structPointer_ExtMap(base, p.field)
|
||||
return sizeExtensionMap(v)
|
||||
v := structPointer_ExtMap(base, p.field)
|
||||
return extensionsMapSize(*v)
|
||||
}
|
||||
|
||||
func size_exts(p *Properties, base structPointer) int {
|
||||
v := structPointer_Extensions(base, p.field)
|
||||
return extensionsSize(v)
|
||||
}
|
||||
|
||||
// Encode a map field.
|
||||
@ -1114,7 +1149,7 @@ func (o *Buffer) enc_new_map(p *Properties, base structPointer) error {
|
||||
if err := p.mkeyprop.enc(o, p.mkeyprop, keybase); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.mvalprop.enc(o, p.mvalprop, valbase); err != nil {
|
||||
if err := p.mvalprop.enc(o, p.mvalprop, valbase); err != nil && err != ErrNil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@ -1124,11 +1159,6 @@ func (o *Buffer) enc_new_map(p *Properties, base structPointer) error {
|
||||
for _, key := range v.MapKeys() {
|
||||
val := v.MapIndex(key)
|
||||
|
||||
// The only illegal map entry values are nil message pointers.
|
||||
if val.Kind() == reflect.Ptr && val.IsNil() {
|
||||
return errors.New("proto: map has nil element")
|
||||
}
|
||||
|
||||
keycopy.Set(key)
|
||||
valcopy.Set(val)
|
||||
|
||||
@ -1216,13 +1246,18 @@ func (o *Buffer) enc_struct(prop *StructProperties, base structPointer) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if len(o.buf) > maxMarshalSize {
|
||||
return ErrTooLarge
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Do oneof fields.
|
||||
if prop.oneofMarshaler != nil {
|
||||
m := structPointer_Interface(base, prop.stype).(Message)
|
||||
if err := prop.oneofMarshaler(m, o); err != nil {
|
||||
if err := prop.oneofMarshaler(m, o); err == ErrNil {
|
||||
return errOneofHasNil
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@ -1230,6 +1265,9 @@ func (o *Buffer) enc_struct(prop *StructProperties, base structPointer) error {
|
||||
// Add unrecognized fields at the end.
|
||||
if prop.unrecField.IsValid() {
|
||||
v := *structPointer_Bytes(base, prop.unrecField)
|
||||
if len(o.buf)+len(v) > maxMarshalSize {
|
||||
return ErrTooLarge
|
||||
}
|
||||
if len(v) > 0 {
|
||||
o.buf = append(o.buf, v...)
|
||||
}
|
||||
|
||||
6
_vendor/vendor/github.com/gogo/protobuf/proto/encode_gogo.go
generated
vendored
6
_vendor/vendor/github.com/gogo/protobuf/proto/encode_gogo.go
generated
vendored
@ -1,7 +1,7 @@
|
||||
// Extensions for Protocol Buffers to create more go like structures.
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
|
||||
// http://github.com/gogo/protobuf/gogoproto
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
|
||||
26
_vendor/vendor/github.com/gogo/protobuf/proto/equal.go
generated
vendored
26
_vendor/vendor/github.com/gogo/protobuf/proto/equal.go
generated
vendored
@ -121,9 +121,16 @@ func equalStruct(v1, v2 reflect.Value) bool {
|
||||
}
|
||||
}
|
||||
|
||||
if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() {
|
||||
em2 := v2.FieldByName("XXX_InternalExtensions")
|
||||
if !equalExtensions(v1.Type(), em1.Interface().(XXX_InternalExtensions), em2.Interface().(XXX_InternalExtensions)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() {
|
||||
em2 := v2.FieldByName("XXX_extensions")
|
||||
if !equalExtensions(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) {
|
||||
if !equalExtMap(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
@ -184,6 +191,13 @@ func equalAny(v1, v2 reflect.Value, prop *Properties) bool {
|
||||
}
|
||||
return true
|
||||
case reflect.Ptr:
|
||||
// Maps may have nil values in them, so check for nil.
|
||||
if v1.IsNil() && v2.IsNil() {
|
||||
return true
|
||||
}
|
||||
if v1.IsNil() != v2.IsNil() {
|
||||
return false
|
||||
}
|
||||
return equalAny(v1.Elem(), v2.Elem(), prop)
|
||||
case reflect.Slice:
|
||||
if v1.Type().Elem().Kind() == reflect.Uint8 {
|
||||
@ -223,8 +237,14 @@ func equalAny(v1, v2 reflect.Value, prop *Properties) bool {
|
||||
}
|
||||
|
||||
// base is the struct type that the extensions are based on.
|
||||
// em1 and em2 are extension maps.
|
||||
func equalExtensions(base reflect.Type, em1, em2 map[int32]Extension) bool {
|
||||
// x1 and x2 are InternalExtensions.
|
||||
func equalExtensions(base reflect.Type, x1, x2 XXX_InternalExtensions) bool {
|
||||
em1, _ := x1.extensionsRead()
|
||||
em2, _ := x2.extensionsRead()
|
||||
return equalExtMap(base, em1, em2)
|
||||
}
|
||||
|
||||
func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool {
|
||||
if len(em1) != len(em2) {
|
||||
return false
|
||||
}
|
||||
|
||||
409
_vendor/vendor/github.com/gogo/protobuf/proto/extensions.go
generated
vendored
409
_vendor/vendor/github.com/gogo/protobuf/proto/extensions.go
generated
vendored
@ -52,23 +52,112 @@ type ExtensionRange struct {
|
||||
Start, End int32 // both inclusive
|
||||
}
|
||||
|
||||
// extendableProto is an interface implemented by any protocol buffer that may be extended.
|
||||
// extendableProto is an interface implemented by any protocol buffer generated by the current
|
||||
// proto compiler that may be extended.
|
||||
type extendableProto interface {
|
||||
Message
|
||||
ExtensionRangeArray() []ExtensionRange
|
||||
extensionsWrite() map[int32]Extension
|
||||
extensionsRead() (map[int32]Extension, sync.Locker)
|
||||
}
|
||||
|
||||
type extensionsMap interface {
|
||||
extendableProto
|
||||
// extendableProtoV1 is an interface implemented by a protocol buffer generated by the previous
|
||||
// version of the proto compiler that may be extended.
|
||||
type extendableProtoV1 interface {
|
||||
Message
|
||||
ExtensionRangeArray() []ExtensionRange
|
||||
ExtensionMap() map[int32]Extension
|
||||
}
|
||||
|
||||
type extensionsBytes interface {
|
||||
extendableProto
|
||||
Message
|
||||
ExtensionRangeArray() []ExtensionRange
|
||||
GetExtensions() *[]byte
|
||||
}
|
||||
|
||||
// extensionAdapter is a wrapper around extendableProtoV1 that implements extendableProto.
|
||||
type extensionAdapter struct {
|
||||
extendableProtoV1
|
||||
}
|
||||
|
||||
func (e extensionAdapter) extensionsWrite() map[int32]Extension {
|
||||
return e.ExtensionMap()
|
||||
}
|
||||
|
||||
func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) {
|
||||
return e.ExtensionMap(), notLocker{}
|
||||
}
|
||||
|
||||
// notLocker is a sync.Locker whose Lock and Unlock methods are nops.
|
||||
type notLocker struct{}
|
||||
|
||||
func (n notLocker) Lock() {}
|
||||
func (n notLocker) Unlock() {}
|
||||
|
||||
// extendable returns the extendableProto interface for the given generated proto message.
|
||||
// If the proto message has the old extension format, it returns a wrapper that implements
|
||||
// the extendableProto interface.
|
||||
func extendable(p interface{}) (extendableProto, bool) {
|
||||
if ep, ok := p.(extendableProto); ok {
|
||||
return ep, ok
|
||||
}
|
||||
if ep, ok := p.(extendableProtoV1); ok {
|
||||
return extensionAdapter{ep}, ok
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// XXX_InternalExtensions is an internal representation of proto extensions.
|
||||
//
|
||||
// Each generated message struct type embeds an anonymous XXX_InternalExtensions field,
|
||||
// thus gaining the unexported 'extensions' method, which can be called only from the proto package.
|
||||
//
|
||||
// The methods of XXX_InternalExtensions are not concurrency safe in general,
|
||||
// but calls to logically read-only methods such as has and get may be executed concurrently.
|
||||
type XXX_InternalExtensions struct {
|
||||
// The struct must be indirect so that if a user inadvertently copies a
|
||||
// generated message and its embedded XXX_InternalExtensions, they
|
||||
// avoid the mayhem of a copied mutex.
|
||||
//
|
||||
// The mutex serializes all logically read-only operations to p.extensionMap.
|
||||
// It is up to the client to ensure that write operations to p.extensionMap are
|
||||
// mutually exclusive with other accesses.
|
||||
p *struct {
|
||||
mu sync.Mutex
|
||||
extensionMap map[int32]Extension
|
||||
}
|
||||
}
|
||||
|
||||
// extensionsWrite returns the extension map, creating it on first use.
|
||||
func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension {
|
||||
if e.p == nil {
|
||||
e.p = new(struct {
|
||||
mu sync.Mutex
|
||||
extensionMap map[int32]Extension
|
||||
})
|
||||
e.p.extensionMap = make(map[int32]Extension)
|
||||
}
|
||||
return e.p.extensionMap
|
||||
}
|
||||
|
||||
// extensionsRead returns the extensions map for read-only use. It may be nil.
|
||||
// The caller must hold the returned mutex's lock when accessing Elements within the map.
|
||||
func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Locker) {
|
||||
if e.p == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return e.p.extensionMap, &e.p.mu
|
||||
}
|
||||
|
||||
type extensionRange interface {
|
||||
Message
|
||||
ExtensionRangeArray() []ExtensionRange
|
||||
}
|
||||
|
||||
var extendableProtoType = reflect.TypeOf((*extendableProto)(nil)).Elem()
|
||||
var extendableProtoV1Type = reflect.TypeOf((*extendableProtoV1)(nil)).Elem()
|
||||
var extendableBytesType = reflect.TypeOf((*extensionsBytes)(nil)).Elem()
|
||||
var extensionRangeType = reflect.TypeOf((*extensionRange)(nil)).Elem()
|
||||
|
||||
// ExtensionDesc represents an extension specification.
|
||||
// Used in generated code from the protocol compiler.
|
||||
@ -101,20 +190,23 @@ type Extension struct {
|
||||
}
|
||||
|
||||
// SetRawExtension is for testing only.
|
||||
func SetRawExtension(base extendableProto, id int32, b []byte) {
|
||||
if ebase, ok := base.(extensionsMap); ok {
|
||||
ebase.ExtensionMap()[id] = Extension{enc: b}
|
||||
} else if ebase, ok := base.(extensionsBytes); ok {
|
||||
func SetRawExtension(base Message, id int32, b []byte) {
|
||||
if ebase, ok := base.(extensionsBytes); ok {
|
||||
clearExtension(base, id)
|
||||
ext := ebase.GetExtensions()
|
||||
*ext = append(*ext, b...)
|
||||
} else {
|
||||
panic("unreachable")
|
||||
return
|
||||
}
|
||||
epb, ok := extendable(base)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
extmap := epb.extensionsWrite()
|
||||
extmap[id] = Extension{enc: b}
|
||||
}
|
||||
|
||||
// isExtensionField returns true iff the given field number is in an extension range.
|
||||
func isExtensionField(pb extendableProto, field int32) bool {
|
||||
func isExtensionField(pb extensionRange, field int32) bool {
|
||||
for _, er := range pb.ExtensionRangeArray() {
|
||||
if er.Start <= field && field <= er.End {
|
||||
return true
|
||||
@ -125,8 +217,12 @@ func isExtensionField(pb extendableProto, field int32) bool {
|
||||
|
||||
// checkExtensionTypes checks that the given extension is valid for pb.
|
||||
func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error {
|
||||
var pbi interface{} = pb
|
||||
// Check the extended type.
|
||||
if a, b := reflect.TypeOf(pb), reflect.TypeOf(extension.ExtendedType); a != b {
|
||||
if ea, ok := pbi.(extensionAdapter); ok {
|
||||
pbi = ea.extendableProtoV1
|
||||
}
|
||||
if a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b {
|
||||
return errors.New("proto: bad extended type; " + b.String() + " does not extend " + a.String())
|
||||
}
|
||||
// Check the range.
|
||||
@ -172,43 +268,57 @@ func extensionProperties(ed *ExtensionDesc) *Properties {
|
||||
return prop
|
||||
}
|
||||
|
||||
// encodeExtensionMap encodes any unmarshaled (unencoded) extensions in m.
|
||||
func encodeExtensionMap(m map[int32]Extension) error {
|
||||
// encode encodes any unmarshaled (unencoded) extensions in e.
|
||||
func encodeExtensions(e *XXX_InternalExtensions) error {
|
||||
m, mu := e.extensionsRead()
|
||||
if m == nil {
|
||||
return nil // fast path
|
||||
}
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
return encodeExtensionsMap(m)
|
||||
}
|
||||
|
||||
// encode encodes any unmarshaled (unencoded) extensions in e.
|
||||
func encodeExtensionsMap(m map[int32]Extension) error {
|
||||
for k, e := range m {
|
||||
err := encodeExtension(&e)
|
||||
if err != nil {
|
||||
if e.value == nil || e.desc == nil {
|
||||
// Extension is only in its encoded form.
|
||||
continue
|
||||
}
|
||||
|
||||
// We don't skip extensions that have an encoded form set,
|
||||
// because the extension value may have been mutated after
|
||||
// the last time this function was called.
|
||||
|
||||
et := reflect.TypeOf(e.desc.ExtensionType)
|
||||
props := extensionProperties(e.desc)
|
||||
|
||||
p := NewBuffer(nil)
|
||||
// If e.value has type T, the encoder expects a *struct{ X T }.
|
||||
// Pass a *T with a zero field and hope it all works out.
|
||||
x := reflect.New(et)
|
||||
x.Elem().Set(reflect.ValueOf(e.value))
|
||||
if err := props.enc(p, props, toStructPointer(x)); err != nil {
|
||||
return err
|
||||
}
|
||||
e.enc = p.buf
|
||||
m[k] = e
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeExtension(e *Extension) error {
|
||||
if e.value == nil || e.desc == nil {
|
||||
// Extension is only in its encoded form.
|
||||
return nil
|
||||
func extensionsSize(e *XXX_InternalExtensions) (n int) {
|
||||
m, mu := e.extensionsRead()
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
// We don't skip extensions that have an encoded form set,
|
||||
// because the extension value may have been mutated after
|
||||
// the last time this function was called.
|
||||
|
||||
et := reflect.TypeOf(e.desc.ExtensionType)
|
||||
props := extensionProperties(e.desc)
|
||||
|
||||
p := NewBuffer(nil)
|
||||
// If e.value has type T, the encoder expects a *struct{ X T }.
|
||||
// Pass a *T with a zero field and hope it all works out.
|
||||
x := reflect.New(et)
|
||||
x.Elem().Set(reflect.ValueOf(e.value))
|
||||
if err := props.enc(p, props, toStructPointer(x)); err != nil {
|
||||
return err
|
||||
}
|
||||
e.enc = p.buf
|
||||
return nil
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
return extensionsMapSize(m)
|
||||
}
|
||||
|
||||
func sizeExtensionMap(m map[int32]Extension) (n int) {
|
||||
func extensionsMapSize(m map[int32]Extension) (n int) {
|
||||
for _, e := range m {
|
||||
if e.value == nil || e.desc == nil {
|
||||
// Extension is only in its encoded form.
|
||||
@ -233,12 +343,8 @@ func sizeExtensionMap(m map[int32]Extension) (n int) {
|
||||
}
|
||||
|
||||
// HasExtension returns whether the given extension is present in pb.
|
||||
func HasExtension(pb extendableProto, extension *ExtensionDesc) bool {
|
||||
// TODO: Check types, field numbers, etc.?
|
||||
if epb, doki := pb.(extensionsMap); doki {
|
||||
_, ok := epb.ExtensionMap()[extension.Field]
|
||||
return ok
|
||||
} else if epb, doki := pb.(extensionsBytes); doki {
|
||||
func HasExtension(pb Message, extension *ExtensionDesc) bool {
|
||||
if epb, doki := pb.(extensionsBytes); doki {
|
||||
ext := epb.GetExtensions()
|
||||
buf := *ext
|
||||
o := 0
|
||||
@ -258,7 +364,19 @@ func HasExtension(pb extendableProto, extension *ExtensionDesc) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
panic("unreachable")
|
||||
// TODO: Check types, field numbers, etc.?
|
||||
epb, ok := extendable(pb)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
extmap, mu := epb.extensionsRead()
|
||||
if extmap == nil {
|
||||
return false
|
||||
}
|
||||
mu.Lock()
|
||||
_, ok = extmap[extension.Field]
|
||||
mu.Unlock()
|
||||
return ok
|
||||
}
|
||||
|
||||
func deleteExtension(pb extensionsBytes, theFieldNum int32, offset int) int {
|
||||
@ -281,64 +399,32 @@ func deleteExtension(pb extensionsBytes, theFieldNum int32, offset int) int {
|
||||
return -1
|
||||
}
|
||||
|
||||
func clearExtension(pb extendableProto, fieldNum int32) {
|
||||
if epb, doki := pb.(extensionsMap); doki {
|
||||
delete(epb.ExtensionMap(), fieldNum)
|
||||
} else if epb, doki := pb.(extensionsBytes); doki {
|
||||
// ClearExtension removes the given extension from pb.
|
||||
func ClearExtension(pb Message, extension *ExtensionDesc) {
|
||||
clearExtension(pb, extension.Field)
|
||||
}
|
||||
|
||||
func clearExtension(pb Message, fieldNum int32) {
|
||||
if epb, doki := pb.(extensionsBytes); doki {
|
||||
offset := 0
|
||||
for offset != -1 {
|
||||
offset = deleteExtension(epb, fieldNum, offset)
|
||||
}
|
||||
} else {
|
||||
panic("unreachable")
|
||||
return
|
||||
}
|
||||
epb, ok := extendable(pb)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// ClearExtension removes the given extension from pb.
|
||||
func ClearExtension(pb extendableProto, extension *ExtensionDesc) {
|
||||
// TODO: Check types, field numbers, etc.?
|
||||
clearExtension(pb, extension.Field)
|
||||
extmap := epb.extensionsWrite()
|
||||
delete(extmap, fieldNum)
|
||||
}
|
||||
|
||||
// GetExtension parses and returns the given extension of pb.
|
||||
// If the extension is not present it returns ErrMissingExtension.
|
||||
func GetExtension(pb extendableProto, extension *ExtensionDesc) (interface{}, error) {
|
||||
if err := checkExtensionTypes(pb, extension); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if epb, doki := pb.(extensionsMap); doki {
|
||||
emap := epb.ExtensionMap()
|
||||
e, ok := emap[extension.Field]
|
||||
if !ok {
|
||||
// defaultExtensionValue returns the default value or
|
||||
// ErrMissingExtension if there is no default.
|
||||
return defaultExtensionValue(extension)
|
||||
}
|
||||
if e.value != nil {
|
||||
// Already decoded. Check the descriptor, though.
|
||||
if e.desc != extension {
|
||||
// This shouldn't happen. If it does, it means that
|
||||
// GetExtension was called twice with two different
|
||||
// descriptors with the same field number.
|
||||
return nil, errors.New("proto: descriptor conflict")
|
||||
}
|
||||
return e.value, nil
|
||||
}
|
||||
|
||||
v, err := decodeExtension(e.enc, extension)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Remember the decoded version and drop the encoded version.
|
||||
// That way it is safe to mutate what we return.
|
||||
e.value = v
|
||||
e.desc = extension
|
||||
e.enc = nil
|
||||
emap[extension.Field] = e
|
||||
return e.value, nil
|
||||
} else if epb, doki := pb.(extensionsBytes); doki {
|
||||
// If the extension is not present and has no default value it returns ErrMissingExtension.
|
||||
func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) {
|
||||
if epb, doki := pb.(extensionsBytes); doki {
|
||||
ext := epb.GetExtensions()
|
||||
o := 0
|
||||
for o < len(*ext) {
|
||||
@ -360,7 +446,50 @@ func GetExtension(pb extendableProto, extension *ExtensionDesc) (interface{}, er
|
||||
}
|
||||
return defaultExtensionValue(extension)
|
||||
}
|
||||
panic("unreachable")
|
||||
epb, ok := extendable(pb)
|
||||
if !ok {
|
||||
return nil, errors.New("proto: not an extendable proto")
|
||||
}
|
||||
if err := checkExtensionTypes(epb, extension); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
emap, mu := epb.extensionsRead()
|
||||
if emap == nil {
|
||||
return defaultExtensionValue(extension)
|
||||
}
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
e, ok := emap[extension.Field]
|
||||
if !ok {
|
||||
// defaultExtensionValue returns the default value or
|
||||
// ErrMissingExtension if there is no default.
|
||||
return defaultExtensionValue(extension)
|
||||
}
|
||||
|
||||
if e.value != nil {
|
||||
// Already decoded. Check the descriptor, though.
|
||||
if e.desc != extension {
|
||||
// This shouldn't happen. If it does, it means that
|
||||
// GetExtension was called twice with two different
|
||||
// descriptors with the same field number.
|
||||
return nil, errors.New("proto: descriptor conflict")
|
||||
}
|
||||
return e.value, nil
|
||||
}
|
||||
|
||||
v, err := decodeExtension(e.enc, extension)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Remember the decoded version and drop the encoded version.
|
||||
// That way it is safe to mutate what we return.
|
||||
e.value = v
|
||||
e.desc = extension
|
||||
e.enc = nil
|
||||
emap[extension.Field] = e
|
||||
return e.value, nil
|
||||
}
|
||||
|
||||
// defaultExtensionValue returns the default value for extension.
|
||||
@ -434,14 +563,9 @@ func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) {
|
||||
// GetExtensions returns a slice of the extensions present in pb that are also listed in es.
|
||||
// The returned slice has the same length as es; missing extensions will appear as nil elements.
|
||||
func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) {
|
||||
epb, ok := pb.(extendableProto)
|
||||
if !ok {
|
||||
err = errors.New("proto: not an extendable proto")
|
||||
return
|
||||
}
|
||||
extensions = make([]interface{}, len(es))
|
||||
for i, e := range es {
|
||||
extensions[i], err = GetExtension(epb, e)
|
||||
extensions[i], err = GetExtension(pb, e)
|
||||
if err == ErrMissingExtension {
|
||||
err = nil
|
||||
}
|
||||
@ -452,9 +576,55 @@ func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, e
|
||||
return
|
||||
}
|
||||
|
||||
// ExtensionDescs returns a new slice containing pb's extension descriptors, in undefined order.
|
||||
// For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing
|
||||
// just the Field field, which defines the extension's field number.
|
||||
func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) {
|
||||
epb, ok := extendable(pb)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("proto: %T is not an extendable proto.Message", pb)
|
||||
}
|
||||
registeredExtensions := RegisteredExtensions(pb)
|
||||
|
||||
emap, mu := epb.extensionsRead()
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
extensions := make([]*ExtensionDesc, 0, len(emap))
|
||||
for extid, e := range emap {
|
||||
desc := e.desc
|
||||
if desc == nil {
|
||||
desc = registeredExtensions[extid]
|
||||
if desc == nil {
|
||||
desc = &ExtensionDesc{Field: extid}
|
||||
}
|
||||
}
|
||||
|
||||
extensions = append(extensions, desc)
|
||||
}
|
||||
return extensions, nil
|
||||
}
|
||||
|
||||
// SetExtension sets the specified extension of pb to the specified value.
|
||||
func SetExtension(pb extendableProto, extension *ExtensionDesc, value interface{}) error {
|
||||
if err := checkExtensionTypes(pb, extension); err != nil {
|
||||
func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error {
|
||||
if epb, doki := pb.(extensionsBytes); doki {
|
||||
ClearExtension(pb, extension)
|
||||
ext := epb.GetExtensions()
|
||||
et := reflect.TypeOf(extension.ExtensionType)
|
||||
props := extensionProperties(extension)
|
||||
p := NewBuffer(nil)
|
||||
x := reflect.New(et)
|
||||
x.Elem().Set(reflect.ValueOf(value))
|
||||
if err := props.enc(p, props, toStructPointer(x)); err != nil {
|
||||
return err
|
||||
}
|
||||
*ext = append(*ext, p.buf...)
|
||||
return nil
|
||||
}
|
||||
epb, ok := extendable(pb)
|
||||
if !ok {
|
||||
return errors.New("proto: not an extendable proto")
|
||||
}
|
||||
if err := checkExtensionTypes(epb, extension); err != nil {
|
||||
return err
|
||||
}
|
||||
typ := reflect.TypeOf(extension.ExtensionType)
|
||||
@ -469,26 +639,27 @@ func SetExtension(pb extendableProto, extension *ExtensionDesc, value interface{
|
||||
if reflect.ValueOf(value).IsNil() {
|
||||
return fmt.Errorf("proto: SetExtension called with nil value of type %T", value)
|
||||
}
|
||||
return setExtension(pb, extension, value)
|
||||
|
||||
extmap := epb.extensionsWrite()
|
||||
extmap[extension.Field] = Extension{desc: extension, value: value}
|
||||
return nil
|
||||
}
|
||||
|
||||
func setExtension(pb extendableProto, extension *ExtensionDesc, value interface{}) error {
|
||||
if epb, doki := pb.(extensionsMap); doki {
|
||||
epb.ExtensionMap()[extension.Field] = Extension{desc: extension, value: value}
|
||||
} else if epb, doki := pb.(extensionsBytes); doki {
|
||||
ClearExtension(pb, extension)
|
||||
// ClearAllExtensions clears all extensions from pb.
|
||||
func ClearAllExtensions(pb Message) {
|
||||
if epb, doki := pb.(extensionsBytes); doki {
|
||||
ext := epb.GetExtensions()
|
||||
et := reflect.TypeOf(extension.ExtensionType)
|
||||
props := extensionProperties(extension)
|
||||
p := NewBuffer(nil)
|
||||
x := reflect.New(et)
|
||||
x.Elem().Set(reflect.ValueOf(value))
|
||||
if err := props.enc(p, props, toStructPointer(x)); err != nil {
|
||||
return err
|
||||
}
|
||||
*ext = append(*ext, p.buf...)
|
||||
*ext = []byte{}
|
||||
return
|
||||
}
|
||||
epb, ok := extendable(pb)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
m := epb.extensionsWrite()
|
||||
for k := range m {
|
||||
delete(m, k)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// A global registry of extensions.
|
||||
|
||||
92
_vendor/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go
generated
vendored
92
_vendor/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go
generated
vendored
@ -1,5 +1,7 @@
|
||||
// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
|
||||
// http://github.com/gogo/protobuf/gogoproto
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
@ -33,9 +35,10 @@ import (
|
||||
"reflect"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
func GetBoolExtension(pb extendableProto, extension *ExtensionDesc, ifnotset bool) bool {
|
||||
func GetBoolExtension(pb Message, extension *ExtensionDesc, ifnotset bool) bool {
|
||||
if reflect.ValueOf(pb).IsNil() {
|
||||
return ifnotset
|
||||
}
|
||||
@ -56,8 +59,16 @@ func (this *Extension) Equal(that *Extension) bool {
|
||||
return bytes.Equal(this.enc, that.enc)
|
||||
}
|
||||
|
||||
func (this *Extension) Compare(that *Extension) int {
|
||||
return bytes.Compare(this.enc, that.enc)
|
||||
}
|
||||
|
||||
func SizeOfInternalExtension(m extendableProto) (n int) {
|
||||
return SizeOfExtensionMap(m.extensionsWrite())
|
||||
}
|
||||
|
||||
func SizeOfExtensionMap(m map[int32]Extension) (n int) {
|
||||
return sizeExtensionMap(m)
|
||||
return extensionsMapSize(m)
|
||||
}
|
||||
|
||||
type sortableMapElem struct {
|
||||
@ -90,6 +101,10 @@ func (this sortableExtensions) String() string {
|
||||
return "map[" + strings.Join(ss, ",") + "]"
|
||||
}
|
||||
|
||||
func StringFromInternalExtension(m extendableProto) string {
|
||||
return StringFromExtensionsMap(m.extensionsWrite())
|
||||
}
|
||||
|
||||
func StringFromExtensionsMap(m map[int32]Extension) string {
|
||||
return newSortableExtensionsFromMap(m).String()
|
||||
}
|
||||
@ -102,8 +117,12 @@ func StringFromExtensionsBytes(ext []byte) string {
|
||||
return StringFromExtensionsMap(m)
|
||||
}
|
||||
|
||||
func EncodeInternalExtension(m extendableProto, data []byte) (n int, err error) {
|
||||
return EncodeExtensionMap(m.extensionsWrite(), data)
|
||||
}
|
||||
|
||||
func EncodeExtensionMap(m map[int32]Extension, data []byte) (n int, err error) {
|
||||
if err := encodeExtensionMap(m); err != nil {
|
||||
if err := encodeExtensionsMap(m); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
keys := make([]int, 0, len(m))
|
||||
@ -121,7 +140,7 @@ func GetRawExtension(m map[int32]Extension, id int32) ([]byte, error) {
|
||||
if m[id].value == nil || m[id].desc == nil {
|
||||
return m[id].enc, nil
|
||||
}
|
||||
if err := encodeExtensionMap(m); err != nil {
|
||||
if err := encodeExtensionsMap(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m[id].enc, nil
|
||||
@ -185,15 +204,42 @@ func NewExtension(e []byte) Extension {
|
||||
return ee
|
||||
}
|
||||
|
||||
func AppendExtension(e extendableProto, tag int32, buf []byte) {
|
||||
if ee, eok := e.(extensionsMap); eok {
|
||||
ext := ee.ExtensionMap()[int32(tag)] // may be missing
|
||||
ext.enc = append(ext.enc, buf...)
|
||||
ee.ExtensionMap()[int32(tag)] = ext
|
||||
} else if ee, eok := e.(extensionsBytes); eok {
|
||||
func AppendExtension(e Message, tag int32, buf []byte) {
|
||||
if ee, eok := e.(extensionsBytes); eok {
|
||||
ext := ee.GetExtensions()
|
||||
*ext = append(*ext, buf...)
|
||||
return
|
||||
}
|
||||
if ee, eok := e.(extendableProto); eok {
|
||||
m := ee.extensionsWrite()
|
||||
ext := m[int32(tag)] // may be missing
|
||||
ext.enc = append(ext.enc, buf...)
|
||||
m[int32(tag)] = ext
|
||||
}
|
||||
}
|
||||
|
||||
func encodeExtension(e *Extension) error {
|
||||
if e.value == nil || e.desc == nil {
|
||||
// Extension is only in its encoded form.
|
||||
return nil
|
||||
}
|
||||
// We don't skip extensions that have an encoded form set,
|
||||
// because the extension value may have been mutated after
|
||||
// the last time this function was called.
|
||||
|
||||
et := reflect.TypeOf(e.desc.ExtensionType)
|
||||
props := extensionProperties(e.desc)
|
||||
|
||||
p := NewBuffer(nil)
|
||||
// If e.value has type T, the encoder expects a *struct{ X T }.
|
||||
// Pass a *T with a zero field and hope it all works out.
|
||||
x := reflect.New(et)
|
||||
x.Elem().Set(reflect.ValueOf(e.value))
|
||||
if err := props.enc(p, props, toStructPointer(x)); err != nil {
|
||||
return err
|
||||
}
|
||||
e.enc = p.buf
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this Extension) GoString() string {
|
||||
@ -205,7 +251,7 @@ func (this Extension) GoString() string {
|
||||
return fmt.Sprintf("proto.NewExtension(%#v)", this.enc)
|
||||
}
|
||||
|
||||
func SetUnsafeExtension(pb extendableProto, fieldNum int32, value interface{}) error {
|
||||
func SetUnsafeExtension(pb Message, fieldNum int32, value interface{}) error {
|
||||
typ := reflect.TypeOf(pb).Elem()
|
||||
ext, ok := extensionMaps[typ]
|
||||
if !ok {
|
||||
@ -215,10 +261,10 @@ func SetUnsafeExtension(pb extendableProto, fieldNum int32, value interface{}) e
|
||||
if !ok {
|
||||
return errors.New("proto: bad extension number; not in declared ranges")
|
||||
}
|
||||
return setExtension(pb, desc, value)
|
||||
return SetExtension(pb, desc, value)
|
||||
}
|
||||
|
||||
func GetUnsafeExtension(pb extendableProto, fieldNum int32) (interface{}, error) {
|
||||
func GetUnsafeExtension(pb Message, fieldNum int32) (interface{}, error) {
|
||||
typ := reflect.TypeOf(pb).Elem()
|
||||
ext, ok := extensionMaps[typ]
|
||||
if !ok {
|
||||
@ -230,3 +276,19 @@ func GetUnsafeExtension(pb extendableProto, fieldNum int32) (interface{}, error)
|
||||
}
|
||||
return GetExtension(pb, desc)
|
||||
}
|
||||
|
||||
func NewUnsafeXXX_InternalExtensions(m map[int32]Extension) XXX_InternalExtensions {
|
||||
x := &XXX_InternalExtensions{
|
||||
p: new(struct {
|
||||
mu sync.Mutex
|
||||
extensionMap map[int32]Extension
|
||||
}),
|
||||
}
|
||||
x.p.extensionMap = m
|
||||
return *x
|
||||
}
|
||||
|
||||
func GetUnsafeExtensionsMap(extendable Message) map[int32]Extension {
|
||||
pb := extendable.(extendableProto)
|
||||
return pb.extensionsWrite()
|
||||
}
|
||||
|
||||
4
_vendor/vendor/github.com/gogo/protobuf/proto/lib.go
generated
vendored
4
_vendor/vendor/github.com/gogo/protobuf/proto/lib.go
generated
vendored
@ -889,6 +889,10 @@ func isProto3Zero(v reflect.Value) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// ProtoPackageIsVersion2 is referenced from generated protocol buffer files
|
||||
// to assert that that code is compatible with this version of the proto package.
|
||||
const GoGoProtoPackageIsVersion2 = true
|
||||
|
||||
// ProtoPackageIsVersion1 is referenced from generated protocol buffer files
|
||||
// to assert that that code is compatible with this version of the proto package.
|
||||
const GoGoProtoPackageIsVersion1 = true
|
||||
|
||||
6
_vendor/vendor/github.com/gogo/protobuf/proto/lib_gogo.go
generated
vendored
6
_vendor/vendor/github.com/gogo/protobuf/proto/lib_gogo.go
generated
vendored
@ -1,5 +1,7 @@
|
||||
// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
|
||||
// http://github.com/gogo/protobuf/gogoproto
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
||||
43
_vendor/vendor/github.com/gogo/protobuf/proto/message_set.go
generated
vendored
43
_vendor/vendor/github.com/gogo/protobuf/proto/message_set.go
generated
vendored
@ -149,9 +149,21 @@ func skipVarint(buf []byte) []byte {
|
||||
|
||||
// MarshalMessageSet encodes the extension map represented by m in the message set wire format.
|
||||
// It is called by generated Marshal methods on protocol buffer messages with the message_set_wire_format option.
|
||||
func MarshalMessageSet(m map[int32]Extension) ([]byte, error) {
|
||||
if err := encodeExtensionMap(m); err != nil {
|
||||
return nil, err
|
||||
func MarshalMessageSet(exts interface{}) ([]byte, error) {
|
||||
var m map[int32]Extension
|
||||
switch exts := exts.(type) {
|
||||
case *XXX_InternalExtensions:
|
||||
if err := encodeExtensions(exts); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m, _ = exts.extensionsRead()
|
||||
case map[int32]Extension:
|
||||
if err := encodeExtensionsMap(exts); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m = exts
|
||||
default:
|
||||
return nil, errors.New("proto: not an extension map")
|
||||
}
|
||||
|
||||
// Sort extension IDs to provide a deterministic encoding.
|
||||
@ -178,7 +190,17 @@ func MarshalMessageSet(m map[int32]Extension) ([]byte, error) {
|
||||
|
||||
// UnmarshalMessageSet decodes the extension map encoded in buf in the message set wire format.
|
||||
// It is called by generated Unmarshal methods on protocol buffer messages with the message_set_wire_format option.
|
||||
func UnmarshalMessageSet(buf []byte, m map[int32]Extension) error {
|
||||
func UnmarshalMessageSet(buf []byte, exts interface{}) error {
|
||||
var m map[int32]Extension
|
||||
switch exts := exts.(type) {
|
||||
case *XXX_InternalExtensions:
|
||||
m = exts.extensionsWrite()
|
||||
case map[int32]Extension:
|
||||
m = exts
|
||||
default:
|
||||
return errors.New("proto: not an extension map")
|
||||
}
|
||||
|
||||
ms := new(messageSet)
|
||||
if err := Unmarshal(buf, ms); err != nil {
|
||||
return err
|
||||
@ -209,7 +231,16 @@ func UnmarshalMessageSet(buf []byte, m map[int32]Extension) error {
|
||||
|
||||
// MarshalMessageSetJSON encodes the extension map represented by m in JSON format.
|
||||
// It is called by generated MarshalJSON methods on protocol buffer messages with the message_set_wire_format option.
|
||||
func MarshalMessageSetJSON(m map[int32]Extension) ([]byte, error) {
|
||||
func MarshalMessageSetJSON(exts interface{}) ([]byte, error) {
|
||||
var m map[int32]Extension
|
||||
switch exts := exts.(type) {
|
||||
case *XXX_InternalExtensions:
|
||||
m, _ = exts.extensionsRead()
|
||||
case map[int32]Extension:
|
||||
m = exts
|
||||
default:
|
||||
return nil, errors.New("proto: not an extension map")
|
||||
}
|
||||
var b bytes.Buffer
|
||||
b.WriteByte('{')
|
||||
|
||||
@ -252,7 +283,7 @@ func MarshalMessageSetJSON(m map[int32]Extension) ([]byte, error) {
|
||||
|
||||
// UnmarshalMessageSetJSON decodes the extension map encoded in buf in JSON format.
|
||||
// It is called by generated UnmarshalJSON methods on protocol buffer messages with the message_set_wire_format option.
|
||||
func UnmarshalMessageSetJSON(buf []byte, m map[int32]Extension) error {
|
||||
func UnmarshalMessageSetJSON(buf []byte, exts interface{}) error {
|
||||
// Common-case fast path.
|
||||
if len(buf) == 0 || bytes.Equal(buf, []byte("{}")) {
|
||||
return nil
|
||||
|
||||
7
_vendor/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go
generated
vendored
7
_vendor/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go
generated
vendored
@ -29,7 +29,7 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// +build appengine
|
||||
// +build appengine js
|
||||
|
||||
// This file contains an implementation of proto field accesses using package reflect.
|
||||
// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can
|
||||
@ -139,6 +139,11 @@ func structPointer_StringSlice(p structPointer, f field) *[]string {
|
||||
return structPointer_ifield(p, f).(*[]string)
|
||||
}
|
||||
|
||||
// Extensions returns the address of an extension map field in the struct.
|
||||
func structPointer_Extensions(p structPointer, f field) *XXX_InternalExtensions {
|
||||
return structPointer_ifield(p, f).(*XXX_InternalExtensions)
|
||||
}
|
||||
|
||||
// ExtMap returns the address of an extension map field in the struct.
|
||||
func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension {
|
||||
return structPointer_ifield(p, f).(*map[int32]Extension)
|
||||
|
||||
6
_vendor/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go
generated
vendored
6
_vendor/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go
generated
vendored
@ -29,7 +29,7 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// +build !appengine
|
||||
// +build !appengine,!js
|
||||
|
||||
// This file contains the implementation of the proto field accesses using package unsafe.
|
||||
|
||||
@ -126,6 +126,10 @@ func structPointer_StringSlice(p structPointer, f field) *[]string {
|
||||
}
|
||||
|
||||
// ExtMap returns the address of an extension map field in the struct.
|
||||
func structPointer_Extensions(p structPointer, f field) *XXX_InternalExtensions {
|
||||
return (*XXX_InternalExtensions)(unsafe.Pointer(uintptr(p) + uintptr(f)))
|
||||
}
|
||||
|
||||
func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension {
|
||||
return (*map[int32]Extension)(unsafe.Pointer(uintptr(p) + uintptr(f)))
|
||||
}
|
||||
|
||||
21
_vendor/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go
generated
vendored
21
_vendor/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go
generated
vendored
@ -1,5 +1,7 @@
|
||||
// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
|
||||
// http://github.com/gogo/protobuf/gogoproto
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
@ -70,16 +72,13 @@ func structPointer_Copy(oldptr structPointer, newptr structPointer, size int) {
|
||||
|
||||
func appendStructPointer(base structPointer, f field, typ reflect.Type) structPointer {
|
||||
size := typ.Elem().Size()
|
||||
oldHeader := structPointer_GetSliceHeader(base, f)
|
||||
newLen := oldHeader.Len + 1
|
||||
slice := reflect.MakeSlice(typ, newLen, newLen)
|
||||
bas := toStructPointer(slice)
|
||||
for i := 0; i < oldHeader.Len; i++ {
|
||||
newElemptr := uintptr(bas) + uintptr(i)*size
|
||||
oldElemptr := oldHeader.Data + uintptr(i)*size
|
||||
copyUintPtr(oldElemptr, newElemptr, int(size))
|
||||
}
|
||||
|
||||
oldHeader := structPointer_GetSliceHeader(base, f)
|
||||
oldSlice := reflect.NewAt(typ, unsafe.Pointer(oldHeader)).Elem()
|
||||
newLen := oldHeader.Len + 1
|
||||
newSlice := reflect.MakeSlice(typ, newLen, newLen)
|
||||
reflect.Copy(newSlice, oldSlice)
|
||||
bas := toStructPointer(newSlice)
|
||||
oldHeader.Data = uintptr(bas)
|
||||
oldHeader.Len = newLen
|
||||
oldHeader.Cap = newLen
|
||||
|
||||
53
_vendor/vendor/github.com/gogo/protobuf/proto/properties.go
generated
vendored
53
_vendor/vendor/github.com/gogo/protobuf/proto/properties.go
generated
vendored
@ -1,7 +1,7 @@
|
||||
// Extensions for Protocol Buffers to create more go like structures.
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
|
||||
// http://github.com/gogo/protobuf/gogoproto
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
@ -542,17 +542,13 @@ func (p *Properties) setEncAndDec(typ reflect.Type, f *reflect.StructField, lock
|
||||
p.dec = (*Buffer).dec_slice_int64
|
||||
p.packedDec = (*Buffer).dec_slice_packed_int64
|
||||
case reflect.Uint8:
|
||||
p.enc = (*Buffer).enc_slice_byte
|
||||
p.dec = (*Buffer).dec_slice_byte
|
||||
p.size = size_slice_byte
|
||||
// This is a []byte, which is either a bytes field,
|
||||
// or the value of a map field. In the latter case,
|
||||
// we always encode an empty []byte, so we should not
|
||||
// use the proto3 enc/size funcs.
|
||||
// f == nil iff this is the key/value of a map field.
|
||||
if p.proto3 && f != nil {
|
||||
if p.proto3 {
|
||||
p.enc = (*Buffer).enc_proto3_slice_byte
|
||||
p.size = size_proto3_slice_byte
|
||||
} else {
|
||||
p.enc = (*Buffer).enc_slice_byte
|
||||
p.size = size_slice_byte
|
||||
}
|
||||
case reflect.Float32, reflect.Float64:
|
||||
switch t2.Bits() {
|
||||
@ -744,7 +740,9 @@ func getPropertiesLocked(t reflect.Type) *StructProperties {
|
||||
propertiesMap[t] = prop
|
||||
|
||||
// build properties
|
||||
prop.extendable = reflect.PtrTo(t).Implements(extendableProtoType)
|
||||
prop.extendable = reflect.PtrTo(t).Implements(extendableProtoType) ||
|
||||
reflect.PtrTo(t).Implements(extendableProtoV1Type) ||
|
||||
reflect.PtrTo(t).Implements(extendableBytesType)
|
||||
prop.unrecField = invalidField
|
||||
prop.Prop = make([]*Properties, t.NumField())
|
||||
prop.order = make([]int, t.NumField())
|
||||
@ -756,7 +754,11 @@ func getPropertiesLocked(t reflect.Type) *StructProperties {
|
||||
name := f.Name
|
||||
p.init(f.Type, name, f.Tag.Get("protobuf"), &f, false)
|
||||
|
||||
if f.Name == "XXX_extensions" { // special case
|
||||
if f.Name == "XXX_InternalExtensions" { // special case
|
||||
p.enc = (*Buffer).enc_exts
|
||||
p.dec = nil // not needed
|
||||
p.size = size_exts
|
||||
} else if f.Name == "XXX_extensions" { // special case
|
||||
if len(f.Tag.Get("protobuf")) > 0 {
|
||||
p.enc = (*Buffer).enc_ext_slice_byte
|
||||
p.dec = nil // not needed
|
||||
@ -766,13 +768,14 @@ func getPropertiesLocked(t reflect.Type) *StructProperties {
|
||||
p.dec = nil // not needed
|
||||
p.size = size_map
|
||||
}
|
||||
}
|
||||
if f.Name == "XXX_unrecognized" { // special case
|
||||
} else if f.Name == "XXX_unrecognized" { // special case
|
||||
prop.unrecField = toField(&f)
|
||||
}
|
||||
oneof := f.Tag.Get("protobuf_oneof") != "" // special case
|
||||
if oneof {
|
||||
oneof := f.Tag.Get("protobuf_oneof") // special case
|
||||
if oneof != "" {
|
||||
isOneofMessage = true
|
||||
// Oneof fields don't use the traditional protobuf tag.
|
||||
p.OrigName = oneof
|
||||
}
|
||||
prop.Prop[i] = p
|
||||
prop.order[i] = i
|
||||
@ -783,7 +786,7 @@ func getPropertiesLocked(t reflect.Type) *StructProperties {
|
||||
}
|
||||
print("\n")
|
||||
}
|
||||
if p.enc == nil && !strings.HasPrefix(f.Name, "XXX_") && !oneof {
|
||||
if p.enc == nil && !strings.HasPrefix(f.Name, "XXX_") && oneof == "" {
|
||||
fmt.Fprintln(os.Stderr, "proto: no encoder for", f.Name, f.Type.String(), "[GetProperties]")
|
||||
}
|
||||
}
|
||||
@ -921,3 +924,17 @@ func MessageName(x Message) string { return revProtoTypes[reflect.TypeOf(x)] }
|
||||
|
||||
// MessageType returns the message type (pointer to struct) for a named message.
|
||||
func MessageType(name string) reflect.Type { return protoTypes[name] }
|
||||
|
||||
// A registry of all linked proto files.
|
||||
var (
|
||||
protoFiles = make(map[string][]byte) // file name => fileDescriptor
|
||||
)
|
||||
|
||||
// RegisterFile is called from generated code and maps from the
|
||||
// full file name of a .proto file to its compressed FileDescriptorProto.
|
||||
func RegisterFile(filename string, fileDescriptor []byte) {
|
||||
protoFiles[filename] = fileDescriptor
|
||||
}
|
||||
|
||||
// FileDescriptor returns the compressed FileDescriptorProto for a .proto file.
|
||||
func FileDescriptor(filename string) []byte { return protoFiles[filename] }
|
||||
|
||||
6
_vendor/vendor/github.com/gogo/protobuf/proto/properties_gogo.go
generated
vendored
6
_vendor/vendor/github.com/gogo/protobuf/proto/properties_gogo.go
generated
vendored
@ -1,5 +1,7 @@
|
||||
// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
|
||||
// http://github.com/gogo/protobuf/gogoproto
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
||||
6
_vendor/vendor/github.com/gogo/protobuf/proto/skip_gogo.go
generated
vendored
6
_vendor/vendor/github.com/gogo/protobuf/proto/skip_gogo.go
generated
vendored
@ -1,5 +1,7 @@
|
||||
// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
|
||||
// http://github.com/gogo/protobuf/gogoproto
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
||||
82
_vendor/vendor/github.com/gogo/protobuf/proto/text.go
generated
vendored
82
_vendor/vendor/github.com/gogo/protobuf/proto/text.go
generated
vendored
@ -1,7 +1,7 @@
|
||||
// Extensions for Protocol Buffers to create more go like structures.
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
|
||||
// http://github.com/gogo/protobuf/gogoproto
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
@ -50,6 +50,7 @@ import (
|
||||
"reflect"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -159,7 +160,7 @@ func (w *textWriter) indent() { w.ind++ }
|
||||
|
||||
func (w *textWriter) unindent() {
|
||||
if w.ind == 0 {
|
||||
log.Printf("proto: textWriter unindented too far")
|
||||
log.Print("proto: textWriter unindented too far")
|
||||
return
|
||||
}
|
||||
w.ind--
|
||||
@ -335,7 +336,8 @@ func writeStruct(w *textWriter, sv reflect.Value) error {
|
||||
}
|
||||
inner := fv.Elem().Elem() // interface -> *T -> T
|
||||
tag := inner.Type().Field(0).Tag.Get("protobuf")
|
||||
props.Parse(tag) // Overwrite the outer props.
|
||||
props = new(Properties) // Overwrite the outer props var, but not its pointee.
|
||||
props.Parse(tag)
|
||||
// Write the value in the oneof, not the oneof itself.
|
||||
fv = inner.Field(0)
|
||||
|
||||
@ -386,7 +388,7 @@ func writeStruct(w *textWriter, sv reflect.Value) error {
|
||||
pv = reflect.New(sv.Type())
|
||||
pv.Elem().Set(sv)
|
||||
}
|
||||
if pv.Type().Implements(extendableProtoType) {
|
||||
if pv.Type().Implements(extensionRangeType) {
|
||||
if err := writeExtensions(w, pv); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -634,28 +636,37 @@ func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||
// pv is assumed to be a pointer to a protocol message struct that is extendable.
|
||||
func writeExtensions(w *textWriter, pv reflect.Value) error {
|
||||
emap := extensionMaps[pv.Type().Elem()]
|
||||
ep := pv.Interface().(extendableProto)
|
||||
e := pv.Interface().(Message)
|
||||
|
||||
// Order the extensions by ID.
|
||||
// This isn't strictly necessary, but it will give us
|
||||
// canonical output, which will also make testing easier.
|
||||
var m map[int32]Extension
|
||||
if em, ok := ep.(extensionsMap); ok {
|
||||
m = em.ExtensionMap()
|
||||
} else if em, ok := ep.(extensionsBytes); ok {
|
||||
var mu sync.Locker
|
||||
if em, ok := e.(extensionsBytes); ok {
|
||||
eb := em.GetExtensions()
|
||||
var err error
|
||||
m, err = BytesToExtensionsMap(*eb)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
mu = notLocker{}
|
||||
} else if _, ok := e.(extendableProto); ok {
|
||||
ep, _ := extendable(e)
|
||||
m, mu = ep.extensionsRead()
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// Order the extensions by ID.
|
||||
// This isn't strictly necessary, but it will give us
|
||||
// canonical output, which will also make testing easier.
|
||||
|
||||
mu.Lock()
|
||||
ids := make([]int32, 0, len(m))
|
||||
for id := range m {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
sort.Sort(int32Slice(ids))
|
||||
mu.Unlock()
|
||||
|
||||
for _, extNum := range ids {
|
||||
ext := m[extNum]
|
||||
@ -671,7 +682,7 @@ func writeExtensions(w *textWriter, pv reflect.Value) error {
|
||||
continue
|
||||
}
|
||||
|
||||
pb, err := GetExtension(ep, desc)
|
||||
pb, err := GetExtension(e, desc)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed getting extension: %v", err)
|
||||
}
|
||||
@ -727,7 +738,14 @@ func (w *textWriter) writeIndent() {
|
||||
w.complete = false
|
||||
}
|
||||
|
||||
func marshalText(w io.Writer, pb Message, compact bool) error {
|
||||
// TextMarshaler is a configurable text format marshaler.
|
||||
type TextMarshaler struct {
|
||||
Compact bool // use compact text format (one line).
|
||||
}
|
||||
|
||||
// Marshal writes a given protocol buffer in text format.
|
||||
// The only errors returned are from w.
|
||||
func (m *TextMarshaler) Marshal(w io.Writer, pb Message) error {
|
||||
val := reflect.ValueOf(pb)
|
||||
if pb == nil || val.IsNil() {
|
||||
w.Write([]byte("<nil>"))
|
||||
@ -742,7 +760,7 @@ func marshalText(w io.Writer, pb Message, compact bool) error {
|
||||
aw := &textWriter{
|
||||
w: ww,
|
||||
complete: true,
|
||||
compact: compact,
|
||||
compact: m.Compact,
|
||||
}
|
||||
|
||||
if tm, ok := pb.(encoding.TextMarshaler); ok {
|
||||
@ -769,25 +787,29 @@ func marshalText(w io.Writer, pb Message, compact bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Text is the same as Marshal, but returns the string directly.
|
||||
func (m *TextMarshaler) Text(pb Message) string {
|
||||
var buf bytes.Buffer
|
||||
m.Marshal(&buf, pb)
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
var (
|
||||
defaultTextMarshaler = TextMarshaler{}
|
||||
compactTextMarshaler = TextMarshaler{Compact: true}
|
||||
)
|
||||
|
||||
// TODO: consider removing some of the Marshal functions below.
|
||||
|
||||
// MarshalText writes a given protocol buffer in text format.
|
||||
// The only errors returned are from w.
|
||||
func MarshalText(w io.Writer, pb Message) error {
|
||||
return marshalText(w, pb, false)
|
||||
}
|
||||
func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) }
|
||||
|
||||
// MarshalTextString is the same as MarshalText, but returns the string directly.
|
||||
func MarshalTextString(pb Message) string {
|
||||
var buf bytes.Buffer
|
||||
marshalText(&buf, pb, false)
|
||||
return buf.String()
|
||||
}
|
||||
func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) }
|
||||
|
||||
// CompactText writes a given protocol buffer in compact text format (one line).
|
||||
func CompactText(w io.Writer, pb Message) error { return marshalText(w, pb, true) }
|
||||
func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) }
|
||||
|
||||
// CompactTextString is the same as CompactText, but returns the string directly.
|
||||
func CompactTextString(pb Message) string {
|
||||
var buf bytes.Buffer
|
||||
marshalText(&buf, pb, true)
|
||||
return buf.String()
|
||||
}
|
||||
func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) }
|
||||
|
||||
6
_vendor/vendor/github.com/gogo/protobuf/proto/text_gogo.go
generated
vendored
6
_vendor/vendor/github.com/gogo/protobuf/proto/text_gogo.go
generated
vendored
@ -1,5 +1,7 @@
|
||||
// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
|
||||
// http://github.com/gogo/protobuf/gogoproto
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
|
||||
75
_vendor/vendor/github.com/gogo/protobuf/proto/text_parser.go
generated
vendored
75
_vendor/vendor/github.com/gogo/protobuf/proto/text_parser.go
generated
vendored
@ -1,7 +1,7 @@
|
||||
// Extensions for Protocol Buffers to create more go like structures.
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
|
||||
// http://github.com/gogo/protobuf/gogoproto
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
@ -519,7 +519,7 @@ func (p *textParser) readStruct(sv reflect.Value, terminator string) error {
|
||||
}
|
||||
reqFieldErr = err
|
||||
}
|
||||
ep := sv.Addr().Interface().(extendableProto)
|
||||
ep := sv.Addr().Interface().(Message)
|
||||
if !rep {
|
||||
SetExtension(ep, desc, ext.Interface())
|
||||
} else {
|
||||
@ -571,8 +571,9 @@ func (p *textParser) readStruct(sv reflect.Value, terminator string) error {
|
||||
|
||||
// The map entry should be this sequence of tokens:
|
||||
// < key : KEY value : VALUE >
|
||||
// Technically the "key" and "value" could come in any order,
|
||||
// but in practice they won't.
|
||||
// However, implementations may omit key or value, and technically
|
||||
// we should support them in any order. See b/28924776 for a time
|
||||
// this went wrong.
|
||||
|
||||
tok := p.next()
|
||||
var terminator string
|
||||
@ -584,32 +585,39 @@ func (p *textParser) readStruct(sv reflect.Value, terminator string) error {
|
||||
default:
|
||||
return p.errorf("expected '{' or '<', found %q", tok.value)
|
||||
}
|
||||
if err := p.consumeToken("key"); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.consumeToken(":"); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.readAny(key, props.mkeyprop); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.consumeOptionalSeparator(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.consumeToken("value"); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.checkForColon(props.mvalprop, dst.Type().Elem()); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.readAny(val, props.mvalprop); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.consumeOptionalSeparator(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.consumeToken(terminator); err != nil {
|
||||
return err
|
||||
for {
|
||||
tok := p.next()
|
||||
if tok.err != nil {
|
||||
return tok.err
|
||||
}
|
||||
if tok.value == terminator {
|
||||
break
|
||||
}
|
||||
switch tok.value {
|
||||
case "key":
|
||||
if err := p.consumeToken(":"); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.readAny(key, props.mkeyprop); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.consumeOptionalSeparator(); err != nil {
|
||||
return err
|
||||
}
|
||||
case "value":
|
||||
if err := p.checkForColon(props.mvalprop, dst.Type().Elem()); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.readAny(val, props.mvalprop); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.consumeOptionalSeparator(); err != nil {
|
||||
return err
|
||||
}
|
||||
default:
|
||||
p.back()
|
||||
return p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value)
|
||||
}
|
||||
}
|
||||
|
||||
dst.SetMapIndex(key, val)
|
||||
@ -632,7 +640,8 @@ func (p *textParser) readStruct(sv reflect.Value, terminator string) error {
|
||||
return err
|
||||
}
|
||||
reqFieldErr = err
|
||||
} else if props.Required {
|
||||
}
|
||||
if props.Required {
|
||||
reqCount--
|
||||
}
|
||||
|
||||
|
||||
11
_vendor/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go
generated
vendored
11
_vendor/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go
generated
vendored
@ -812,10 +812,21 @@ func (w *errWriter) write(str string) {
|
||||
// The easiest way to sort them in some deterministic order is to use fmt.
|
||||
// If this turns out to be inefficient we can always consider other options,
|
||||
// such as doing a Schwartzian transform.
|
||||
//
|
||||
// Numeric keys are sorted in numeric order per
|
||||
// https://developers.google.com/protocol-buffers/docs/proto#maps.
|
||||
type mapKeys []reflect.Value
|
||||
|
||||
func (s mapKeys) Len() int { return len(s) }
|
||||
func (s mapKeys) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||
func (s mapKeys) Less(i, j int) bool {
|
||||
if k := s[i].Kind(); k == s[j].Kind() {
|
||||
switch k {
|
||||
case reflect.Int32, reflect.Int64:
|
||||
return s[i].Int() < s[j].Int()
|
||||
case reflect.Uint32, reflect.Uint64:
|
||||
return s[i].Uint() < s[j].Uint()
|
||||
}
|
||||
}
|
||||
return fmt.Sprint(s[i].Interface()) < fmt.Sprint(s[j].Interface())
|
||||
}
|
||||
|
||||
553
_vendor/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test.go
generated
vendored
553
_vendor/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test.go
generated
vendored
@ -1,553 +0,0 @@
|
||||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package jsonpb
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
|
||||
pb "github.com/golang/protobuf/jsonpb/jsonpb_test_proto"
|
||||
proto3pb "github.com/golang/protobuf/proto/proto3_proto"
|
||||
anypb "github.com/golang/protobuf/ptypes/any"
|
||||
durpb "github.com/golang/protobuf/ptypes/duration"
|
||||
stpb "github.com/golang/protobuf/ptypes/struct"
|
||||
tspb "github.com/golang/protobuf/ptypes/timestamp"
|
||||
wpb "github.com/golang/protobuf/ptypes/wrappers"
|
||||
)
|
||||
|
||||
var (
|
||||
marshaler = Marshaler{}
|
||||
|
||||
marshalerAllOptions = Marshaler{
|
||||
Indent: " ",
|
||||
}
|
||||
|
||||
simpleObject = &pb.Simple{
|
||||
OInt32: proto.Int32(-32),
|
||||
OInt64: proto.Int64(-6400000000),
|
||||
OUint32: proto.Uint32(32),
|
||||
OUint64: proto.Uint64(6400000000),
|
||||
OSint32: proto.Int32(-13),
|
||||
OSint64: proto.Int64(-2600000000),
|
||||
OFloat: proto.Float32(3.14),
|
||||
ODouble: proto.Float64(6.02214179e23),
|
||||
OBool: proto.Bool(true),
|
||||
OString: proto.String("hello \"there\""),
|
||||
OBytes: []byte("beep boop"),
|
||||
}
|
||||
|
||||
simpleObjectJSON = `{` +
|
||||
`"oBool":true,` +
|
||||
`"oInt32":-32,` +
|
||||
`"oInt64":"-6400000000",` +
|
||||
`"oUint32":32,` +
|
||||
`"oUint64":"6400000000",` +
|
||||
`"oSint32":-13,` +
|
||||
`"oSint64":"-2600000000",` +
|
||||
`"oFloat":3.14,` +
|
||||
`"oDouble":6.02214179e+23,` +
|
||||
`"oString":"hello \"there\"",` +
|
||||
`"oBytes":"YmVlcCBib29w"` +
|
||||
`}`
|
||||
|
||||
simpleObjectPrettyJSON = `{
|
||||
"oBool": true,
|
||||
"oInt32": -32,
|
||||
"oInt64": "-6400000000",
|
||||
"oUint32": 32,
|
||||
"oUint64": "6400000000",
|
||||
"oSint32": -13,
|
||||
"oSint64": "-2600000000",
|
||||
"oFloat": 3.14,
|
||||
"oDouble": 6.02214179e+23,
|
||||
"oString": "hello \"there\"",
|
||||
"oBytes": "YmVlcCBib29w"
|
||||
}`
|
||||
|
||||
repeatsObject = &pb.Repeats{
|
||||
RBool: []bool{true, false, true},
|
||||
RInt32: []int32{-3, -4, -5},
|
||||
RInt64: []int64{-123456789, -987654321},
|
||||
RUint32: []uint32{1, 2, 3},
|
||||
RUint64: []uint64{6789012345, 3456789012},
|
||||
RSint32: []int32{-1, -2, -3},
|
||||
RSint64: []int64{-6789012345, -3456789012},
|
||||
RFloat: []float32{3.14, 6.28},
|
||||
RDouble: []float64{299792458, 6.62606957e-34},
|
||||
RString: []string{"happy", "days"},
|
||||
RBytes: [][]byte{[]byte("skittles"), []byte("m&m's")},
|
||||
}
|
||||
|
||||
repeatsObjectJSON = `{` +
|
||||
`"rBool":[true,false,true],` +
|
||||
`"rInt32":[-3,-4,-5],` +
|
||||
`"rInt64":["-123456789","-987654321"],` +
|
||||
`"rUint32":[1,2,3],` +
|
||||
`"rUint64":["6789012345","3456789012"],` +
|
||||
`"rSint32":[-1,-2,-3],` +
|
||||
`"rSint64":["-6789012345","-3456789012"],` +
|
||||
`"rFloat":[3.14,6.28],` +
|
||||
`"rDouble":[2.99792458e+08,6.62606957e-34],` +
|
||||
`"rString":["happy","days"],` +
|
||||
`"rBytes":["c2tpdHRsZXM=","bSZtJ3M="]` +
|
||||
`}`
|
||||
|
||||
repeatsObjectPrettyJSON = `{
|
||||
"rBool": [
|
||||
true,
|
||||
false,
|
||||
true
|
||||
],
|
||||
"rInt32": [
|
||||
-3,
|
||||
-4,
|
||||
-5
|
||||
],
|
||||
"rInt64": [
|
||||
"-123456789",
|
||||
"-987654321"
|
||||
],
|
||||
"rUint32": [
|
||||
1,
|
||||
2,
|
||||
3
|
||||
],
|
||||
"rUint64": [
|
||||
"6789012345",
|
||||
"3456789012"
|
||||
],
|
||||
"rSint32": [
|
||||
-1,
|
||||
-2,
|
||||
-3
|
||||
],
|
||||
"rSint64": [
|
||||
"-6789012345",
|
||||
"-3456789012"
|
||||
],
|
||||
"rFloat": [
|
||||
3.14,
|
||||
6.28
|
||||
],
|
||||
"rDouble": [
|
||||
2.99792458e+08,
|
||||
6.62606957e-34
|
||||
],
|
||||
"rString": [
|
||||
"happy",
|
||||
"days"
|
||||
],
|
||||
"rBytes": [
|
||||
"c2tpdHRsZXM=",
|
||||
"bSZtJ3M="
|
||||
]
|
||||
}`
|
||||
|
||||
innerSimple = &pb.Simple{OInt32: proto.Int32(-32)}
|
||||
innerSimple2 = &pb.Simple{OInt64: proto.Int64(25)}
|
||||
innerRepeats = &pb.Repeats{RString: []string{"roses", "red"}}
|
||||
innerRepeats2 = &pb.Repeats{RString: []string{"violets", "blue"}}
|
||||
complexObject = &pb.Widget{
|
||||
Color: pb.Widget_GREEN.Enum(),
|
||||
RColor: []pb.Widget_Color{pb.Widget_RED, pb.Widget_GREEN, pb.Widget_BLUE},
|
||||
Simple: innerSimple,
|
||||
RSimple: []*pb.Simple{innerSimple, innerSimple2},
|
||||
Repeats: innerRepeats,
|
||||
RRepeats: []*pb.Repeats{innerRepeats, innerRepeats2},
|
||||
}
|
||||
|
||||
complexObjectJSON = `{"color":"GREEN",` +
|
||||
`"rColor":["RED","GREEN","BLUE"],` +
|
||||
`"simple":{"oInt32":-32},` +
|
||||
`"rSimple":[{"oInt32":-32},{"oInt64":"25"}],` +
|
||||
`"repeats":{"rString":["roses","red"]},` +
|
||||
`"rRepeats":[{"rString":["roses","red"]},{"rString":["violets","blue"]}]` +
|
||||
`}`
|
||||
|
||||
complexObjectPrettyJSON = `{
|
||||
"color": "GREEN",
|
||||
"rColor": [
|
||||
"RED",
|
||||
"GREEN",
|
||||
"BLUE"
|
||||
],
|
||||
"simple": {
|
||||
"oInt32": -32
|
||||
},
|
||||
"rSimple": [
|
||||
{
|
||||
"oInt32": -32
|
||||
},
|
||||
{
|
||||
"oInt64": "25"
|
||||
}
|
||||
],
|
||||
"repeats": {
|
||||
"rString": [
|
||||
"roses",
|
||||
"red"
|
||||
]
|
||||
},
|
||||
"rRepeats": [
|
||||
{
|
||||
"rString": [
|
||||
"roses",
|
||||
"red"
|
||||
]
|
||||
},
|
||||
{
|
||||
"rString": [
|
||||
"violets",
|
||||
"blue"
|
||||
]
|
||||
}
|
||||
]
|
||||
}`
|
||||
|
||||
colorPrettyJSON = `{
|
||||
"color": 2
|
||||
}`
|
||||
|
||||
colorListPrettyJSON = `{
|
||||
"color": 1000,
|
||||
"rColor": [
|
||||
"RED"
|
||||
]
|
||||
}`
|
||||
|
||||
nummyPrettyJSON = `{
|
||||
"nummy": {
|
||||
"1": 2,
|
||||
"3": 4
|
||||
}
|
||||
}`
|
||||
|
||||
objjyPrettyJSON = `{
|
||||
"objjy": {
|
||||
"1": {
|
||||
"dub": 1
|
||||
}
|
||||
}
|
||||
}`
|
||||
realNumber = &pb.Real{Value: proto.Float64(3.14159265359)}
|
||||
realNumberName = "Pi"
|
||||
complexNumber = &pb.Complex{Imaginary: proto.Float64(0.5772156649)}
|
||||
realNumberJSON = `{` +
|
||||
`"value":3.14159265359,` +
|
||||
`"[jsonpb.Complex.real_extension]":{"imaginary":0.5772156649},` +
|
||||
`"[jsonpb.name]":"Pi"` +
|
||||
`}`
|
||||
|
||||
anySimple = &pb.KnownTypes{
|
||||
An: &anypb.Any{
|
||||
TypeUrl: "something.example.com/jsonpb.Simple",
|
||||
Value: []byte{
|
||||
// &pb.Simple{OBool:true}
|
||||
1 << 3, 1,
|
||||
},
|
||||
},
|
||||
}
|
||||
anySimpleJSON = `{"an":{"@type":"something.example.com/jsonpb.Simple","oBool":true}}`
|
||||
anySimplePrettyJSON = `{
|
||||
"an": {
|
||||
"@type": "something.example.com/jsonpb.Simple",
|
||||
"oBool": true
|
||||
}
|
||||
}`
|
||||
|
||||
anyWellKnown = &pb.KnownTypes{
|
||||
An: &anypb.Any{
|
||||
TypeUrl: "type.googleapis.com/google.protobuf.Duration",
|
||||
Value: []byte{
|
||||
// &durpb.Duration{Seconds: 1, Nanos: 212000000 }
|
||||
1 << 3, 1, // seconds
|
||||
2 << 3, 0x80, 0xba, 0x8b, 0x65, // nanos
|
||||
},
|
||||
},
|
||||
}
|
||||
anyWellKnownJSON = `{"an":{"@type":"type.googleapis.com/google.protobuf.Duration","value":"1.212s"}}`
|
||||
anyWellKnownPrettyJSON = `{
|
||||
"an": {
|
||||
"@type": "type.googleapis.com/google.protobuf.Duration",
|
||||
"value": "1.212s"
|
||||
}
|
||||
}`
|
||||
)
|
||||
|
||||
func init() {
|
||||
if err := proto.SetExtension(realNumber, pb.E_Name, &realNumberName); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err := proto.SetExtension(realNumber, pb.E_Complex_RealExtension, complexNumber); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
var marshalingTests = []struct {
|
||||
desc string
|
||||
marshaler Marshaler
|
||||
pb proto.Message
|
||||
json string
|
||||
}{
|
||||
{"simple flat object", marshaler, simpleObject, simpleObjectJSON},
|
||||
{"simple pretty object", marshalerAllOptions, simpleObject, simpleObjectPrettyJSON},
|
||||
{"repeated fields flat object", marshaler, repeatsObject, repeatsObjectJSON},
|
||||
{"repeated fields pretty object", marshalerAllOptions, repeatsObject, repeatsObjectPrettyJSON},
|
||||
{"nested message/enum flat object", marshaler, complexObject, complexObjectJSON},
|
||||
{"nested message/enum pretty object", marshalerAllOptions, complexObject, complexObjectPrettyJSON},
|
||||
{"enum-string flat object", Marshaler{},
|
||||
&pb.Widget{Color: pb.Widget_BLUE.Enum()}, `{"color":"BLUE"}`},
|
||||
{"enum-value pretty object", Marshaler{EnumsAsInts: true, Indent: " "},
|
||||
&pb.Widget{Color: pb.Widget_BLUE.Enum()}, colorPrettyJSON},
|
||||
{"unknown enum value object", marshalerAllOptions,
|
||||
&pb.Widget{Color: pb.Widget_Color(1000).Enum(), RColor: []pb.Widget_Color{pb.Widget_RED}}, colorListPrettyJSON},
|
||||
{"repeated proto3 enum", Marshaler{},
|
||||
&proto3pb.Message{RFunny: []proto3pb.Message_Humour{
|
||||
proto3pb.Message_PUNS,
|
||||
proto3pb.Message_SLAPSTICK,
|
||||
}},
|
||||
`{"rFunny":["PUNS","SLAPSTICK"]}`},
|
||||
{"repeated proto3 enum as int", Marshaler{EnumsAsInts: true},
|
||||
&proto3pb.Message{RFunny: []proto3pb.Message_Humour{
|
||||
proto3pb.Message_PUNS,
|
||||
proto3pb.Message_SLAPSTICK,
|
||||
}},
|
||||
`{"rFunny":[1,2]}`},
|
||||
{"empty value", marshaler, &pb.Simple3{}, `{}`},
|
||||
{"empty value emitted", Marshaler{EmitDefaults: true}, &pb.Simple3{}, `{"dub":0}`},
|
||||
{"map<int64, int32>", marshaler, &pb.Mappy{Nummy: map[int64]int32{1: 2, 3: 4}}, `{"nummy":{"1":2,"3":4}}`},
|
||||
{"map<int64, int32>", marshalerAllOptions, &pb.Mappy{Nummy: map[int64]int32{1: 2, 3: 4}}, nummyPrettyJSON},
|
||||
{"map<string, string>", marshaler,
|
||||
&pb.Mappy{Strry: map[string]string{`"one"`: "two", "three": "four"}},
|
||||
`{"strry":{"\"one\"":"two","three":"four"}}`},
|
||||
{"map<int32, Object>", marshaler,
|
||||
&pb.Mappy{Objjy: map[int32]*pb.Simple3{1: &pb.Simple3{Dub: 1}}}, `{"objjy":{"1":{"dub":1}}}`},
|
||||
{"map<int32, Object>", marshalerAllOptions,
|
||||
&pb.Mappy{Objjy: map[int32]*pb.Simple3{1: &pb.Simple3{Dub: 1}}}, objjyPrettyJSON},
|
||||
{"map<int64, string>", marshaler, &pb.Mappy{Buggy: map[int64]string{1234: "yup"}},
|
||||
`{"buggy":{"1234":"yup"}}`},
|
||||
{"map<bool, bool>", marshaler, &pb.Mappy{Booly: map[bool]bool{false: true}}, `{"booly":{"false":true}}`},
|
||||
// TODO: This is broken.
|
||||
//{"map<string, enum>", marshaler, &pb.Mappy{Enumy: map[string]pb.Numeral{"XIV": pb.Numeral_ROMAN}}, `{"enumy":{"XIV":"ROMAN"}`},
|
||||
{"map<string, enum as int>", Marshaler{EnumsAsInts: true}, &pb.Mappy{Enumy: map[string]pb.Numeral{"XIV": pb.Numeral_ROMAN}}, `{"enumy":{"XIV":2}}`},
|
||||
{"proto2 map<int64, string>", marshaler, &pb.Maps{MInt64Str: map[int64]string{213: "cat"}},
|
||||
`{"mInt64Str":{"213":"cat"}}`},
|
||||
{"proto2 map<bool, Object>", marshaler,
|
||||
&pb.Maps{MBoolSimple: map[bool]*pb.Simple{true: &pb.Simple{OInt32: proto.Int32(1)}}},
|
||||
`{"mBoolSimple":{"true":{"oInt32":1}}}`},
|
||||
{"oneof, not set", marshaler, &pb.MsgWithOneof{}, `{}`},
|
||||
{"oneof, set", marshaler, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Title{"Grand Poobah"}}, `{"title":"Grand Poobah"}`},
|
||||
{"force orig_name", Marshaler{OrigName: true}, &pb.Simple{OInt32: proto.Int32(4)},
|
||||
`{"o_int32":4}`},
|
||||
{"proto2 extension", marshaler, realNumber, realNumberJSON},
|
||||
{"Any with message", marshaler, anySimple, anySimpleJSON},
|
||||
{"Any with message and indent", marshalerAllOptions, anySimple, anySimplePrettyJSON},
|
||||
{"Any with WKT", marshaler, anyWellKnown, anyWellKnownJSON},
|
||||
{"Any with WKT and indent", marshalerAllOptions, anyWellKnown, anyWellKnownPrettyJSON},
|
||||
{"Duration", marshaler, &pb.KnownTypes{Dur: &durpb.Duration{Seconds: 3}}, `{"dur":"3.000s"}`},
|
||||
{"Struct", marshaler, &pb.KnownTypes{St: &stpb.Struct{
|
||||
Fields: map[string]*stpb.Value{
|
||||
"one": &stpb.Value{Kind: &stpb.Value_StringValue{"loneliest number"}},
|
||||
"two": &stpb.Value{Kind: &stpb.Value_NullValue{stpb.NullValue_NULL_VALUE}},
|
||||
},
|
||||
}}, `{"st":{"one":"loneliest number","two":null}}`},
|
||||
{"Timestamp", marshaler, &pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 21e6}}, `{"ts":"2014-05-13T16:53:20.021Z"}`},
|
||||
|
||||
{"DoubleValue", marshaler, &pb.KnownTypes{Dbl: &wpb.DoubleValue{Value: 1.2}}, `{"dbl":1.2}`},
|
||||
{"FloatValue", marshaler, &pb.KnownTypes{Flt: &wpb.FloatValue{Value: 1.2}}, `{"flt":1.2}`},
|
||||
{"Int64Value", marshaler, &pb.KnownTypes{I64: &wpb.Int64Value{Value: -3}}, `{"i64":"-3"}`},
|
||||
{"UInt64Value", marshaler, &pb.KnownTypes{U64: &wpb.UInt64Value{Value: 3}}, `{"u64":"3"}`},
|
||||
{"Int32Value", marshaler, &pb.KnownTypes{I32: &wpb.Int32Value{Value: -4}}, `{"i32":-4}`},
|
||||
{"UInt32Value", marshaler, &pb.KnownTypes{U32: &wpb.UInt32Value{Value: 4}}, `{"u32":4}`},
|
||||
{"BoolValue", marshaler, &pb.KnownTypes{Bool: &wpb.BoolValue{Value: true}}, `{"bool":true}`},
|
||||
{"StringValue", marshaler, &pb.KnownTypes{Str: &wpb.StringValue{Value: "plush"}}, `{"str":"plush"}`},
|
||||
{"BytesValue", marshaler, &pb.KnownTypes{Bytes: &wpb.BytesValue{Value: []byte("wow")}}, `{"bytes":"d293"}`},
|
||||
}
|
||||
|
||||
func TestMarshaling(t *testing.T) {
|
||||
for _, tt := range marshalingTests {
|
||||
json, err := tt.marshaler.MarshalToString(tt.pb)
|
||||
if err != nil {
|
||||
t.Errorf("%s: marshaling error: %v", tt.desc, err)
|
||||
} else if tt.json != json {
|
||||
t.Errorf("%s: got [%v] want [%v]", tt.desc, json, tt.json)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var unmarshalingTests = []struct {
|
||||
desc string
|
||||
unmarshaler Unmarshaler
|
||||
json string
|
||||
pb proto.Message
|
||||
}{
|
||||
{"simple flat object", Unmarshaler{}, simpleObjectJSON, simpleObject},
|
||||
{"simple pretty object", Unmarshaler{}, simpleObjectPrettyJSON, simpleObject},
|
||||
{"repeated fields flat object", Unmarshaler{}, repeatsObjectJSON, repeatsObject},
|
||||
{"repeated fields pretty object", Unmarshaler{}, repeatsObjectPrettyJSON, repeatsObject},
|
||||
{"nested message/enum flat object", Unmarshaler{}, complexObjectJSON, complexObject},
|
||||
{"nested message/enum pretty object", Unmarshaler{}, complexObjectPrettyJSON, complexObject},
|
||||
{"enum-string object", Unmarshaler{}, `{"color":"BLUE"}`, &pb.Widget{Color: pb.Widget_BLUE.Enum()}},
|
||||
{"enum-value object", Unmarshaler{}, "{\n \"color\": 2\n}", &pb.Widget{Color: pb.Widget_BLUE.Enum()}},
|
||||
{"unknown field with allowed option", Unmarshaler{AllowUnknownFields: true}, `{"unknown": "foo"}`, new(pb.Simple)},
|
||||
{"proto3 enum string", Unmarshaler{}, `{"hilarity":"PUNS"}`, &proto3pb.Message{Hilarity: proto3pb.Message_PUNS}},
|
||||
{"proto3 enum value", Unmarshaler{}, `{"hilarity":1}`, &proto3pb.Message{Hilarity: proto3pb.Message_PUNS}},
|
||||
{"unknown enum value object",
|
||||
Unmarshaler{},
|
||||
"{\n \"color\": 1000,\n \"r_color\": [\n \"RED\"\n ]\n}",
|
||||
&pb.Widget{Color: pb.Widget_Color(1000).Enum(), RColor: []pb.Widget_Color{pb.Widget_RED}}},
|
||||
{"repeated proto3 enum", Unmarshaler{}, `{"rFunny":["PUNS","SLAPSTICK"]}`,
|
||||
&proto3pb.Message{RFunny: []proto3pb.Message_Humour{
|
||||
proto3pb.Message_PUNS,
|
||||
proto3pb.Message_SLAPSTICK,
|
||||
}}},
|
||||
{"repeated proto3 enum as int", Unmarshaler{}, `{"rFunny":[1,2]}`,
|
||||
&proto3pb.Message{RFunny: []proto3pb.Message_Humour{
|
||||
proto3pb.Message_PUNS,
|
||||
proto3pb.Message_SLAPSTICK,
|
||||
}}},
|
||||
{"repeated proto3 enum as mix of strings and ints", Unmarshaler{}, `{"rFunny":["PUNS",2]}`,
|
||||
&proto3pb.Message{RFunny: []proto3pb.Message_Humour{
|
||||
proto3pb.Message_PUNS,
|
||||
proto3pb.Message_SLAPSTICK,
|
||||
}}},
|
||||
{"unquoted int64 object", Unmarshaler{}, `{"oInt64":-314}`, &pb.Simple{OInt64: proto.Int64(-314)}},
|
||||
{"unquoted uint64 object", Unmarshaler{}, `{"oUint64":123}`, &pb.Simple{OUint64: proto.Uint64(123)}},
|
||||
{"map<int64, int32>", Unmarshaler{}, `{"nummy":{"1":2,"3":4}}`, &pb.Mappy{Nummy: map[int64]int32{1: 2, 3: 4}}},
|
||||
{"map<string, string>", Unmarshaler{}, `{"strry":{"\"one\"":"two","three":"four"}}`, &pb.Mappy{Strry: map[string]string{`"one"`: "two", "three": "four"}}},
|
||||
{"map<int32, Object>", Unmarshaler{}, `{"objjy":{"1":{"dub":1}}}`, &pb.Mappy{Objjy: map[int32]*pb.Simple3{1: &pb.Simple3{Dub: 1}}}},
|
||||
// TODO: This is broken.
|
||||
//{"map<string, enum>", Unmarshaler{}, `{"enumy":{"XIV":"ROMAN"}`, &pb.Mappy{Enumy: map[string]pb.Numeral{"XIV": pb.Numeral_ROMAN}}},
|
||||
{"map<string, enum as int>", Unmarshaler{}, `{"enumy":{"XIV":2}}`, &pb.Mappy{Enumy: map[string]pb.Numeral{"XIV": pb.Numeral_ROMAN}}},
|
||||
{"oneof", Unmarshaler{}, `{"salary":31000}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Salary{31000}}},
|
||||
{"oneof spec name", Unmarshaler{}, `{"country":"Australia"}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Country{"Australia"}}},
|
||||
{"oneof orig_name", Unmarshaler{}, `{"Country":"Australia"}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Country{"Australia"}}},
|
||||
{"orig_name input", Unmarshaler{}, `{"o_bool":true}`, &pb.Simple{OBool: proto.Bool(true)}},
|
||||
{"camelName input", Unmarshaler{}, `{"oBool":true}`, &pb.Simple{OBool: proto.Bool(true)}},
|
||||
|
||||
{"Duration", Unmarshaler{}, `{"dur":"3.000s"}`, &pb.KnownTypes{Dur: &durpb.Duration{Seconds: 3}}},
|
||||
{"Timestamp", Unmarshaler{}, `{"ts":"2014-05-13T16:53:20.021Z"}`, &pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 21e6}}},
|
||||
|
||||
{"DoubleValue", Unmarshaler{}, `{"dbl":1.2}`, &pb.KnownTypes{Dbl: &wpb.DoubleValue{Value: 1.2}}},
|
||||
{"FloatValue", Unmarshaler{}, `{"flt":1.2}`, &pb.KnownTypes{Flt: &wpb.FloatValue{Value: 1.2}}},
|
||||
{"Int64Value", Unmarshaler{}, `{"i64":"-3"}`, &pb.KnownTypes{I64: &wpb.Int64Value{Value: -3}}},
|
||||
{"UInt64Value", Unmarshaler{}, `{"u64":"3"}`, &pb.KnownTypes{U64: &wpb.UInt64Value{Value: 3}}},
|
||||
{"Int32Value", Unmarshaler{}, `{"i32":-4}`, &pb.KnownTypes{I32: &wpb.Int32Value{Value: -4}}},
|
||||
{"UInt32Value", Unmarshaler{}, `{"u32":4}`, &pb.KnownTypes{U32: &wpb.UInt32Value{Value: 4}}},
|
||||
{"BoolValue", Unmarshaler{}, `{"bool":true}`, &pb.KnownTypes{Bool: &wpb.BoolValue{Value: true}}},
|
||||
{"StringValue", Unmarshaler{}, `{"str":"plush"}`, &pb.KnownTypes{Str: &wpb.StringValue{Value: "plush"}}},
|
||||
{"BytesValue", Unmarshaler{}, `{"bytes":"d293"}`, &pb.KnownTypes{Bytes: &wpb.BytesValue{Value: []byte("wow")}}},
|
||||
// `null` is also a permissible value. Let's just test one.
|
||||
{"null DoubleValue", Unmarshaler{}, `{"dbl":null}`, &pb.KnownTypes{Dbl: &wpb.DoubleValue{}}},
|
||||
}
|
||||
|
||||
func TestUnmarshaling(t *testing.T) {
|
||||
for _, tt := range unmarshalingTests {
|
||||
// Make a new instance of the type of our expected object.
|
||||
p := reflect.New(reflect.TypeOf(tt.pb).Elem()).Interface().(proto.Message)
|
||||
|
||||
err := tt.unmarshaler.Unmarshal(strings.NewReader(tt.json), p)
|
||||
if err != nil {
|
||||
t.Errorf("%s: %v", tt.desc, err)
|
||||
continue
|
||||
}
|
||||
|
||||
// For easier diffs, compare text strings of the protos.
|
||||
exp := proto.MarshalTextString(tt.pb)
|
||||
act := proto.MarshalTextString(p)
|
||||
if string(exp) != string(act) {
|
||||
t.Errorf("%s: got [%s] want [%s]", tt.desc, act, exp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnmarshalNext(t *testing.T) {
|
||||
// We only need to check against a few, not all of them.
|
||||
tests := unmarshalingTests[:5]
|
||||
|
||||
// Create a buffer with many concatenated JSON objects.
|
||||
var b bytes.Buffer
|
||||
for _, tt := range tests {
|
||||
b.WriteString(tt.json)
|
||||
}
|
||||
|
||||
dec := json.NewDecoder(&b)
|
||||
for _, tt := range tests {
|
||||
// Make a new instance of the type of our expected object.
|
||||
p := reflect.New(reflect.TypeOf(tt.pb).Elem()).Interface().(proto.Message)
|
||||
|
||||
err := tt.unmarshaler.UnmarshalNext(dec, p)
|
||||
if err != nil {
|
||||
t.Errorf("%s: %v", tt.desc, err)
|
||||
continue
|
||||
}
|
||||
|
||||
// For easier diffs, compare text strings of the protos.
|
||||
exp := proto.MarshalTextString(tt.pb)
|
||||
act := proto.MarshalTextString(p)
|
||||
if string(exp) != string(act) {
|
||||
t.Errorf("%s: got [%s] want [%s]", tt.desc, act, exp)
|
||||
}
|
||||
}
|
||||
|
||||
p := &pb.Simple{}
|
||||
err := new(Unmarshaler).UnmarshalNext(dec, p)
|
||||
if err != io.EOF {
|
||||
t.Errorf("eof: got %v, expected io.EOF", err)
|
||||
}
|
||||
}
|
||||
|
||||
var unmarshalingShouldError = []struct {
|
||||
desc string
|
||||
in string
|
||||
pb proto.Message
|
||||
}{
|
||||
{"a value", "666", new(pb.Simple)},
|
||||
{"gibberish", "{adskja123;l23=-=", new(pb.Simple)},
|
||||
{"unknown field", `{"unknown": "foo"}`, new(pb.Simple)},
|
||||
{"unknown enum name", `{"hilarity":"DAVE"}`, new(proto3pb.Message)},
|
||||
}
|
||||
|
||||
func TestUnmarshalingBadInput(t *testing.T) {
|
||||
for _, tt := range unmarshalingShouldError {
|
||||
err := UnmarshalString(tt.in, tt.pb)
|
||||
if err == nil {
|
||||
t.Errorf("an error was expected when parsing %q instead of an object", tt.desc)
|
||||
}
|
||||
}
|
||||
}
|
||||
33
_vendor/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/Makefile
generated
vendored
33
_vendor/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/Makefile
generated
vendored
@ -1,33 +0,0 @@
|
||||
# Go support for Protocol Buffers - Google's data interchange format
|
||||
#
|
||||
# Copyright 2015 The Go Authors. All rights reserved.
|
||||
# https://github.com/golang/protobuf
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the name of Google Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
regenerate:
|
||||
protoc --go_out=Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any,Mgoogle/protobuf/duration.proto=github.com/golang/protobuf/ptypes/duration,Mgoogle/protobuf/struct.proto=github.com/golang/protobuf/ptypes/struct,Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp,Mgoogle/protobuf/wrappers.proto=github.com/golang/protobuf/ptypes/wrappers:. *.proto
|
||||
163
_vendor/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/more_test_objects.pb.go
generated
vendored
163
_vendor/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/more_test_objects.pb.go
generated
vendored
@ -1,163 +0,0 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: more_test_objects.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package jsonpb is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
more_test_objects.proto
|
||||
test_objects.proto
|
||||
|
||||
It has these top-level messages:
|
||||
Simple3
|
||||
Mappy
|
||||
Simple
|
||||
Repeats
|
||||
Widget
|
||||
Maps
|
||||
MsgWithOneof
|
||||
Real
|
||||
Complex
|
||||
KnownTypes
|
||||
*/
|
||||
package jsonpb
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type Numeral int32
|
||||
|
||||
const (
|
||||
Numeral_UNKNOWN Numeral = 0
|
||||
Numeral_ARABIC Numeral = 1
|
||||
Numeral_ROMAN Numeral = 2
|
||||
)
|
||||
|
||||
var Numeral_name = map[int32]string{
|
||||
0: "UNKNOWN",
|
||||
1: "ARABIC",
|
||||
2: "ROMAN",
|
||||
}
|
||||
var Numeral_value = map[string]int32{
|
||||
"UNKNOWN": 0,
|
||||
"ARABIC": 1,
|
||||
"ROMAN": 2,
|
||||
}
|
||||
|
||||
func (x Numeral) String() string {
|
||||
return proto.EnumName(Numeral_name, int32(x))
|
||||
}
|
||||
func (Numeral) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
type Simple3 struct {
|
||||
Dub float64 `protobuf:"fixed64,1,opt,name=dub" json:"dub,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Simple3) Reset() { *m = Simple3{} }
|
||||
func (m *Simple3) String() string { return proto.CompactTextString(m) }
|
||||
func (*Simple3) ProtoMessage() {}
|
||||
func (*Simple3) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
type Mappy struct {
|
||||
Nummy map[int64]int32 `protobuf:"bytes,1,rep,name=nummy" json:"nummy,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
|
||||
Strry map[string]string `protobuf:"bytes,2,rep,name=strry" json:"strry,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
Objjy map[int32]*Simple3 `protobuf:"bytes,3,rep,name=objjy" json:"objjy,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
Buggy map[int64]string `protobuf:"bytes,4,rep,name=buggy" json:"buggy,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
Booly map[bool]bool `protobuf:"bytes,5,rep,name=booly" json:"booly,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
|
||||
Enumy map[string]Numeral `protobuf:"bytes,6,rep,name=enumy" json:"enumy,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value,enum=jsonpb.Numeral"`
|
||||
}
|
||||
|
||||
func (m *Mappy) Reset() { *m = Mappy{} }
|
||||
func (m *Mappy) String() string { return proto.CompactTextString(m) }
|
||||
func (*Mappy) ProtoMessage() {}
|
||||
func (*Mappy) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
func (m *Mappy) GetNummy() map[int64]int32 {
|
||||
if m != nil {
|
||||
return m.Nummy
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Mappy) GetStrry() map[string]string {
|
||||
if m != nil {
|
||||
return m.Strry
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Mappy) GetObjjy() map[int32]*Simple3 {
|
||||
if m != nil {
|
||||
return m.Objjy
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Mappy) GetBuggy() map[int64]string {
|
||||
if m != nil {
|
||||
return m.Buggy
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Mappy) GetBooly() map[bool]bool {
|
||||
if m != nil {
|
||||
return m.Booly
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Mappy) GetEnumy() map[string]Numeral {
|
||||
if m != nil {
|
||||
return m.Enumy
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Simple3)(nil), "jsonpb.Simple3")
|
||||
proto.RegisterType((*Mappy)(nil), "jsonpb.Mappy")
|
||||
proto.RegisterEnum("jsonpb.Numeral", Numeral_name, Numeral_value)
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("more_test_objects.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 357 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x93, 0xcd, 0x4a, 0xf3, 0x40,
|
||||
0x18, 0x85, 0xbf, 0x34, 0xdf, 0xa4, 0xcd, 0x5b, 0xd0, 0x30, 0x08, 0x0e, 0xba, 0x91, 0x82, 0x50,
|
||||
0x04, 0xb3, 0x68, 0x37, 0xc5, 0x5d, 0x2b, 0x5d, 0x14, 0x69, 0x0a, 0x29, 0xe2, 0xb2, 0x34, 0x3a,
|
||||
0x14, 0x6b, 0xd2, 0x09, 0xf9, 0x11, 0xe6, 0x82, 0xbc, 0x4f, 0xf3, 0x4e, 0x52, 0x33, 0x96, 0x01,
|
||||
0x77, 0xd3, 0x9e, 0xe7, 0x09, 0x67, 0x4e, 0x08, 0x5c, 0x26, 0x22, 0xe3, 0x9b, 0x82, 0xe7, 0xc5,
|
||||
0x46, 0x44, 0x7b, 0xfe, 0x5a, 0xe4, 0x7e, 0x9a, 0x89, 0x42, 0x50, 0x67, 0x9f, 0x8b, 0x43, 0x1a,
|
||||
0x0d, 0xae, 0xa1, 0xbb, 0x7e, 0x4f, 0xd2, 0x98, 0x8f, 0xa9, 0x07, 0xf6, 0x5b, 0x19, 0x31, 0xeb,
|
||||
0xc6, 0x1a, 0x5a, 0x21, 0x1e, 0x07, 0x5f, 0x04, 0xc8, 0x72, 0x9b, 0xa6, 0x92, 0xfa, 0x40, 0x0e,
|
||||
0x65, 0x92, 0xc8, 0x2a, 0xb5, 0x87, 0xfd, 0x11, 0xf3, 0x6b, 0xdd, 0x57, 0xa9, 0x1f, 0x60, 0x34,
|
||||
0x3f, 0x14, 0x99, 0x0c, 0x6b, 0x0c, 0xf9, 0xbc, 0xc8, 0x32, 0xc9, 0x3a, 0x26, 0x7e, 0x8d, 0x51,
|
||||
0xc3, 0x2b, 0x0c, 0xf9, 0xaa, 0xdf, 0x5e, 0x32, 0xdb, 0xc4, 0xaf, 0x30, 0x6a, 0x78, 0x85, 0x21,
|
||||
0x1f, 0x95, 0xbb, 0x9d, 0x64, 0xff, 0x4d, 0xfc, 0x0c, 0xa3, 0x86, 0x57, 0x98, 0xe2, 0x85, 0x88,
|
||||
0x25, 0x23, 0x46, 0x1e, 0xa3, 0x23, 0x8f, 0x67, 0xe4, 0x79, 0x75, 0x13, 0xc9, 0x1c, 0x13, 0x3f,
|
||||
0xc7, 0xa8, 0xe1, 0x15, 0x76, 0x35, 0x01, 0x68, 0x47, 0xc0, 0x25, 0x3f, 0xb8, 0x54, 0x4b, 0xda,
|
||||
0x21, 0x1e, 0xe9, 0x05, 0x90, 0xcf, 0x6d, 0x5c, 0xf2, 0x6a, 0x0f, 0x6b, 0x48, 0xc2, 0xfa, 0xc7,
|
||||
0x43, 0x67, 0x62, 0xa1, 0xd9, 0xce, 0xa1, 0x9b, 0xae, 0xc1, 0x74, 0x75, 0x73, 0x01, 0xd0, 0x0e,
|
||||
0xa3, 0x9b, 0xa4, 0x36, 0x6f, 0x75, 0xb3, 0x3f, 0x3a, 0x3f, 0xde, 0xa1, 0x79, 0xdf, 0x27, 0x25,
|
||||
0xda, 0xcd, 0xfe, 0xaa, 0xef, 0x9e, 0x9a, 0x3f, 0xeb, 0xe9, 0x66, 0xcf, 0x60, 0xf6, 0x4e, 0xea,
|
||||
0xb7, 0x3b, 0x1a, 0x2e, 0xfe, 0xab, 0xfe, 0x59, 0x5b, 0xbf, 0xda, 0x99, 0x67, 0xdb, 0x58, 0x7b,
|
||||
0xd4, 0xdd, 0x3d, 0x74, 0x9b, 0x7f, 0x69, 0x1f, 0xba, 0xcf, 0xc1, 0x53, 0xb0, 0x7a, 0x09, 0xbc,
|
||||
0x7f, 0x14, 0xc0, 0x99, 0x86, 0xd3, 0xd9, 0xe2, 0xd1, 0xb3, 0xa8, 0x0b, 0x24, 0x5c, 0x2d, 0xa7,
|
||||
0x81, 0xd7, 0x89, 0x1c, 0xf5, 0x09, 0x8c, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x3d, 0x04, 0xff,
|
||||
0x62, 0x1d, 0x03, 0x00, 0x00,
|
||||
}
|
||||
@ -1,53 +0,0 @@
|
||||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package jsonpb;
|
||||
|
||||
message Simple3 {
|
||||
double dub = 1;
|
||||
}
|
||||
|
||||
enum Numeral {
|
||||
UNKNOWN = 0;
|
||||
ARABIC = 1;
|
||||
ROMAN = 2;
|
||||
}
|
||||
|
||||
message Mappy {
|
||||
map<int64, int32> nummy = 1;
|
||||
map<string, string> strry = 2;
|
||||
map<int32, Simple3> objjy = 3;
|
||||
map<int64, string> buggy = 4;
|
||||
map<bool, bool> booly = 5;
|
||||
map<string, Numeral> enumy = 6;
|
||||
}
|
||||
739
_vendor/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/test_objects.pb.go
generated
vendored
739
_vendor/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/test_objects.pb.go
generated
vendored
@ -1,739 +0,0 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: test_objects.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package jsonpb
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import google_protobuf "github.com/golang/protobuf/ptypes/any"
|
||||
import google_protobuf1 "github.com/golang/protobuf/ptypes/duration"
|
||||
import google_protobuf2 "github.com/golang/protobuf/ptypes/struct"
|
||||
import google_protobuf3 "github.com/golang/protobuf/ptypes/timestamp"
|
||||
import google_protobuf4 "github.com/golang/protobuf/ptypes/wrappers"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
type Widget_Color int32
|
||||
|
||||
const (
|
||||
Widget_RED Widget_Color = 0
|
||||
Widget_GREEN Widget_Color = 1
|
||||
Widget_BLUE Widget_Color = 2
|
||||
)
|
||||
|
||||
var Widget_Color_name = map[int32]string{
|
||||
0: "RED",
|
||||
1: "GREEN",
|
||||
2: "BLUE",
|
||||
}
|
||||
var Widget_Color_value = map[string]int32{
|
||||
"RED": 0,
|
||||
"GREEN": 1,
|
||||
"BLUE": 2,
|
||||
}
|
||||
|
||||
func (x Widget_Color) Enum() *Widget_Color {
|
||||
p := new(Widget_Color)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
func (x Widget_Color) String() string {
|
||||
return proto.EnumName(Widget_Color_name, int32(x))
|
||||
}
|
||||
func (x *Widget_Color) UnmarshalJSON(data []byte) error {
|
||||
value, err := proto.UnmarshalJSONEnum(Widget_Color_value, data, "Widget_Color")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*x = Widget_Color(value)
|
||||
return nil
|
||||
}
|
||||
func (Widget_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{2, 0} }
|
||||
|
||||
// Test message for holding primitive types.
|
||||
type Simple struct {
|
||||
OBool *bool `protobuf:"varint,1,opt,name=o_bool,json=oBool" json:"o_bool,omitempty"`
|
||||
OInt32 *int32 `protobuf:"varint,2,opt,name=o_int32,json=oInt32" json:"o_int32,omitempty"`
|
||||
OInt64 *int64 `protobuf:"varint,3,opt,name=o_int64,json=oInt64" json:"o_int64,omitempty"`
|
||||
OUint32 *uint32 `protobuf:"varint,4,opt,name=o_uint32,json=oUint32" json:"o_uint32,omitempty"`
|
||||
OUint64 *uint64 `protobuf:"varint,5,opt,name=o_uint64,json=oUint64" json:"o_uint64,omitempty"`
|
||||
OSint32 *int32 `protobuf:"zigzag32,6,opt,name=o_sint32,json=oSint32" json:"o_sint32,omitempty"`
|
||||
OSint64 *int64 `protobuf:"zigzag64,7,opt,name=o_sint64,json=oSint64" json:"o_sint64,omitempty"`
|
||||
OFloat *float32 `protobuf:"fixed32,8,opt,name=o_float,json=oFloat" json:"o_float,omitempty"`
|
||||
ODouble *float64 `protobuf:"fixed64,9,opt,name=o_double,json=oDouble" json:"o_double,omitempty"`
|
||||
OString *string `protobuf:"bytes,10,opt,name=o_string,json=oString" json:"o_string,omitempty"`
|
||||
OBytes []byte `protobuf:"bytes,11,opt,name=o_bytes,json=oBytes" json:"o_bytes,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Simple) Reset() { *m = Simple{} }
|
||||
func (m *Simple) String() string { return proto.CompactTextString(m) }
|
||||
func (*Simple) ProtoMessage() {}
|
||||
func (*Simple) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
|
||||
|
||||
func (m *Simple) GetOBool() bool {
|
||||
if m != nil && m.OBool != nil {
|
||||
return *m.OBool
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *Simple) GetOInt32() int32 {
|
||||
if m != nil && m.OInt32 != nil {
|
||||
return *m.OInt32
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOInt64() int64 {
|
||||
if m != nil && m.OInt64 != nil {
|
||||
return *m.OInt64
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOUint32() uint32 {
|
||||
if m != nil && m.OUint32 != nil {
|
||||
return *m.OUint32
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOUint64() uint64 {
|
||||
if m != nil && m.OUint64 != nil {
|
||||
return *m.OUint64
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOSint32() int32 {
|
||||
if m != nil && m.OSint32 != nil {
|
||||
return *m.OSint32
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOSint64() int64 {
|
||||
if m != nil && m.OSint64 != nil {
|
||||
return *m.OSint64
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOFloat() float32 {
|
||||
if m != nil && m.OFloat != nil {
|
||||
return *m.OFloat
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetODouble() float64 {
|
||||
if m != nil && m.ODouble != nil {
|
||||
return *m.ODouble
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOString() string {
|
||||
if m != nil && m.OString != nil {
|
||||
return *m.OString
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Simple) GetOBytes() []byte {
|
||||
if m != nil {
|
||||
return m.OBytes
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Test message for holding repeated primitives.
|
||||
type Repeats struct {
|
||||
RBool []bool `protobuf:"varint,1,rep,name=r_bool,json=rBool" json:"r_bool,omitempty"`
|
||||
RInt32 []int32 `protobuf:"varint,2,rep,name=r_int32,json=rInt32" json:"r_int32,omitempty"`
|
||||
RInt64 []int64 `protobuf:"varint,3,rep,name=r_int64,json=rInt64" json:"r_int64,omitempty"`
|
||||
RUint32 []uint32 `protobuf:"varint,4,rep,name=r_uint32,json=rUint32" json:"r_uint32,omitempty"`
|
||||
RUint64 []uint64 `protobuf:"varint,5,rep,name=r_uint64,json=rUint64" json:"r_uint64,omitempty"`
|
||||
RSint32 []int32 `protobuf:"zigzag32,6,rep,name=r_sint32,json=rSint32" json:"r_sint32,omitempty"`
|
||||
RSint64 []int64 `protobuf:"zigzag64,7,rep,name=r_sint64,json=rSint64" json:"r_sint64,omitempty"`
|
||||
RFloat []float32 `protobuf:"fixed32,8,rep,name=r_float,json=rFloat" json:"r_float,omitempty"`
|
||||
RDouble []float64 `protobuf:"fixed64,9,rep,name=r_double,json=rDouble" json:"r_double,omitempty"`
|
||||
RString []string `protobuf:"bytes,10,rep,name=r_string,json=rString" json:"r_string,omitempty"`
|
||||
RBytes [][]byte `protobuf:"bytes,11,rep,name=r_bytes,json=rBytes" json:"r_bytes,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Repeats) Reset() { *m = Repeats{} }
|
||||
func (m *Repeats) String() string { return proto.CompactTextString(m) }
|
||||
func (*Repeats) ProtoMessage() {}
|
||||
func (*Repeats) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} }
|
||||
|
||||
func (m *Repeats) GetRBool() []bool {
|
||||
if m != nil {
|
||||
return m.RBool
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Repeats) GetRInt32() []int32 {
|
||||
if m != nil {
|
||||
return m.RInt32
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Repeats) GetRInt64() []int64 {
|
||||
if m != nil {
|
||||
return m.RInt64
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Repeats) GetRUint32() []uint32 {
|
||||
if m != nil {
|
||||
return m.RUint32
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Repeats) GetRUint64() []uint64 {
|
||||
if m != nil {
|
||||
return m.RUint64
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Repeats) GetRSint32() []int32 {
|
||||
if m != nil {
|
||||
return m.RSint32
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Repeats) GetRSint64() []int64 {
|
||||
if m != nil {
|
||||
return m.RSint64
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Repeats) GetRFloat() []float32 {
|
||||
if m != nil {
|
||||
return m.RFloat
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Repeats) GetRDouble() []float64 {
|
||||
if m != nil {
|
||||
return m.RDouble
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Repeats) GetRString() []string {
|
||||
if m != nil {
|
||||
return m.RString
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Repeats) GetRBytes() [][]byte {
|
||||
if m != nil {
|
||||
return m.RBytes
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Test message for holding enums and nested messages.
|
||||
type Widget struct {
|
||||
Color *Widget_Color `protobuf:"varint,1,opt,name=color,enum=jsonpb.Widget_Color" json:"color,omitempty"`
|
||||
RColor []Widget_Color `protobuf:"varint,2,rep,name=r_color,json=rColor,enum=jsonpb.Widget_Color" json:"r_color,omitempty"`
|
||||
Simple *Simple `protobuf:"bytes,10,opt,name=simple" json:"simple,omitempty"`
|
||||
RSimple []*Simple `protobuf:"bytes,11,rep,name=r_simple,json=rSimple" json:"r_simple,omitempty"`
|
||||
Repeats *Repeats `protobuf:"bytes,20,opt,name=repeats" json:"repeats,omitempty"`
|
||||
RRepeats []*Repeats `protobuf:"bytes,21,rep,name=r_repeats,json=rRepeats" json:"r_repeats,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Widget) Reset() { *m = Widget{} }
|
||||
func (m *Widget) String() string { return proto.CompactTextString(m) }
|
||||
func (*Widget) ProtoMessage() {}
|
||||
func (*Widget) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} }
|
||||
|
||||
func (m *Widget) GetColor() Widget_Color {
|
||||
if m != nil && m.Color != nil {
|
||||
return *m.Color
|
||||
}
|
||||
return Widget_RED
|
||||
}
|
||||
|
||||
func (m *Widget) GetRColor() []Widget_Color {
|
||||
if m != nil {
|
||||
return m.RColor
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Widget) GetSimple() *Simple {
|
||||
if m != nil {
|
||||
return m.Simple
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Widget) GetRSimple() []*Simple {
|
||||
if m != nil {
|
||||
return m.RSimple
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Widget) GetRepeats() *Repeats {
|
||||
if m != nil {
|
||||
return m.Repeats
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Widget) GetRRepeats() []*Repeats {
|
||||
if m != nil {
|
||||
return m.RRepeats
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Maps struct {
|
||||
MInt64Str map[int64]string `protobuf:"bytes,1,rep,name=m_int64_str,json=mInt64Str" json:"m_int64_str,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
MBoolSimple map[bool]*Simple `protobuf:"bytes,2,rep,name=m_bool_simple,json=mBoolSimple" json:"m_bool_simple,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Maps) Reset() { *m = Maps{} }
|
||||
func (m *Maps) String() string { return proto.CompactTextString(m) }
|
||||
func (*Maps) ProtoMessage() {}
|
||||
func (*Maps) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{3} }
|
||||
|
||||
func (m *Maps) GetMInt64Str() map[int64]string {
|
||||
if m != nil {
|
||||
return m.MInt64Str
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Maps) GetMBoolSimple() map[bool]*Simple {
|
||||
if m != nil {
|
||||
return m.MBoolSimple
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type MsgWithOneof struct {
|
||||
// Types that are valid to be assigned to Union:
|
||||
// *MsgWithOneof_Title
|
||||
// *MsgWithOneof_Salary
|
||||
// *MsgWithOneof_Country
|
||||
Union isMsgWithOneof_Union `protobuf_oneof:"union"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *MsgWithOneof) Reset() { *m = MsgWithOneof{} }
|
||||
func (m *MsgWithOneof) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgWithOneof) ProtoMessage() {}
|
||||
func (*MsgWithOneof) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{4} }
|
||||
|
||||
type isMsgWithOneof_Union interface {
|
||||
isMsgWithOneof_Union()
|
||||
}
|
||||
|
||||
type MsgWithOneof_Title struct {
|
||||
Title string `protobuf:"bytes,1,opt,name=title,oneof"`
|
||||
}
|
||||
type MsgWithOneof_Salary struct {
|
||||
Salary int64 `protobuf:"varint,2,opt,name=salary,oneof"`
|
||||
}
|
||||
type MsgWithOneof_Country struct {
|
||||
Country string `protobuf:"bytes,3,opt,name=Country,json=country,oneof"`
|
||||
}
|
||||
|
||||
func (*MsgWithOneof_Title) isMsgWithOneof_Union() {}
|
||||
func (*MsgWithOneof_Salary) isMsgWithOneof_Union() {}
|
||||
func (*MsgWithOneof_Country) isMsgWithOneof_Union() {}
|
||||
|
||||
func (m *MsgWithOneof) GetUnion() isMsgWithOneof_Union {
|
||||
if m != nil {
|
||||
return m.Union
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MsgWithOneof) GetTitle() string {
|
||||
if x, ok := m.GetUnion().(*MsgWithOneof_Title); ok {
|
||||
return x.Title
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgWithOneof) GetSalary() int64 {
|
||||
if x, ok := m.GetUnion().(*MsgWithOneof_Salary); ok {
|
||||
return x.Salary
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *MsgWithOneof) GetCountry() string {
|
||||
if x, ok := m.GetUnion().(*MsgWithOneof_Country); ok {
|
||||
return x.Country
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*MsgWithOneof) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
|
||||
return _MsgWithOneof_OneofMarshaler, _MsgWithOneof_OneofUnmarshaler, _MsgWithOneof_OneofSizer, []interface{}{
|
||||
(*MsgWithOneof_Title)(nil),
|
||||
(*MsgWithOneof_Salary)(nil),
|
||||
(*MsgWithOneof_Country)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _MsgWithOneof_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*MsgWithOneof)
|
||||
// union
|
||||
switch x := m.Union.(type) {
|
||||
case *MsgWithOneof_Title:
|
||||
b.EncodeVarint(1<<3 | proto.WireBytes)
|
||||
b.EncodeStringBytes(x.Title)
|
||||
case *MsgWithOneof_Salary:
|
||||
b.EncodeVarint(2<<3 | proto.WireVarint)
|
||||
b.EncodeVarint(uint64(x.Salary))
|
||||
case *MsgWithOneof_Country:
|
||||
b.EncodeVarint(3<<3 | proto.WireBytes)
|
||||
b.EncodeStringBytes(x.Country)
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("MsgWithOneof.Union has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _MsgWithOneof_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*MsgWithOneof)
|
||||
switch tag {
|
||||
case 1: // union.title
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeStringBytes()
|
||||
m.Union = &MsgWithOneof_Title{x}
|
||||
return true, err
|
||||
case 2: // union.salary
|
||||
if wire != proto.WireVarint {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeVarint()
|
||||
m.Union = &MsgWithOneof_Salary{int64(x)}
|
||||
return true, err
|
||||
case 3: // union.Country
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeStringBytes()
|
||||
m.Union = &MsgWithOneof_Country{x}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _MsgWithOneof_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*MsgWithOneof)
|
||||
// union
|
||||
switch x := m.Union.(type) {
|
||||
case *MsgWithOneof_Title:
|
||||
n += proto.SizeVarint(1<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(len(x.Title)))
|
||||
n += len(x.Title)
|
||||
case *MsgWithOneof_Salary:
|
||||
n += proto.SizeVarint(2<<3 | proto.WireVarint)
|
||||
n += proto.SizeVarint(uint64(x.Salary))
|
||||
case *MsgWithOneof_Country:
|
||||
n += proto.SizeVarint(3<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(len(x.Country)))
|
||||
n += len(x.Country)
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
type Real struct {
|
||||
Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
|
||||
proto.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Real) Reset() { *m = Real{} }
|
||||
func (m *Real) String() string { return proto.CompactTextString(m) }
|
||||
func (*Real) ProtoMessage() {}
|
||||
func (*Real) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{5} }
|
||||
|
||||
var extRange_Real = []proto.ExtensionRange{
|
||||
{100, 536870911},
|
||||
}
|
||||
|
||||
func (*Real) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
return extRange_Real
|
||||
}
|
||||
|
||||
func (m *Real) GetValue() float64 {
|
||||
if m != nil && m.Value != nil {
|
||||
return *m.Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type Complex struct {
|
||||
Imaginary *float64 `protobuf:"fixed64,1,opt,name=imaginary" json:"imaginary,omitempty"`
|
||||
proto.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Complex) Reset() { *m = Complex{} }
|
||||
func (m *Complex) String() string { return proto.CompactTextString(m) }
|
||||
func (*Complex) ProtoMessage() {}
|
||||
func (*Complex) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{6} }
|
||||
|
||||
var extRange_Complex = []proto.ExtensionRange{
|
||||
{100, 536870911},
|
||||
}
|
||||
|
||||
func (*Complex) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
return extRange_Complex
|
||||
}
|
||||
|
||||
func (m *Complex) GetImaginary() float64 {
|
||||
if m != nil && m.Imaginary != nil {
|
||||
return *m.Imaginary
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var E_Complex_RealExtension = &proto.ExtensionDesc{
|
||||
ExtendedType: (*Real)(nil),
|
||||
ExtensionType: (*Complex)(nil),
|
||||
Field: 123,
|
||||
Name: "jsonpb.Complex.real_extension",
|
||||
Tag: "bytes,123,opt,name=real_extension,json=realExtension",
|
||||
}
|
||||
|
||||
type KnownTypes struct {
|
||||
An *google_protobuf.Any `protobuf:"bytes,14,opt,name=an" json:"an,omitempty"`
|
||||
Dur *google_protobuf1.Duration `protobuf:"bytes,1,opt,name=dur" json:"dur,omitempty"`
|
||||
St *google_protobuf2.Struct `protobuf:"bytes,12,opt,name=st" json:"st,omitempty"`
|
||||
Ts *google_protobuf3.Timestamp `protobuf:"bytes,2,opt,name=ts" json:"ts,omitempty"`
|
||||
Dbl *google_protobuf4.DoubleValue `protobuf:"bytes,3,opt,name=dbl" json:"dbl,omitempty"`
|
||||
Flt *google_protobuf4.FloatValue `protobuf:"bytes,4,opt,name=flt" json:"flt,omitempty"`
|
||||
I64 *google_protobuf4.Int64Value `protobuf:"bytes,5,opt,name=i64" json:"i64,omitempty"`
|
||||
U64 *google_protobuf4.UInt64Value `protobuf:"bytes,6,opt,name=u64" json:"u64,omitempty"`
|
||||
I32 *google_protobuf4.Int32Value `protobuf:"bytes,7,opt,name=i32" json:"i32,omitempty"`
|
||||
U32 *google_protobuf4.UInt32Value `protobuf:"bytes,8,opt,name=u32" json:"u32,omitempty"`
|
||||
Bool *google_protobuf4.BoolValue `protobuf:"bytes,9,opt,name=bool" json:"bool,omitempty"`
|
||||
Str *google_protobuf4.StringValue `protobuf:"bytes,10,opt,name=str" json:"str,omitempty"`
|
||||
Bytes *google_protobuf4.BytesValue `protobuf:"bytes,11,opt,name=bytes" json:"bytes,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *KnownTypes) Reset() { *m = KnownTypes{} }
|
||||
func (m *KnownTypes) String() string { return proto.CompactTextString(m) }
|
||||
func (*KnownTypes) ProtoMessage() {}
|
||||
func (*KnownTypes) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{7} }
|
||||
|
||||
func (m *KnownTypes) GetAn() *google_protobuf.Any {
|
||||
if m != nil {
|
||||
return m.An
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KnownTypes) GetDur() *google_protobuf1.Duration {
|
||||
if m != nil {
|
||||
return m.Dur
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KnownTypes) GetSt() *google_protobuf2.Struct {
|
||||
if m != nil {
|
||||
return m.St
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KnownTypes) GetTs() *google_protobuf3.Timestamp {
|
||||
if m != nil {
|
||||
return m.Ts
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KnownTypes) GetDbl() *google_protobuf4.DoubleValue {
|
||||
if m != nil {
|
||||
return m.Dbl
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KnownTypes) GetFlt() *google_protobuf4.FloatValue {
|
||||
if m != nil {
|
||||
return m.Flt
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KnownTypes) GetI64() *google_protobuf4.Int64Value {
|
||||
if m != nil {
|
||||
return m.I64
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KnownTypes) GetU64() *google_protobuf4.UInt64Value {
|
||||
if m != nil {
|
||||
return m.U64
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KnownTypes) GetI32() *google_protobuf4.Int32Value {
|
||||
if m != nil {
|
||||
return m.I32
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KnownTypes) GetU32() *google_protobuf4.UInt32Value {
|
||||
if m != nil {
|
||||
return m.U32
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KnownTypes) GetBool() *google_protobuf4.BoolValue {
|
||||
if m != nil {
|
||||
return m.Bool
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KnownTypes) GetStr() *google_protobuf4.StringValue {
|
||||
if m != nil {
|
||||
return m.Str
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KnownTypes) GetBytes() *google_protobuf4.BytesValue {
|
||||
if m != nil {
|
||||
return m.Bytes
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var E_Name = &proto.ExtensionDesc{
|
||||
ExtendedType: (*Real)(nil),
|
||||
ExtensionType: (*string)(nil),
|
||||
Field: 124,
|
||||
Name: "jsonpb.name",
|
||||
Tag: "bytes,124,opt,name=name",
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Simple)(nil), "jsonpb.Simple")
|
||||
proto.RegisterType((*Repeats)(nil), "jsonpb.Repeats")
|
||||
proto.RegisterType((*Widget)(nil), "jsonpb.Widget")
|
||||
proto.RegisterType((*Maps)(nil), "jsonpb.Maps")
|
||||
proto.RegisterType((*MsgWithOneof)(nil), "jsonpb.MsgWithOneof")
|
||||
proto.RegisterType((*Real)(nil), "jsonpb.Real")
|
||||
proto.RegisterType((*Complex)(nil), "jsonpb.Complex")
|
||||
proto.RegisterType((*KnownTypes)(nil), "jsonpb.KnownTypes")
|
||||
proto.RegisterEnum("jsonpb.Widget_Color", Widget_Color_name, Widget_Color_value)
|
||||
proto.RegisterExtension(E_Complex_RealExtension)
|
||||
proto.RegisterExtension(E_Name)
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("test_objects.proto", fileDescriptor1) }
|
||||
|
||||
var fileDescriptor1 = []byte{
|
||||
// 1006 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x55, 0xdd, 0x72, 0xdb, 0x44,
|
||||
0x14, 0xae, 0xb5, 0x96, 0x65, 0xaf, 0x53, 0x63, 0x76, 0x52, 0xaa, 0x98, 0x00, 0x1d, 0x0f, 0x14,
|
||||
0x28, 0xe0, 0x0e, 0x6e, 0xa7, 0xc3, 0x14, 0x6e, 0x9a, 0xc6, 0xfc, 0x0c, 0xa4, 0xcc, 0x6c, 0x1a,
|
||||
0x7a, 0xe9, 0x91, 0x13, 0xc5, 0xa8, 0xc8, 0x5a, 0xcf, 0x6a, 0x45, 0xea, 0x81, 0x0b, 0x1e, 0x82,
|
||||
0x57, 0x80, 0x47, 0xe0, 0x89, 0x78, 0x10, 0xce, 0x39, 0x2b, 0x69, 0x1d, 0xbb, 0xa6, 0x37, 0xcd,
|
||||
0xd1, 0xf7, 0xe3, 0xa3, 0x6f, 0x8f, 0xce, 0x72, 0x61, 0xe2, 0xdc, 0x4c, 0xd5, 0xec, 0x65, 0x7c,
|
||||
0x6e, 0xf2, 0xd1, 0x52, 0x2b, 0xa3, 0x44, 0xeb, 0x65, 0xae, 0xb2, 0xe5, 0x6c, 0x70, 0x30, 0x57,
|
||||
0x6a, 0x9e, 0xc6, 0xf7, 0xe9, 0xe9, 0xac, 0xb8, 0xbc, 0x1f, 0x65, 0x2b, 0x4b, 0x19, 0xbc, 0xbb,
|
||||
0x09, 0x5d, 0x14, 0x3a, 0x32, 0x89, 0xca, 0x4a, 0xfc, 0x70, 0x13, 0xcf, 0x8d, 0x2e, 0xce, 0x4d,
|
||||
0x89, 0xbe, 0xb7, 0x89, 0x9a, 0x64, 0x01, 0x6d, 0x44, 0x8b, 0xe5, 0x2e, 0xfb, 0x2b, 0x1d, 0x2d,
|
||||
0x97, 0xb1, 0x2e, 0x3b, 0x1c, 0xfe, 0xe5, 0xf1, 0xd6, 0x69, 0xb2, 0x58, 0xa6, 0xb1, 0xb8, 0xc5,
|
||||
0x5b, 0x6a, 0x3a, 0x53, 0x2a, 0x0d, 0x1b, 0x77, 0x1a, 0x1f, 0xb5, 0xa5, 0xaf, 0x8e, 0xa0, 0x10,
|
||||
0xb7, 0x79, 0xa0, 0xa6, 0x49, 0x66, 0x1e, 0x8c, 0x43, 0x0f, 0x9e, 0xfb, 0xb2, 0xa5, 0xbe, 0xc3,
|
||||
0xaa, 0x06, 0x1e, 0x3d, 0x0c, 0x19, 0x00, 0xcc, 0x02, 0x8f, 0x1e, 0x8a, 0x03, 0xde, 0x56, 0xd3,
|
||||
0xc2, 0x4a, 0x9a, 0x80, 0xdc, 0x94, 0x81, 0x3a, 0xa3, 0xd2, 0x41, 0x20, 0xf2, 0x01, 0x6a, 0x96,
|
||||
0x50, 0xa5, 0xca, 0xad, 0xaa, 0x05, 0xd0, 0x9b, 0x00, 0x9d, 0xae, 0xa9, 0x72, 0xab, 0x0a, 0x00,
|
||||
0x12, 0x25, 0x04, 0x2a, 0x6a, 0xe2, 0x32, 0x55, 0x91, 0x09, 0xdb, 0x80, 0x78, 0xd0, 0xc4, 0xd7,
|
||||
0x58, 0x59, 0xcd, 0x85, 0x2a, 0x66, 0x69, 0x1c, 0x76, 0x00, 0x69, 0x80, 0xe6, 0x98, 0xca, 0xd2,
|
||||
0xce, 0xe8, 0x24, 0x9b, 0x87, 0x1c, 0xa0, 0x0e, 0xda, 0x51, 0x69, 0xed, 0x66, 0x2b, 0x38, 0xca,
|
||||
0xb0, 0x0b, 0xc8, 0x1e, 0xd8, 0x1d, 0x61, 0x35, 0xfc, 0xdb, 0xe3, 0x81, 0x8c, 0x97, 0x71, 0x64,
|
||||
0x72, 0x0c, 0x4a, 0x57, 0x41, 0x31, 0x0c, 0x4a, 0x57, 0x41, 0xe9, 0x3a, 0x28, 0x86, 0x41, 0xe9,
|
||||
0x3a, 0x28, 0x5d, 0x07, 0xc5, 0x30, 0x28, 0x5d, 0x07, 0xa5, 0x5d, 0x50, 0x0c, 0x83, 0xd2, 0x2e,
|
||||
0x28, 0xed, 0x82, 0x62, 0x18, 0x94, 0x76, 0x41, 0x69, 0x17, 0x14, 0xc3, 0xa0, 0xf4, 0xe9, 0x9a,
|
||||
0xaa, 0x0e, 0x8a, 0x61, 0x50, 0xda, 0x05, 0xa5, 0xeb, 0xa0, 0x18, 0x06, 0xa5, 0xeb, 0xa0, 0xb4,
|
||||
0x0b, 0x8a, 0x61, 0x50, 0xda, 0x05, 0xa5, 0x5d, 0x50, 0x0c, 0x83, 0xd2, 0x2e, 0x28, 0x5d, 0x07,
|
||||
0xc5, 0x30, 0x28, 0x6d, 0x83, 0xfa, 0x07, 0x06, 0xea, 0x45, 0x72, 0x31, 0x8f, 0x8d, 0xb8, 0xc7,
|
||||
0xfd, 0x73, 0x95, 0x2a, 0x4d, 0xf3, 0xd4, 0x1b, 0xef, 0x8f, 0xec, 0xd7, 0x30, 0xb2, 0xf0, 0xe8,
|
||||
0x29, 0x62, 0xd2, 0x52, 0xc4, 0x67, 0xe8, 0x67, 0xd9, 0x18, 0xde, 0x2e, 0x76, 0x4b, 0xd3, 0xff,
|
||||
0xe2, 0x2e, 0x6f, 0xe5, 0x34, 0xb5, 0x74, 0x80, 0xdd, 0x71, 0xaf, 0x62, 0xdb, 0x59, 0x96, 0x25,
|
||||
0x2a, 0x3e, 0xb6, 0x81, 0x10, 0x13, 0xfb, 0xdc, 0x66, 0x62, 0x40, 0x25, 0x35, 0xd0, 0xf6, 0x80,
|
||||
0xc3, 0x7d, 0xf2, 0x7c, 0xa3, 0x62, 0x96, 0xe7, 0x2e, 0x2b, 0x5c, 0x7c, 0xca, 0x3b, 0x7a, 0x5a,
|
||||
0x91, 0x6f, 0x91, 0xed, 0x16, 0xb9, 0xad, 0xcb, 0xbf, 0x86, 0x1f, 0x70, 0xdf, 0x36, 0x1d, 0x70,
|
||||
0x26, 0x27, 0xc7, 0xfd, 0x1b, 0xa2, 0xc3, 0xfd, 0x6f, 0xe4, 0x64, 0xf2, 0xac, 0xdf, 0x10, 0x6d,
|
||||
0xde, 0x3c, 0xfa, 0xe1, 0x6c, 0xd2, 0xf7, 0x86, 0x7f, 0x7a, 0xbc, 0x79, 0x12, 0x2d, 0x73, 0xf1,
|
||||
0x25, 0xef, 0x2e, 0xec, 0xb8, 0x60, 0xf6, 0x34, 0x63, 0xdd, 0xf1, 0xdb, 0x95, 0x3f, 0x52, 0x46,
|
||||
0x27, 0x34, 0x3f, 0x70, 0x14, 0x93, 0xcc, 0xe8, 0x95, 0xec, 0x2c, 0xaa, 0x5a, 0x3c, 0xe1, 0x37,
|
||||
0x17, 0x34, 0x9b, 0xd5, 0x5b, 0x7b, 0x24, 0x7f, 0xe7, 0xba, 0x1c, 0xe7, 0xd5, 0xbe, 0xb6, 0x35,
|
||||
0xe8, 0x2e, 0xdc, 0x93, 0xc1, 0x57, 0xbc, 0x77, 0xdd, 0x5f, 0xf4, 0x39, 0xfb, 0x25, 0x5e, 0xd1,
|
||||
0x31, 0x32, 0x89, 0x7f, 0x8a, 0x7d, 0xee, 0xff, 0x1a, 0xa5, 0x45, 0x4c, 0x2b, 0xa1, 0x23, 0x6d,
|
||||
0xf1, 0xd8, 0xfb, 0xa2, 0x31, 0x78, 0xc6, 0xfb, 0x9b, 0xf6, 0xeb, 0xfa, 0xb6, 0xd5, 0xbf, 0xbf,
|
||||
0xae, 0xdf, 0x3e, 0x14, 0xe7, 0x37, 0x8c, 0xf9, 0xde, 0x49, 0x3e, 0x7f, 0x91, 0x98, 0x9f, 0x7f,
|
||||
0xcc, 0x62, 0x75, 0x29, 0xde, 0xe2, 0xbe, 0x49, 0x0c, 0xbc, 0x18, 0xba, 0x75, 0xbe, 0xbd, 0x21,
|
||||
0x6d, 0x29, 0x42, 0x98, 0x88, 0x28, 0x8d, 0xf4, 0x8a, 0x2c, 0x19, 0x00, 0x65, 0x2d, 0x06, 0x3c,
|
||||
0x78, 0xaa, 0x0a, 0x6c, 0x84, 0xf6, 0x14, 0x6a, 0x82, 0x73, 0xfb, 0xe0, 0x28, 0xe0, 0x7e, 0x91,
|
||||
0xc1, 0xb2, 0x1d, 0xde, 0xe5, 0x4d, 0x19, 0x47, 0xa9, 0x7b, 0xb1, 0x06, 0xed, 0x0c, 0x5b, 0xdc,
|
||||
0x6b, 0xb7, 0x2f, 0xfa, 0x7f, 0xc0, 0x3f, 0x6f, 0x78, 0x85, 0x66, 0xd8, 0xe3, 0x2b, 0x71, 0xc8,
|
||||
0x3b, 0xc9, 0x22, 0x9a, 0x27, 0x19, 0xfe, 0xa8, 0xa5, 0xbb, 0x07, 0x4e, 0x32, 0x3e, 0xe6, 0x3d,
|
||||
0x0d, 0xd6, 0xd3, 0xf8, 0x95, 0x89, 0xb3, 0x1c, 0x7e, 0x4c, 0xec, 0xb9, 0x61, 0x89, 0xd2, 0xf0,
|
||||
0xb7, 0xeb, 0xd3, 0x56, 0xda, 0xcb, 0x9b, 0x28, 0x9a, 0x54, 0x9a, 0xe1, 0xbf, 0x4d, 0xce, 0xbf,
|
||||
0xcf, 0xd4, 0x55, 0xf6, 0x7c, 0xb5, 0x8c, 0x73, 0x08, 0xd0, 0x8b, 0xb2, 0xb0, 0x47, 0xd2, 0xfd,
|
||||
0x91, 0x5d, 0xf2, 0xa3, 0x6a, 0xc9, 0x8f, 0x9e, 0x64, 0x2b, 0x09, 0xb8, 0xf8, 0x84, 0x33, 0xb8,
|
||||
0x4e, 0xa8, 0xb9, 0xee, 0xf8, 0x60, 0x8b, 0x76, 0x5c, 0x5e, 0x35, 0x12, 0x59, 0xe2, 0x43, 0xee,
|
||||
0xe5, 0x26, 0xdc, 0x23, 0xee, 0xed, 0x2d, 0xee, 0x29, 0x5d, 0x3b, 0x12, 0x28, 0xf0, 0x5d, 0x7b,
|
||||
0x30, 0xf7, 0xf6, 0xe4, 0x06, 0x5b, 0xc4, 0xe7, 0xd5, 0x0d, 0x24, 0x81, 0x25, 0x46, 0xd0, 0xc1,
|
||||
0x2c, 0xa5, 0xe0, 0xbb, 0xe3, 0xc3, 0xed, 0x0e, 0x68, 0xd1, 0xfc, 0x84, 0x21, 0x4b, 0x24, 0xc2,
|
||||
0x1e, 0x60, 0x97, 0xa9, 0xa1, 0x6b, 0x03, 0x87, 0x7e, 0x93, 0x4f, 0x2b, 0xab, 0xa4, 0x03, 0x0f,
|
||||
0xe9, 0x49, 0x79, 0x95, 0xbc, 0x8e, 0x4e, 0x63, 0x5c, 0xd2, 0x81, 0x87, 0xdd, 0x14, 0x40, 0x6f,
|
||||
0xed, 0xe8, 0xe6, 0x6c, 0x9d, 0x0f, 0x44, 0xb2, 0x87, 0x2d, 0x1b, 0xec, 0xb6, 0x7f, 0x30, 0xae,
|
||||
0xec, 0x61, 0xfd, 0xa2, 0x3d, 0xd0, 0xdb, 0xff, 0x63, 0x5f, 0xf3, 0x0b, 0xe2, 0x37, 0xe9, 0x1a,
|
||||
0xe9, 0xec, 0x88, 0x12, 0xbf, 0x23, 0x4b, 0x27, 0x1e, 0xfa, 0xe3, 0x46, 0xe0, 0x3b, 0xfc, 0xed,
|
||||
0x6a, 0x2e, 0xfd, 0x81, 0x28, 0x3e, 0xe7, 0xbe, 0xbb, 0xcb, 0x5e, 0xf7, 0x02, 0xb4, 0xb2, 0xad,
|
||||
0xc0, 0x32, 0x1f, 0xdf, 0xe1, 0xcd, 0x2c, 0x5a, 0xc4, 0x1b, 0x23, 0xfa, 0x3b, 0x7d, 0xe5, 0x84,
|
||||
0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, 0xca, 0xa2, 0x76, 0x34, 0xe8, 0x08, 0x00, 0x00,
|
||||
}
|
||||
134
_vendor/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/test_objects.proto
generated
vendored
134
_vendor/vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/test_objects.proto
generated
vendored
@ -1,134 +0,0 @@
|
||||
// Go support for Protocol Buffers - Google's data interchange format
|
||||
//
|
||||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// https://github.com/golang/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
import "google/protobuf/any.proto";
|
||||
import "google/protobuf/duration.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
|
||||
package jsonpb;
|
||||
|
||||
// Test message for holding primitive types.
|
||||
message Simple {
|
||||
optional bool o_bool = 1;
|
||||
optional int32 o_int32 = 2;
|
||||
optional int64 o_int64 = 3;
|
||||
optional uint32 o_uint32 = 4;
|
||||
optional uint64 o_uint64 = 5;
|
||||
optional sint32 o_sint32 = 6;
|
||||
optional sint64 o_sint64 = 7;
|
||||
optional float o_float = 8;
|
||||
optional double o_double = 9;
|
||||
optional string o_string = 10;
|
||||
optional bytes o_bytes = 11;
|
||||
}
|
||||
|
||||
// Test message for holding repeated primitives.
|
||||
message Repeats {
|
||||
repeated bool r_bool = 1;
|
||||
repeated int32 r_int32 = 2;
|
||||
repeated int64 r_int64 = 3;
|
||||
repeated uint32 r_uint32 = 4;
|
||||
repeated uint64 r_uint64 = 5;
|
||||
repeated sint32 r_sint32 = 6;
|
||||
repeated sint64 r_sint64 = 7;
|
||||
repeated float r_float = 8;
|
||||
repeated double r_double = 9;
|
||||
repeated string r_string = 10;
|
||||
repeated bytes r_bytes = 11;
|
||||
}
|
||||
|
||||
// Test message for holding enums and nested messages.
|
||||
message Widget {
|
||||
enum Color {
|
||||
RED = 0;
|
||||
GREEN = 1;
|
||||
BLUE = 2;
|
||||
};
|
||||
optional Color color = 1;
|
||||
repeated Color r_color = 2;
|
||||
|
||||
optional Simple simple = 10;
|
||||
repeated Simple r_simple = 11;
|
||||
|
||||
optional Repeats repeats = 20;
|
||||
repeated Repeats r_repeats = 21;
|
||||
}
|
||||
|
||||
message Maps {
|
||||
map<int64, string> m_int64_str = 1;
|
||||
map<bool, Simple> m_bool_simple = 2;
|
||||
}
|
||||
|
||||
message MsgWithOneof {
|
||||
oneof union {
|
||||
string title = 1;
|
||||
int64 salary = 2;
|
||||
string Country = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message Real {
|
||||
optional double value = 1;
|
||||
extensions 100 to max;
|
||||
}
|
||||
|
||||
extend Real {
|
||||
optional string name = 124;
|
||||
}
|
||||
|
||||
message Complex {
|
||||
extend Real {
|
||||
optional Complex real_extension = 123;
|
||||
}
|
||||
optional double imaginary = 1;
|
||||
extensions 100 to max;
|
||||
}
|
||||
|
||||
message KnownTypes {
|
||||
optional google.protobuf.Any an = 14;
|
||||
optional google.protobuf.Duration dur = 1;
|
||||
optional google.protobuf.Struct st = 12;
|
||||
optional google.protobuf.Timestamp ts = 2;
|
||||
|
||||
optional google.protobuf.DoubleValue dbl = 3;
|
||||
optional google.protobuf.FloatValue flt = 4;
|
||||
optional google.protobuf.Int64Value i64 = 5;
|
||||
optional google.protobuf.UInt64Value u64 = 6;
|
||||
optional google.protobuf.Int32Value i32 = 7;
|
||||
optional google.protobuf.UInt32Value u32 = 8;
|
||||
optional google.protobuf.BoolValue bool = 9;
|
||||
optional google.protobuf.StringValue str = 10;
|
||||
optional google.protobuf.BytesValue bytes = 11;
|
||||
}
|
||||
43
_vendor/vendor/github.com/golang/protobuf/proto/Makefile
generated
vendored
43
_vendor/vendor/github.com/golang/protobuf/proto/Makefile
generated
vendored
@ -1,43 +0,0 @@
|
||||
# Go support for Protocol Buffers - Google's data interchange format
|
||||
#
|
||||
# Copyright 2010 The Go Authors. All rights reserved.
|
||||
# https://github.com/golang/protobuf
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the name of Google Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
install:
|
||||
go install
|
||||
|
||||
test: install generate-test-pbs
|
||||
go test
|
||||
|
||||
|
||||
generate-test-pbs:
|
||||
make install
|
||||
make -C testdata
|
||||
protoc --go_out=Mtestdata/test.proto=github.com/golang/protobuf/proto/testdata,Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any:. proto3_proto/proto3.proto
|
||||
make
|
||||
5
_vendor/vendor/github.com/golang/protobuf/proto/decode.go
generated
vendored
5
_vendor/vendor/github.com/golang/protobuf/proto/decode.go
generated
vendored
@ -378,6 +378,11 @@ func (o *Buffer) unmarshalType(st reflect.Type, prop *StructProperties, is_group
|
||||
wire := int(u & 0x7)
|
||||
if wire == WireEndGroup {
|
||||
if is_group {
|
||||
if required > 0 {
|
||||
// Not enough information to determine the exact field.
|
||||
// (See below.)
|
||||
return &RequiredNotSetError{"{Unknown}"}
|
||||
}
|
||||
return nil // input is satisfied
|
||||
}
|
||||
return fmt.Errorf("proto: %s: wiretype end group for non-group", st)
|
||||
|
||||
14
_vendor/vendor/github.com/golang/snappy/AUTHORS
generated
vendored
14
_vendor/vendor/github.com/golang/snappy/AUTHORS
generated
vendored
@ -1,14 +0,0 @@
|
||||
# This is the official list of Snappy-Go authors for copyright purposes.
|
||||
# This file is distinct from the CONTRIBUTORS files.
|
||||
# See the latter for an explanation.
|
||||
|
||||
# Names should be added to this file as
|
||||
# Name or Organization <email address>
|
||||
# The email address is not required for organizations.
|
||||
|
||||
# Please keep the list sorted.
|
||||
|
||||
Damian Gryski <dgryski@gmail.com>
|
||||
Google Inc.
|
||||
Jan Mercl <0xjnml@gmail.com>
|
||||
Sebastien Binet <seb.binet@gmail.com>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user