mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
Merge pull request #5743 from tariq1890/rm_cockroach
remove the dependency on cockroachdb in prometheus
This commit is contained in:
commit
fc3b772342
36
go.mod
36
go.mod
|
@ -5,32 +5,14 @@ require (
|
|||
github.com/Azure/azure-sdk-for-go v23.2.0+incompatible
|
||||
github.com/Azure/go-autorest v11.2.8+incompatible
|
||||
github.com/OneOfOne/xxhash v1.2.5 // indirect
|
||||
github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f // indirect
|
||||
github.com/VividCortex/ewma v1.1.1 // indirect
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf
|
||||
github.com/aws/aws-sdk-go v1.15.24
|
||||
github.com/biogo/store v0.0.0-20160505134755-913427a1d5e8 // indirect
|
||||
github.com/cenk/backoff v2.0.0+incompatible // indirect
|
||||
github.com/certifi/gocertifi v0.0.0-20180905225744-ee1a9a0726d2 // indirect
|
||||
github.com/cespare/xxhash v1.1.0
|
||||
github.com/cockroachdb/apd v1.1.0 // indirect
|
||||
github.com/cockroachdb/cmux v0.0.0-20170110192607-30d10be49292 // indirect
|
||||
github.com/cockroachdb/cockroach v0.0.0-20170608034007-84bc9597164f
|
||||
github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c // indirect
|
||||
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd // indirect
|
||||
github.com/coreos/etcd v3.3.12+incompatible // indirect
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
|
||||
github.com/dustin/go-humanize v1.0.0 // indirect
|
||||
github.com/elastic/gosigar v0.9.0 // indirect
|
||||
github.com/elazarl/go-bindata-assetfs v1.0.0 // indirect
|
||||
github.com/evanphx/json-patch v4.1.0+incompatible // indirect
|
||||
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect
|
||||
github.com/getsentry/raven-go v0.1.2 // indirect
|
||||
github.com/go-kit/kit v0.8.0
|
||||
github.com/go-logfmt/logfmt v0.4.0
|
||||
github.com/go-ole/go-ole v1.2.4 // indirect
|
||||
github.com/go-openapi/strfmt v0.19.0
|
||||
github.com/go-sql-driver/mysql v1.4.1 // indirect
|
||||
github.com/gogo/protobuf v1.2.1
|
||||
github.com/golang/groupcache v0.0.0-20180924190550-6f2cf27854a4 // indirect
|
||||
github.com/golang/snappy v0.0.1
|
||||
|
@ -40,43 +22,25 @@ require (
|
|||
github.com/gophercloud/gophercloud v0.0.0-20190301152420-fca40860790e
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.8.5
|
||||
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
|
||||
github.com/hashicorp/consul/api v1.1.0
|
||||
github.com/hashicorp/go-msgpack v0.5.4 // indirect
|
||||
github.com/hashicorp/golang-lru v0.5.1 // indirect
|
||||
github.com/influxdata/influxdb v0.0.0-20170331210902-15e594fc09f1
|
||||
github.com/jackc/fake v0.0.0-20150926172116-812a484cc733 // indirect
|
||||
github.com/jackc/pgx v3.2.0+incompatible // indirect
|
||||
github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7 // indirect
|
||||
github.com/json-iterator/go v1.1.6
|
||||
github.com/jtolds/gls v4.2.1+incompatible // indirect
|
||||
github.com/knz/strtime v0.0.0-20181018220328-af2256ee352c // indirect
|
||||
github.com/lib/pq v1.0.0 // indirect
|
||||
github.com/lightstep/lightstep-tracer-go v0.15.6 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.4 // indirect
|
||||
github.com/miekg/dns v1.1.10
|
||||
github.com/mitchellh/reflectwalk v1.0.1 // indirect
|
||||
github.com/montanaflynn/stats v0.0.0-20180911141734-db72e6cae808 // indirect
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223
|
||||
github.com/oklog/run v1.0.0
|
||||
github.com/olekukonko/tablewriter v0.0.1 // indirect
|
||||
github.com/opentracing-contrib/go-stdlib v0.0.0-20170113013457-1de4cc2120e7
|
||||
github.com/opentracing/basictracer-go v1.0.0 // indirect
|
||||
github.com/opentracing/opentracing-go v1.0.2
|
||||
github.com/peterbourgon/g2s v0.0.0-20170223122336-d4e7ad98afea // indirect
|
||||
github.com/petermattis/goid v0.0.0-20170504144140-0ded85884ba5 // indirect
|
||||
github.com/pkg/errors v0.8.1
|
||||
github.com/prometheus/alertmanager v0.17.0
|
||||
github.com/prometheus/client_golang v1.0.0
|
||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90
|
||||
github.com/prometheus/common v0.4.1
|
||||
github.com/prometheus/tsdb v0.9.1
|
||||
github.com/rlmcpherson/s3gof3r v0.5.0 // indirect
|
||||
github.com/rubyist/circuitbreaker v2.2.1+incompatible // indirect
|
||||
github.com/samuel/go-zookeeper v0.0.0-20161028232340-1d7be4effb13
|
||||
github.com/sasha-s/go-deadlock v0.0.0-20161201235124-341000892f3d // indirect
|
||||
github.com/satori/go.uuid v1.2.0 // indirect
|
||||
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24 // indirect
|
||||
github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371
|
||||
github.com/shurcooL/vfsgen v0.0.0-20180825020608-02ddb050ef6b
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect
|
||||
|
|
72
go.sum
72
go.sum
|
@ -19,10 +19,6 @@ github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV
|
|||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
||||
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
|
||||
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
|
||||
github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f h1:5ZfJxyXo8KyX8DgGXC5B7ILL8y51fci/qYz2B4j8iLY=
|
||||
github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
|
||||
github.com/VividCortex/ewma v1.1.1 h1:MnEK4VOv6n0RSY4vtRe3h11qjxL3+t0B8yOL8iMXdcM=
|
||||
github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY=
|
||||
|
@ -41,31 +37,13 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
|
|||
github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0=
|
||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||
github.com/biogo/store v0.0.0-20160505134755-913427a1d5e8 h1:tYoz1OeRpx3dJZlh9T4dQt4kAndcmpl+VNdzbSgFC/0=
|
||||
github.com/biogo/store v0.0.0-20160505134755-913427a1d5e8/go.mod h1:Iev9Q3MErcn+w3UOJD/DkEzllvugfdx7bGcMOFhvr/4=
|
||||
github.com/cenk/backoff v2.0.0+incompatible h1:7vXVw3g7XE+Vnj0A9TmFGtMeP4oZQ5ZzpPvKhLFa80E=
|
||||
github.com/cenk/backoff v2.0.0+incompatible/go.mod h1:7FtoeaSnHoZnmZzz47cM35Y9nSW7tNyaidugnHTaFDE=
|
||||
github.com/cenkalti/backoff v0.0.0-20181003080854-62661b46c409/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.0 h1:LzQXZOgg4CQfE6bFvXGM30YZL1WW/M337pXml+GrcZ4=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/certifi/gocertifi v0.0.0-20180905225744-ee1a9a0726d2 h1:MmeatFT1pTPSVb4nkPmBFN/LRZ97vPjsFKsZrU3KKTs=
|
||||
github.com/certifi/gocertifi v0.0.0-20180905225744-ee1a9a0726d2/go.mod h1:GJKEexRPVJrBSOjoqN5VNOIKJ5Q3RViH6eu3puDRwx4=
|
||||
github.com/cespare/xxhash v0.0.0-20181017004759-096ff4a8a059/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
||||
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
|
||||
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
|
||||
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
|
||||
github.com/cockroachdb/cmux v0.0.0-20170110192607-30d10be49292 h1:dzj1/xcivGjNPwwifh/dWTczkwcuqsXXFHY1X/TZMtw=
|
||||
github.com/cockroachdb/cmux v0.0.0-20170110192607-30d10be49292/go.mod h1:qRiX68mZX1lGBkTWyp3CLcenw9I94W2dLeRvMzcn9N4=
|
||||
github.com/cockroachdb/cockroach v0.0.0-20170608034007-84bc9597164f h1:0FHGBrsIyDci8tF7zujQkHdMTJdCTSIV9esrni2fKQI=
|
||||
github.com/cockroachdb/cockroach v0.0.0-20170608034007-84bc9597164f/go.mod h1:xeT/CQ0qZHangbYbWShlCGAx31aV4AjGswDUjhKS6HQ=
|
||||
github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c h1:2zRrJWIt/f9c9HhNHAgrRgq0San5gRRUJTBXLkchal0=
|
||||
github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk=
|
||||
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd h1:qMd81Ts1T2OTKmB4acZcyKaMtRnY5Y44NuXGX2GFJ1w=
|
||||
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
|
||||
github.com/coreos/etcd v3.3.12+incompatible h1:pAWNwdf7QiT1zfaWyqCtNZQWCLByQyA3JrSQyuYAqnQ=
|
||||
github.com/coreos/etcd v3.3.12+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
|
@ -73,24 +51,14 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumC
|
|||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
|
||||
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
||||
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
|
||||
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
|
||||
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
|
||||
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
|
||||
github.com/elastic/gosigar v0.9.0 h1:ehdJWCzrtTHhYDmUAO6Zpu+uez4UB/dhH0oJSQ/o1Pk=
|
||||
github.com/elastic/gosigar v0.9.0/go.mod h1:cdorVVzy1fhmEqmtgqkoE3bYtCfSCkVyjTyCIo22xvs=
|
||||
github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk=
|
||||
github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
|
||||
github.com/evanphx/json-patch v4.1.0+incompatible h1:K1MDoo4AZ4wU0GIU/fPmtZg7VpzLjCxu+UwBD1FvwOc=
|
||||
github.com/evanphx/json-patch v4.1.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
|
||||
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a h1:yDWHCSQ40h88yih2JAcL6Ls/kVkSE8GFACTGVnMPruw=
|
||||
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a/go.mod h1:7Ga40egUymuWXxAe151lTNnCv97MddSOVsjpPPkityA=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/getsentry/raven-go v0.1.2 h1:4V0z512S5mZXiBvmW2RbuZBSIY1sEdMNsPjpx2zwtSE=
|
||||
github.com/getsentry/raven-go v0.1.2/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ=
|
||||
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
|
||||
|
@ -103,8 +71,6 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2
|
|||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||
github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA=
|
||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI=
|
||||
github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
|
||||
github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI=
|
||||
github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik=
|
||||
github.com/go-openapi/analysis v0.17.2 h1:eYp14J1o8TTSCzndHBtsNuckikV1PfZOSnx4BcBeu0c=
|
||||
|
@ -136,8 +102,6 @@ github.com/go-openapi/swag v0.17.2 h1:K/ycE/XTUDFltNHSO32cGRUhrVGJD64o8WgAIZNyc3
|
|||
github.com/go-openapi/swag v0.17.2/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg=
|
||||
github.com/go-openapi/validate v0.17.2 h1:lwFfiS4sv5DvOrsYDsYq4N7UU8ghXiYtPJ+VcQnC3Xg=
|
||||
github.com/go-openapi/validate v0.17.2/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4=
|
||||
github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA=
|
||||
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
|
@ -178,8 +142,6 @@ github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51
|
|||
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.8.5 h1:2+KSC78XiO6Qy0hIjfc1OD9H+hsaJdJlb8Kqsd41CTE=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
|
||||
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 h1:MJG/KsmcqMwFAkh8mTnAwhyKoB+sTAnY4CACC110tbU=
|
||||
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw=
|
||||
github.com/hashicorp/consul/api v1.1.0 h1:BNQPM9ytxj6jbjjdRPioQ94T6YXriSopn0i8COv6SRA=
|
||||
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
|
||||
github.com/hashicorp/consul/sdk v0.1.1 h1:LnuDWGNsoajlhGyHJvuWW6FVqRl8JOTPqS6CPTsYjhY=
|
||||
|
@ -221,10 +183,6 @@ github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
|||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/influxdata/influxdb v0.0.0-20170331210902-15e594fc09f1 h1:O08dwjOwv9CYlJJEUZKAazSoQDKlsN34Bq3dnhqhyVI=
|
||||
github.com/influxdata/influxdb v0.0.0-20170331210902-15e594fc09f1/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY=
|
||||
github.com/jackc/fake v0.0.0-20150926172116-812a484cc733 h1:vr3AYkKovP8uR8AvSGGUK1IDqRa5lAAvEkZG1LKaCRc=
|
||||
github.com/jackc/fake v0.0.0-20150926172116-812a484cc733/go.mod h1:WrMFNQdiFJ80sQsxDoMokWK1W5TQtxBFNpzWTD84ibQ=
|
||||
github.com/jackc/pgx v3.2.0+incompatible h1:0Vihzu20St42/UDsvZGdNE6jak7oi/UOeMzwMPHkgFY=
|
||||
github.com/jackc/pgx v3.2.0+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGkVEFm4TeybAXq+I=
|
||||
github.com/jessevdk/go-flags v0.0.0-20180331124232-1c38ed7ad0cc/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
||||
github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7 h1:SMvOWPJCES2GdFracYbBQh93GXac8fq7HeN6JnpduB8=
|
||||
|
@ -237,8 +195,6 @@ github.com/julienschmidt/httprouter v1.2.0 h1:TDTW5Yz1mjftljbcKqRcrYhd4XeOoI98t+
|
|||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/knz/strtime v0.0.0-20181018220328-af2256ee352c h1:45aLE1GlZRKxNfTMkok85BUKAJNLdHr5GAm3h8Fqoww=
|
||||
github.com/knz/strtime v0.0.0-20181018220328-af2256ee352c/go.mod h1:4ZxfWkxwtc7dBeifERVVWRy9F9rTU9p0yCDgeCtlius=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
|
@ -248,16 +204,10 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
|||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kylelemons/godebug v0.0.0-20160406211939-eadb3ce320cb/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
|
||||
github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A=
|
||||
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/lightstep/lightstep-tracer-go v0.15.6 h1:D0GGa7afJ7GcQvu5as6ssLEEKYXvRgKI5d5cevtz8r4=
|
||||
github.com/lightstep/lightstep-tracer-go v0.15.6/go.mod h1:6AMpwZpsyCFwSovxzM78e+AsYxE8sGwiM6C3TytaWeI=
|
||||
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic=
|
||||
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=
|
||||
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||
|
@ -274,14 +224,10 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu
|
|||
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/mitchellh/reflectwalk v1.0.1 h1:FVzMWA5RllMAKIdUSC8mdWo3XtwoecrH79BY70sEEpE=
|
||||
github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/montanaflynn/stats v0.0.0-20180911141734-db72e6cae808 h1:pmpDGKLw4n82EtrNiLqB+xSz/JQwFOaZuMALYUHwX5s=
|
||||
github.com/montanaflynn/stats v0.0.0-20180911141734-db72e6cae808/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223 h1:F9x/1yl3T2AeKLr2AMdilSD8+f9bvMnNN8VS5iDtovc=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw=
|
||||
|
@ -289,8 +235,6 @@ github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQ
|
|||
github.com/oklog/ulid v0.0.0-20170117200651-66bb6560562f/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
||||
github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=
|
||||
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
||||
github.com/olekukonko/tablewriter v0.0.1 h1:b3iUnf1v+ppJiOfNX4yxxqfWKMQPZR5yoh8urCTFX88=
|
||||
github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
||||
github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
|
||||
|
@ -299,18 +243,12 @@ github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
|
|||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/opentracing-contrib/go-stdlib v0.0.0-20170113013457-1de4cc2120e7 h1:8KbikWulLUcMM96hBxjgoo6gTmCkG6HYSDohv/WygYU=
|
||||
github.com/opentracing-contrib/go-stdlib v0.0.0-20170113013457-1de4cc2120e7/go.mod h1:PLldrQSroqzH70Xl+1DQcGnefIbqsKR7UDaiux3zV+w=
|
||||
github.com/opentracing/basictracer-go v1.0.0 h1:YyUAhaEfjoWXclZVJ9sGoNct7j4TVk7lZWlQw5UXuoo=
|
||||
github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74=
|
||||
github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg=
|
||||
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c h1:Lgl0gzECD8GnQ5QCWA8o6BtfL6mDH5rQgM4/fX3avOs=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
|
||||
github.com/peterbourgon/g2s v0.0.0-20170223122336-d4e7ad98afea h1:sKwxy1H95npauwu8vtF95vG/syrL0p8fSZo/XlDg5gk=
|
||||
github.com/peterbourgon/g2s v0.0.0-20170223122336-d4e7ad98afea/go.mod h1:1VcHEd3ro4QMoHfiNl/j7Jkln9+KQuorp0PItHMJYNg=
|
||||
github.com/petermattis/goid v0.0.0-20170504144140-0ded85884ba5 h1:rUMC+oZ89Om6l9wvUNjzI0ZrKrSnXzV+opsgAohYUNc=
|
||||
github.com/petermattis/goid v0.0.0-20170504144140-0ded85884ba5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o=
|
||||
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
|
@ -348,25 +286,15 @@ github.com/prometheus/tsdb v0.9.1 h1:IWaAmWkYlgG7/S4iw4IpAQt5Y35QaZM6/GsZ7GsjAuk
|
|||
github.com/prometheus/tsdb v0.9.1/go.mod h1:oi49uRhEe9dPUTlS3JRZOwJuVi6tmh10QSgwXEyGCt4=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a h1:9ZKAASQSHhDYGoxY8uLVpewe1GDZ2vu2Tr/vTdVAkFQ=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/rlmcpherson/s3gof3r v0.5.0 h1:1izOJpTiohSibfOHuNyEA/yQnAirh05enzEdmhez43k=
|
||||
github.com/rlmcpherson/s3gof3r v0.5.0/go.mod h1:s7vv7SMDPInkitQMuZzH615G7yWHdrU2r/Go7Bo71Rs=
|
||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||
github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
|
||||
github.com/rubyist/circuitbreaker v2.2.1+incompatible h1:KUKd/pV8Geg77+8LNDwdow6rVCAYOp8+kHUyFvL6Mhk=
|
||||
github.com/rubyist/circuitbreaker v2.2.1+incompatible/go.mod h1:Ycs3JgJADPuzJDwffe12k6BZT8hxVi6lFK+gWYJLN4A=
|
||||
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||
github.com/samuel/go-zookeeper v0.0.0-20161028232340-1d7be4effb13 h1:4AQBn5RJY4WH8t8TLEMZUsWeXHAUcoao42TCAfpEJJE=
|
||||
github.com/samuel/go-zookeeper v0.0.0-20161028232340-1d7be4effb13/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
|
||||
github.com/sasha-s/go-deadlock v0.0.0-20161201235124-341000892f3d h1:yVBZEAirqhDYAc7xftf/swe8eHcg63jqfwdqN8KSoR8=
|
||||
github.com/sasha-s/go-deadlock v0.0.0-20161201235124-341000892f3d/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10=
|
||||
github.com/satori/go.uuid v0.0.0-20160603004225-b111a074d5ef/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
|
||||
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I=
|
||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
||||
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24 h1:pntxY8Ary0t43dCZ5dqY4YTJCObLY1kIXl0uzMv+7DE=
|
||||
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
|
||||
github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371 h1:SWV2fHctRpRrp49VXJ6UZja7gU9QLHwRpIPBN89SKEo=
|
||||
github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
|
||||
github.com/shurcooL/vfsgen v0.0.0-20180825020608-02ddb050ef6b h1:rKVW5h3pEu8gGxD+ZlOmBvFYAxXLCYeQv/eg+t6QvLQ=
|
||||
|
|
419
vendor/github.com/cockroachdb/cockroach/LICENSE
generated
vendored
419
vendor/github.com/cockroachdb/cockroach/LICENSE
generated
vendored
|
@ -1,419 +0,0 @@
|
|||
CockroachDB Community License Agreement
|
||||
|
||||
Please read this CockroachDB Community License Agreement (the "Agreement")
|
||||
carefully before using CockroachDB (as defined below), which is offered by
|
||||
Cockroach Labs, Inc. or its affiliated Legal Entities ("Cockroach Labs").
|
||||
|
||||
By downloading CockroachDB or using it in any manner, You agree that You have
|
||||
read and agree to be bound by the terms of this Agreement. If You are
|
||||
accessing CockroachDB on behalf of a Legal Entity, You represent and warrant
|
||||
that You have the authority to agree to these terms on its behalf and the
|
||||
right to bind that Legal Entity to this Agreement. Use of CockroachDB is
|
||||
expressly conditioned upon Your assent to all the terms of this Agreement, to
|
||||
the exclusion of all other terms.
|
||||
|
||||
1. Definitions. In addition to other terms defined elsewhere in this
|
||||
Agreement, the terms below have the following meanings.
|
||||
|
||||
(a) "CockroachDB" shall mean the SQL database software provided by Cockroach
|
||||
Labs, including both CockroachDB Community and CockroachDB Enterprise
|
||||
editions, as defined below.
|
||||
|
||||
(b) "CockroachDB Community Edition" shall mean the open source version of
|
||||
CockroachDB, available free of charge at
|
||||
|
||||
https://github.com/cockroachdb/cockroach
|
||||
|
||||
(c) "CockroachDB Enterprise Edition" shall mean the additional features made
|
||||
available by Cockroach Labs, the use of which is subject to additional
|
||||
terms set out below.
|
||||
|
||||
(d) "Contribution" shall mean any work of authorship, including the original
|
||||
version of the Work and any modifications or additions to that Work or
|
||||
Derivative Works thereof, that is intentionally submitted Cockroach Labs
|
||||
for inclusion in the Work by the copyright owner or by an individual or
|
||||
Legal Entity authorized to submit on behalf of the copyright owner. For
|
||||
the purposes of this definition, "submitted" means any form of
|
||||
electronic, verbal, or written communication sent to Cockroach Labs or
|
||||
its representatives, including but not limited to communication on
|
||||
electronic mailing lists, source code control systems, and issue
|
||||
tracking systems that are managed by, or on behalf of, Cockroach Labs
|
||||
for the purpose of discussing and improving the Work, but excluding
|
||||
communication that is conspicuously marked or otherwise designated in
|
||||
writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
(e) "Contributor" shall mean any copyright owner or individual or Legal
|
||||
Entity authorized by the copyright owner, other than Cockroach Labs,
|
||||
from whom Cockroach Labs receives a Contribution that Cockroach Labs
|
||||
subsequently incorporates within the Work.
|
||||
|
||||
(f) "Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work, such as a
|
||||
translation, abridgement, condensation, or any other recasting,
|
||||
transformation, or adaptation for which the editorial revisions,
|
||||
annotations, elaborations, or other modifications represent, as a whole,
|
||||
an original work of authorship. For the purposes of this License,
|
||||
Derivative Works shall not include works that remain separable from, or
|
||||
merely link (or bind by name) to the interfaces of, the Work and
|
||||
Derivative Works thereof.
|
||||
|
||||
(g) "Legal Entity" shall mean the union of the acting entity and all other
|
||||
entities that control, are controlled by, or are under common control
|
||||
with that entity. For the purposes of this definition, "control" means
|
||||
(i) the power, direct or indirect, to cause the direction or management
|
||||
of such entity, whether by contract or otherwise, or (ii) ownership of
|
||||
fifty percent (50%) or more of the outstanding shares, or (iii)
|
||||
beneficial ownership of such entity.
|
||||
|
||||
(h) "License" shall mean the terms and conditions for use, reproduction, and
|
||||
distribution of a Work as defined by this Agreement.
|
||||
|
||||
(i) "Licensor" shall mean Cockroach Labs or a Contributor, as applicable.
|
||||
|
||||
(j) "Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but not
|
||||
limited to compiled object code, generated documentation, and
|
||||
conversions to other media types.
|
||||
|
||||
(k) "Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation source,
|
||||
and configuration files.
|
||||
|
||||
(l) "Third Party Works" shall mean Works, including Contributions, and other
|
||||
technology owned by a person or Legal Entity other than Cockroach Labs,
|
||||
as indicated by a copyright notice that is included in or attached to
|
||||
such Works or technology.
|
||||
|
||||
(m) "Work" shall mean the work of authorship, whether in Source or Object
|
||||
form, made available under a License, as indicated by a copyright notice
|
||||
that is included in or attached to the work.
|
||||
|
||||
(n) "You" (or "Your") shall mean an individual or Legal Entity exercising
|
||||
permissions granted by this License.
|
||||
|
||||
2. Licenses.
|
||||
|
||||
(a) License to CockroachDB Community Edition. The License for CockroachDB
|
||||
Community Edition is the Apache License, Version 2.0 ("Apache License").
|
||||
The Apache License includes a grant of patent license, as well as
|
||||
redistribution rights that are contingent on several requirements.
|
||||
Please see
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
for full terms. CockroachDB Community Edition is a no-cost, entry-level
|
||||
license and as such, contains the following disclaimers: NOTWITHSTANDING
|
||||
ANYTHING TO THE CONTRARY HEREIN, COCKROACHDB COMMUNITY EDITION IS
|
||||
PROVIDED "AS IS" AND "AS AVAILABLE", AND ALL EXPRESS OR IMPLIED
|
||||
WARRANTIES ARE EXCLUDED AND DISCLAIMED, INCLUDING WITHOUT LIMITATION THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
NON-INFRINGEMENT, AND ANY WARRANTIES ARISING BY STATUTE OR OTHERWISE IN
|
||||
LAW OR FROM COURSE OF DEALING, COURSE OF PERFORMANCE, OR USE IN TRADE.
|
||||
For clarity, the terms of this Agreement, other than the relevant
|
||||
definitions in Section 1 and this Section 2(a) do not apply to
|
||||
CockroachDB Community Edition.
|
||||
|
||||
(b) License to CockroachDB Enterprise Edition.
|
||||
|
||||
i Grant of Copyright License: Subject to the terms of this Agreement,
|
||||
Licensor hereby grants to You a worldwide, non-exclusive,
|
||||
non-transferable limited license to reproduce, prepare Enterprise
|
||||
Derivative Works (as defined below) of, publicly display, publicly
|
||||
perform, sublicense, and distribute CockroachDB Enterprise Edition
|
||||
for Your business purposes, for so long as You are not in violation
|
||||
of this Section 2(b) and are current on all payments required by
|
||||
Section 4 below.
|
||||
|
||||
ii Grant of Patent License: Subject to the terms of this Agreement,
|
||||
Licensor hereby grants to You a worldwide, non-exclusive,
|
||||
non-transferable limited patent license to make, have made, use,
|
||||
offer to sell, sell, import, and otherwise transfer CockroachDB
|
||||
Enterprise Edition, where such license applies only to those patent
|
||||
claims licensable by Licensor that are necessarily infringed by
|
||||
their Contribution(s) alone or by combination of their
|
||||
Contribution(s) with the Work to which such Contribution(s) was
|
||||
submitted. If You institute patent litigation against any entity
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
the Work or a Contribution incorporated within the Work constitutes
|
||||
direct or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate as
|
||||
of the date such litigation is filed.
|
||||
|
||||
iii License to Third Party Works: From time to time Cockroach Labs may
|
||||
use, or provide You access to, Third Party Works in connection
|
||||
CockroachDB Enterprise Edition. You acknowledge and agree that in
|
||||
addition to this Agreement, Your use of Third Party Works is subject
|
||||
to all other terms and conditions set forth in the License provided
|
||||
with or contained in such Third Party Works. Some Third Party Works
|
||||
may be licensed to You solely for use with CockroachDB Enterprise
|
||||
Edition under the terms of a third party License, or as otherwise
|
||||
notified by Cockroach Labs, and not under the terms of this
|
||||
Agreement. You agree that the owners and third party licensors of
|
||||
Third Party Works are intended third party beneficiaries to this
|
||||
Agreement.
|
||||
|
||||
3. Support. From time to time, in its sole discretion, Cockroach Labs may
|
||||
offer professional services or support for CockroachDB, which may now or in
|
||||
the future be subject to additional fees.
|
||||
|
||||
4. Fees for CockroachDB Enterprise Edition or CockroachDB Support.
|
||||
|
||||
(a) Fees. The License to CockroachDB Enterprise Edition is conditioned upon
|
||||
Your payment of the fees specified on
|
||||
|
||||
https://cockroachlabs.com/pricing
|
||||
|
||||
which You agree to pay to Cockroach Labs in accordance with the payment
|
||||
terms set out on that page. Any professional services or support for
|
||||
CockroachDB may also be subject to Your payment of fees, which will be
|
||||
specified by Cockroach Labs when you sign up to receive such
|
||||
professional services or support. Cockroach Labs reserves the right to
|
||||
change the fees at any time with prior written notice; for recurring
|
||||
fees, any such adjustments will take effect as of the next pay period.
|
||||
|
||||
(b) Overdue Payments and Taxes. Overdue payments are subject to a service
|
||||
charge equal to the lesser of 1.5% per month or the maximum legal
|
||||
interest rate allowed by law, and You shall pay all Cockroach Labs’
|
||||
reasonable costs of collection, including court costs and attorneys’
|
||||
fees. Fees are stated and payable in U.S. dollars and are exclusive of
|
||||
all sales, use, value added and similar taxes, duties, withholdings and
|
||||
other governmental assessments (but excluding taxes based on Cockroach
|
||||
Labs’ income) that may be levied on the transactions contemplated by
|
||||
this Agreement in any jurisdiction, all of which are Your responsibility
|
||||
unless you have provided Cockroach Labs with a valid tax-exempt
|
||||
certificate.
|
||||
|
||||
(c) Record-keeping and Audit. If fees for CockroachDB Enterprise Edition
|
||||
are based on the number of cores or servers running on CockroachDB
|
||||
Enterprise Edition or another use-based unit of measurement, You must
|
||||
maintain complete and accurate records with respect to Your use of
|
||||
CockroachDB Enterprise Edition and will provide such records to
|
||||
Cockroach Labs for inspection or audit upon Cockroach Labs’ reasonable
|
||||
request. If an inspection or audit uncovers additional usage by You for
|
||||
which fees are owed under this Agreement, then You shall pay for such
|
||||
additional usage at Cockroach Labs’ then-current rates.
|
||||
|
||||
5. Trial License. If You have signed up for a trial or evaluation of
|
||||
CockroachDB Enterprise Edition, Your License to CockroachDB Enterprise
|
||||
Edition is granted without charge for the trial or evaluation period
|
||||
specified when You signed up, or if no term was specified, for thirty (30)
|
||||
calendar days, provided that Your License is granted solely for purposes of
|
||||
Your internal evaluation of CockroachDB Enterprise Edition during the trial
|
||||
or evaluation period (a "Trial License"). You may not use CockroachDB
|
||||
Enterprise Edition under a Trial License more than once in any twelve (12)
|
||||
month period. Cockroach Labs may revoke a Trial License at any time and
|
||||
for any reason. Sections 3, 4, 9 and 11 of this Agreement do not apply to
|
||||
Trial Licenses.
|
||||
|
||||
6. Redistribution. You may reproduce and distribute copies of the Work or
|
||||
Derivative Works thereof in any medium, with or without modifications, and
|
||||
in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or Derivative Works a
|
||||
copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices stating
|
||||
that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works that You
|
||||
distribute, all copyright, patent, trademark, and attribution notices
|
||||
from the Source form of the Work, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its distribution,
|
||||
then any Derivative Works that You distribute must include a readable
|
||||
copy of the attribution notices contained within such NOTICE file,
|
||||
excluding those notices that do not pertain to any part of the
|
||||
Derivative Works, in at least one of the following places: within a
|
||||
NOTICE text file distributed as part of the Derivative Works; within the
|
||||
Source form or documentation, if provided along with the Derivative
|
||||
Works; or, within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents of the
|
||||
NOTICE file are for informational purposes only and do not modify the
|
||||
License. You may add Your own attribution notices within Derivative
|
||||
Works that You distribute, alongside or as an addendum to the NOTICE
|
||||
text from the Work, provided that such additional attribution notices
|
||||
cannot be construed as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may
|
||||
provide additional or different license terms and conditions for use,
|
||||
reproduction, or distribution of Your modifications, or for any such
|
||||
Derivative Works as a whole, provided Your use, reproduction, and
|
||||
distribution of the Work otherwise complies with the conditions stated
|
||||
in this License.
|
||||
|
||||
(e) Enterprise Derivative Works: Derivative Works of CockroachDB Enterprise
|
||||
Edition ("Enterprise Derivative Works") may be made, reproduced and
|
||||
distributed in any medium, with or without modifications, in Source or
|
||||
Object form, provided that each Enterprise Derivative Work will be
|
||||
considered to include a License to CockroachDB Enterprise Edition and
|
||||
thus will be subject to the payment of fees to Cockroach Labs by any
|
||||
user of the Enterprise Derivative Work.
|
||||
|
||||
7. Submission of Contributions. Unless You explicitly state otherwise, any
|
||||
Contribution intentionally submitted for inclusion in CockroachDB by You to
|
||||
Cockroach Labs shall be under the terms and conditions of
|
||||
|
||||
https://cla-assistant.io/cockroachdb/cockroach
|
||||
|
||||
(which is based off of the Apache License), without any additional terms or
|
||||
conditions, payments of royalties or otherwise to Your benefit.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify the
|
||||
terms of any separate license agreement You may have executed with
|
||||
Cockroach Labs regarding such Contributions.
|
||||
|
||||
8. Trademarks. This License does not grant permission to use the trade names,
|
||||
trademarks, service marks, or product names of Licensor, except as required
|
||||
for reasonable and customary use in describing the origin of the Work and
|
||||
reproducing the content of the NOTICE file.
|
||||
|
||||
9. Limited Warranty.
|
||||
|
||||
(a) Warranties. Cockroach Labs warrants to You that: (i) CockroachDB
|
||||
Enterprise Edition will materially perform in accordance with the
|
||||
applicable documentation for ninety (90) days after initial delivery to
|
||||
You; and (ii) any professional services performed by Cockroach Labs
|
||||
under this Agreement will be performed in a workmanlike manner, in
|
||||
accordance with general industry standards.
|
||||
|
||||
(b) Exclusions. Cockroach Labs’ warranties in this Section 9 do not extend
|
||||
to problems that result from: (i) Your failure to implement updates
|
||||
issued by Cockroach Labs during the warranty period; (ii) any
|
||||
alterations or additions (including Enterprise Derivative Works and
|
||||
Contributions) to CockroachDB not performed by or at the direction of
|
||||
Cockroach Labs; (iii) failures that are not reproducible by Cockroach
|
||||
Labs; (iv) operation of CockroachDB Enterprise Edition in violation of
|
||||
this Agreement or not in accordance with its documentation; (v) failures
|
||||
caused by software, hardware or products not licensed or provided by
|
||||
Cockroach Labs hereunder; or (vi) Third Party Works.
|
||||
|
||||
(c) Remedies. In the event of a breach of a warranty under this Section 9,
|
||||
Cockroach Labs will, at its discretion and cost, either repair, replace
|
||||
or re-perform the applicable Works or services or refund a portion of
|
||||
fees previously paid to Cockroach Labs that are associated with the
|
||||
defective Works or services. This is Your exclusive remedy, and
|
||||
Cockroach Labs’ sole liability, arising in connection with the limited
|
||||
warranties herein.
|
||||
|
||||
10. Disclaimer of Warranty. Except as set out in Section 9, unless required
|
||||
by applicable law, Licensor provides the Work (and each Contributor
|
||||
provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied, arising out of course
|
||||
of dealing, course of performance, or usage in trade, including, without
|
||||
limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
|
||||
MERCHANTABILITY, CORRECTNESS, RELIABILITY, or FITNESS FOR A PARTICULAR
|
||||
PURPOSE, all of which are hereby disclaimed. You are solely responsible
|
||||
for determining the appropriateness of using or redistributing Works and
|
||||
assume any risks associated with Your exercise of permissions under the
|
||||
applicable License for such Works.
|
||||
|
||||
11. Limited Indemnity.
|
||||
|
||||
(a) Indemnity. Cockroach Labs will defend, indemnify and hold You harmless
|
||||
against any third party claims, liabilities or expenses incurred
|
||||
(including reasonable attorneys’ fees), as well as amounts finally
|
||||
awarded in a settlement or a non-appealable judgement by a court
|
||||
("Losses"), to the extent arising from any claim or allegation by a
|
||||
third party that CockroachDB Enterprise Edition infringes or
|
||||
misappropriates a valid United States patent, copyright or trade secret
|
||||
right of a third party; provided that You give Cockroach Labs: (i)
|
||||
prompt written notice of any such claim or allegation; (ii) sole control
|
||||
of the defense and settlement thereof; and (iii) reasonable cooperation
|
||||
and assistance in such defense or settlement. If any Work within
|
||||
CockroachDB Enterprise Edition becomes or, in Cockroach Labs’ opinion,
|
||||
is likely to become, the subject of an injunction, Cockroach Labs may,
|
||||
at its option, (A) procure for You the right to continue using such
|
||||
Work, (B) replace or modify such Work so that it becomes non-infringing
|
||||
without substantially compromising its functionality, or, if (A) and (B)
|
||||
are not commercially practicable, then (C) terminate Your license to the
|
||||
allegedly infringing Work and refund to You a prorated portion of the
|
||||
prepaid and unearned fees for such infringing Work. The foregoing
|
||||
states the entire liability of Cockroach Labs with respect to
|
||||
infringement of patents, copyrights, trade secrets or other intellectual
|
||||
property rights.
|
||||
|
||||
(b) Exclusions. The foregoing obligations shall not apply to: (i) Works
|
||||
modified by any party other than Cockroach Labs (including Enterprise
|
||||
Derivative Works and Contributions), if the alleged infringement relates
|
||||
to such modification, (ii) Works combined or bundled with any products,
|
||||
processes or materials not provided by Cockroach Labs where the alleged
|
||||
infringement relates to such combination, (iii) use of a version of
|
||||
CockroachDB Enterprise Edition other than the version that was current
|
||||
at the time of such use, as long as a non-infringing version had been
|
||||
released, (iv) any Works created to Your specifications, (v)
|
||||
infringement or misappropriation of any proprietary right in which You
|
||||
have an interest, or (vi) Third Party Works. You will defend, indemnify
|
||||
and hold Cockroach Labs harmless against any Losses arising from any
|
||||
such claim or allegation, subject to conditions reciprocal to those in
|
||||
Section 11(a).
|
||||
|
||||
12. Limitation of Liability. In no event and under no legal or equitable
|
||||
theory, whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts), and notwithstanding anything in this Agreement to the
|
||||
contrary, shall Licensor or any Contributor be liable to You for (i) any
|
||||
amounts in excess, in the aggregate, of the fees paid by You to Cockroach
|
||||
Labs under this Agreement in the twelve (12) months preceding the date the
|
||||
first cause of liability arose), or (ii) any indirect, special,
|
||||
incidental, punitive, exemplary, reliance, or consequential damages of any
|
||||
character arising as a result of this Agreement or out of the use or
|
||||
inability to use the Work (including but not limited to damages for loss
|
||||
of goodwill, profits, data or data use, work stoppage, computer failure or
|
||||
malfunction, cost of procurement of substitute goods, technology or
|
||||
services, or any and all other commercial damages or losses), even if such
|
||||
Licensor or Contributor has been advised of the possibility of such
|
||||
damages. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE
|
||||
ESSENTIAL PURPOSE OF ANY LIMITED REMEDY.
|
||||
|
||||
13. Accepting Warranty or Additional Liability. While redistributing Works or
|
||||
Derivative Works thereof, and without limiting your obligations under
|
||||
Section 6, You may choose to offer, and charge a fee for, acceptance of
|
||||
support, warranty, indemnity, or other liability obligations and/or rights
|
||||
consistent with this License. However, in accepting such obligations, You
|
||||
may act only on Your own behalf and on Your sole responsibility, not on
|
||||
behalf of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold Cockroach Labs and each other Contributor harmless for
|
||||
any liability incurred by, or claims asserted against, such Contributor by
|
||||
reason of your accepting any such warranty or additional liability.
|
||||
|
||||
14. General.
|
||||
|
||||
(a) Relationship of Parties. You and Cockroach Labs are independent
|
||||
contractors, and nothing herein shall be deemed to constitute either
|
||||
party as the agent or representative of the other or both parties as
|
||||
joint venturers or partners for any purpose.
|
||||
|
||||
(b) Export Control. You shall comply with the U.S. Foreign Corrupt
|
||||
Practices Act and all applicable export laws, restrictions and
|
||||
regulations of the U.S. Department of Commerce, and any other applicable
|
||||
U.S. and foreign authority.
|
||||
|
||||
(c) Assignment. This Agreement and the rights and obligations herein may
|
||||
not be assigned or transferred, in whole or in part, by You without the
|
||||
prior written consent of Cockroach Labs. Any assignment in violation of
|
||||
this provision is void. This Agreement shall be binding upon, and inure
|
||||
to the benefit of, the successors and permitted assigns of the parties.
|
||||
|
||||
(d) Governing Law. This Agreement shall be governed by and construed under
|
||||
the laws of the State of New York and the United States without regard
|
||||
to conflicts of laws provisions thereof, and without regard to the
|
||||
Uniform Computer Information Transactions Act.
|
||||
|
||||
(e) Attorneys’ Fees. In any action or proceeding to enforce rights under
|
||||
this Agreement, the prevailing party shall be entitled to recover its
|
||||
costs, expenses and attorneys’ fees.
|
||||
|
||||
(f) Severability. If any provision of this Agreement is held to be invalid,
|
||||
illegal or unenforceable in any respect, that provision shall be limited
|
||||
or eliminated to the minimum extent necessary so that this Agreement
|
||||
otherwise remains in full force and effect and enforceable.
|
||||
|
||||
(g) Entire Agreement; Waivers; Modification. This Agreement constitutes the
|
||||
entire agreement between the parties relating to the subject matter
|
||||
hereof and supersedes all proposals, understandings, or discussions,
|
||||
whether written or oral, relating to the subject matter of this
|
||||
Agreement and all past dealing or industry custom. The failure of either
|
||||
party to enforce its rights under this Agreement at any time for any
|
||||
period shall not be construed as a waiver of such rights. No changes,
|
||||
modifications or waivers to this Agreement will be effective unless in
|
||||
writing and signed by both parties.
|
95
vendor/github.com/cockroachdb/cockroach/pkg/util/httputil/http.go
generated
vendored
95
vendor/github.com/cockroachdb/cockroach/pkg/util/httputil/http.go
generated
vendored
|
@ -1,95 +0,0 @@
|
|||
// Copyright 2014 The Cockroach 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.
|
||||
//
|
||||
// Author: Spencer Kimball (spencer.kimball@gmail.com)
|
||||
|
||||
package httputil
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/gogo/protobuf/jsonpb"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
const (
|
||||
// AcceptHeader is the canonical header name for accept.
|
||||
AcceptHeader = "Accept"
|
||||
// AcceptEncodingHeader is the canonical header name for accept encoding.
|
||||
AcceptEncodingHeader = "Accept-Encoding"
|
||||
// ContentEncodingHeader is the canonical header name for content type.
|
||||
ContentEncodingHeader = "Content-Encoding"
|
||||
// ContentTypeHeader is the canonical header name for content type.
|
||||
ContentTypeHeader = "Content-Type"
|
||||
// JSONContentType is the JSON content type.
|
||||
JSONContentType = "application/json"
|
||||
// AltJSONContentType is the alternate JSON content type.
|
||||
AltJSONContentType = "application/x-json"
|
||||
// ProtoContentType is the protobuf content type.
|
||||
ProtoContentType = "application/x-protobuf"
|
||||
// AltProtoContentType is the alternate protobuf content type.
|
||||
AltProtoContentType = "application/x-google-protobuf"
|
||||
// PlaintextContentType is the plaintext content type.
|
||||
PlaintextContentType = "text/plain"
|
||||
// GzipEncoding is the gzip encoding.
|
||||
GzipEncoding = "gzip"
|
||||
)
|
||||
|
||||
// GetJSON uses the supplied client to GET the URL specified by the parameters
|
||||
// and unmarshals the result into response.
|
||||
func GetJSON(httpClient http.Client, path string, response proto.Message) error {
|
||||
req, err := http.NewRequest("GET", path, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return doJSONRequest(httpClient, req, response)
|
||||
}
|
||||
|
||||
// PostJSON uses the supplied client to POST request to the URL specified by
|
||||
// the parameters and unmarshals the result into response.
|
||||
func PostJSON(httpClient http.Client, path string, request, response proto.Message) error {
|
||||
// Hack to avoid upsetting TestProtoMarshal().
|
||||
marshalFn := (&jsonpb.Marshaler{}).Marshal
|
||||
|
||||
var buf bytes.Buffer
|
||||
if err := marshalFn(&buf, request); err != nil {
|
||||
return err
|
||||
}
|
||||
req, err := http.NewRequest("POST", path, &buf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return doJSONRequest(httpClient, req, response)
|
||||
}
|
||||
|
||||
func doJSONRequest(httpClient http.Client, req *http.Request, response proto.Message) error {
|
||||
if timeout := httpClient.Timeout; timeout > 0 {
|
||||
req.Header.Set("Grpc-Timeout", strconv.FormatInt(timeout.Nanoseconds(), 10)+"n")
|
||||
}
|
||||
req.Header.Set(AcceptHeader, JSONContentType)
|
||||
resp, err := httpClient.Do(req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if contentType := resp.Header.Get(ContentTypeHeader); !(resp.StatusCode == http.StatusOK && contentType == JSONContentType) {
|
||||
b, err := ioutil.ReadAll(resp.Body)
|
||||
return errors.Errorf("status: %s, content-type: %s, body: %s, error: %v", resp.Status, contentType, b, err)
|
||||
}
|
||||
return jsonpb.Unmarshal(resp.Body, response)
|
||||
}
|
117
vendor/github.com/cockroachdb/cockroach/pkg/util/protoutil/clone.go
generated
vendored
117
vendor/github.com/cockroachdb/cockroach/pkg/util/protoutil/clone.go
generated
vendored
|
@ -1,117 +0,0 @@
|
|||
// Copyright 2016 The Cockroach 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.
|
||||
//
|
||||
// Author: Tamir Duberstein (tamird@gmail.com)
|
||||
|
||||
package protoutil
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/cockroachdb/cockroach/pkg/util/syncutil"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
var verbotenKinds = [...]reflect.Kind{
|
||||
reflect.Array,
|
||||
}
|
||||
|
||||
type typeKey struct {
|
||||
typ reflect.Type
|
||||
verboten reflect.Kind
|
||||
}
|
||||
|
||||
var types struct {
|
||||
syncutil.Mutex
|
||||
known map[typeKey]reflect.Type
|
||||
}
|
||||
|
||||
func init() {
|
||||
types.known = make(map[typeKey]reflect.Type)
|
||||
}
|
||||
|
||||
// Clone uses proto.Clone to return a deep copy of pb. It panics if pb
|
||||
// recursively contains any instances of types which are known to be
|
||||
// unsupported by proto.Clone.
|
||||
//
|
||||
// This function and its associated lint (see build/style_test.go) exist to
|
||||
// ensure we do not attempt to proto.Clone types which are not supported by
|
||||
// proto.Clone. This hackery is necessary because proto.Clone gives no direct
|
||||
// indication that it has incompletely cloned a type; it merely logs to standard
|
||||
// output (see
|
||||
// https://github.com/golang/protobuf/blob/89238a3/proto/clone.go#L204).
|
||||
//
|
||||
// The concrete case against which this is currently guarding may be resolved
|
||||
// upstream, see https://github.com/gogo/protobuf/issues/147.
|
||||
func Clone(pb proto.Message) proto.Message {
|
||||
for _, verbotenKind := range verbotenKinds {
|
||||
if t := typeIsOrContainsVerboten(reflect.TypeOf(pb), verbotenKind); t != nil {
|
||||
panic(fmt.Sprintf("attempt to clone %T, which contains uncloneable field of type %s", pb, t))
|
||||
}
|
||||
}
|
||||
|
||||
return proto.Clone(pb)
|
||||
}
|
||||
|
||||
func typeIsOrContainsVerboten(t reflect.Type, verboten reflect.Kind) reflect.Type {
|
||||
types.Lock()
|
||||
defer types.Unlock()
|
||||
|
||||
return typeIsOrContainsVerbotenLocked(t, verboten)
|
||||
}
|
||||
|
||||
func typeIsOrContainsVerbotenLocked(t reflect.Type, verboten reflect.Kind) reflect.Type {
|
||||
key := typeKey{t, verboten}
|
||||
knownTypeIsOrContainsVerboten, ok := types.known[key]
|
||||
if !ok {
|
||||
knownTypeIsOrContainsVerboten = typeIsOrContainsVerbotenImpl(t, verboten)
|
||||
types.known[key] = knownTypeIsOrContainsVerboten
|
||||
}
|
||||
return knownTypeIsOrContainsVerboten
|
||||
}
|
||||
|
||||
func typeIsOrContainsVerbotenImpl(t reflect.Type, verboten reflect.Kind) reflect.Type {
|
||||
switch t.Kind() {
|
||||
case verboten:
|
||||
return t
|
||||
|
||||
case reflect.Map:
|
||||
if key := typeIsOrContainsVerbotenLocked(t.Key(), verboten); key != nil {
|
||||
return key
|
||||
}
|
||||
if value := typeIsOrContainsVerbotenLocked(t.Elem(), verboten); value != nil {
|
||||
return value
|
||||
}
|
||||
|
||||
case reflect.Array, reflect.Ptr, reflect.Slice:
|
||||
if value := typeIsOrContainsVerbotenLocked(t.Elem(), verboten); value != nil {
|
||||
return value
|
||||
}
|
||||
|
||||
case reflect.Struct:
|
||||
for i := 0; i < t.NumField(); i++ {
|
||||
if field := typeIsOrContainsVerbotenLocked(t.Field(i).Type, verboten); field != nil {
|
||||
return field
|
||||
}
|
||||
}
|
||||
|
||||
case reflect.Chan, reflect.Func:
|
||||
// Not strictly correct, but cloning these kinds is not allowed.
|
||||
return t
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
128
vendor/github.com/cockroachdb/cockroach/pkg/util/protoutil/jsonpb_marshal.go
generated
vendored
128
vendor/github.com/cockroachdb/cockroach/pkg/util/protoutil/jsonpb_marshal.go
generated
vendored
|
@ -1,128 +0,0 @@
|
|||
// Copyright 2016 The Cockroach 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.
|
||||
//
|
||||
// Author: Tamir Duberstein (tamird@gmail.com)
|
||||
|
||||
package protoutil
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"reflect"
|
||||
|
||||
"github.com/gogo/protobuf/jsonpb"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/cockroachdb/cockroach/pkg/util/httputil"
|
||||
)
|
||||
|
||||
var _ gwruntime.Marshaler = (*JSONPb)(nil)
|
||||
|
||||
var typeProtoMessage = reflect.TypeOf((*proto.Message)(nil)).Elem()
|
||||
|
||||
// JSONPb is a gwruntime.Marshaler that uses github.com/gogo/protobuf/jsonpb.
|
||||
type JSONPb jsonpb.Marshaler
|
||||
|
||||
// ContentType implements gwruntime.Marshaler.
|
||||
func (*JSONPb) ContentType() string {
|
||||
return httputil.JSONContentType
|
||||
}
|
||||
|
||||
// Marshal implements gwruntime.Marshaler.
|
||||
func (j *JSONPb) Marshal(v interface{}) ([]byte, error) {
|
||||
return j.marshal(v)
|
||||
}
|
||||
|
||||
// a lower-case version of marshal to allow for a call from
|
||||
// marshalNonProtoField without upsetting TestProtoMarshal().
|
||||
func (j *JSONPb) marshal(v interface{}) ([]byte, error) {
|
||||
if pb, ok := v.(proto.Message); ok {
|
||||
var buf bytes.Buffer
|
||||
marshalFn := (*jsonpb.Marshaler)(j).Marshal
|
||||
if err := marshalFn(&buf, pb); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
return j.marshalNonProtoField(v)
|
||||
}
|
||||
|
||||
// Cribbed verbatim from grpc-gateway.
|
||||
type protoEnum interface {
|
||||
fmt.Stringer
|
||||
EnumDescriptor() ([]byte, []int)
|
||||
}
|
||||
|
||||
// Cribbed verbatim from grpc-gateway.
|
||||
func (j *JSONPb) marshalNonProtoField(v interface{}) ([]byte, error) {
|
||||
rv := reflect.ValueOf(v)
|
||||
for rv.Kind() == reflect.Ptr {
|
||||
if rv.IsNil() {
|
||||
return []byte("null"), nil
|
||||
}
|
||||
rv = rv.Elem()
|
||||
}
|
||||
|
||||
if rv.Kind() == reflect.Map {
|
||||
m := make(map[string]*json.RawMessage)
|
||||
for _, k := range rv.MapKeys() {
|
||||
buf, err := j.marshal(rv.MapIndex(k).Interface())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m[fmt.Sprintf("%v", k.Interface())] = (*json.RawMessage)(&buf)
|
||||
}
|
||||
if j.Indent != "" {
|
||||
return json.MarshalIndent(m, "", j.Indent)
|
||||
}
|
||||
return json.Marshal(m)
|
||||
}
|
||||
if enum, ok := rv.Interface().(protoEnum); ok && !j.EnumsAsInts {
|
||||
return json.Marshal(enum.String())
|
||||
}
|
||||
return json.Marshal(rv.Interface())
|
||||
}
|
||||
|
||||
// Unmarshal implements gwruntime.Marshaler.
|
||||
func (j *JSONPb) Unmarshal(data []byte, v interface{}) error {
|
||||
if pb, ok := v.(proto.Message); ok {
|
||||
return jsonpb.Unmarshal(bytes.NewReader(data), pb)
|
||||
}
|
||||
return errors.Errorf("unexpected type %T does not implement %s", v, typeProtoMessage)
|
||||
}
|
||||
|
||||
// NewDecoder implements gwruntime.Marshaler.
|
||||
func (j *JSONPb) NewDecoder(r io.Reader) gwruntime.Decoder {
|
||||
return gwruntime.DecoderFunc(func(v interface{}) error {
|
||||
if pb, ok := v.(proto.Message); ok {
|
||||
return jsonpb.Unmarshal(r, pb)
|
||||
}
|
||||
return errors.Errorf("unexpected type %T does not implement %s", v, typeProtoMessage)
|
||||
})
|
||||
}
|
||||
|
||||
// NewEncoder implements gwruntime.Marshaler.
|
||||
func (j *JSONPb) NewEncoder(w io.Writer) gwruntime.Encoder {
|
||||
return gwruntime.EncoderFunc(func(v interface{}) error {
|
||||
if pb, ok := v.(proto.Message); ok {
|
||||
marshalFn := (*jsonpb.Marshaler)(j).Marshal
|
||||
return marshalFn(w, pb)
|
||||
}
|
||||
return errors.Errorf("unexpected type %T does not implement %s", v, typeProtoMessage)
|
||||
})
|
||||
}
|
31
vendor/github.com/cockroachdb/cockroach/pkg/util/protoutil/marshal.go
generated
vendored
31
vendor/github.com/cockroachdb/cockroach/pkg/util/protoutil/marshal.go
generated
vendored
|
@ -1,31 +0,0 @@
|
|||
// Copyright 2016 The Cockroach 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.
|
||||
//
|
||||
// Author: Tamir Duberstein (tamird@gmail.com)
|
||||
|
||||
package protoutil
|
||||
|
||||
import "github.com/gogo/protobuf/proto"
|
||||
|
||||
// Interceptor will be called with every proto before it is marshalled.
|
||||
// Interceptor is not safe to modify concurrently with calls to Marshal.
|
||||
var Interceptor = func(_ proto.Message) {}
|
||||
|
||||
// Marshal uses proto.Marshal to encode pb into the wire format. It is used in
|
||||
// some tests to intercept calls to proto.Marshal.
|
||||
func Marshal(pb proto.Message) ([]byte, error) {
|
||||
Interceptor(pb)
|
||||
|
||||
return proto.Marshal(pb)
|
||||
}
|
96
vendor/github.com/cockroachdb/cockroach/pkg/util/protoutil/marshaler.go
generated
vendored
96
vendor/github.com/cockroachdb/cockroach/pkg/util/protoutil/marshaler.go
generated
vendored
|
@ -1,96 +0,0 @@
|
|||
// Copyright 2016 The Cockroach 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.
|
||||
//
|
||||
// Author: Tamir Duberstein (tamird@gmail.com)
|
||||
|
||||
package protoutil
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/cockroachdb/cockroach/pkg/util/httputil"
|
||||
)
|
||||
|
||||
var _ gwruntime.Marshaler = (*ProtoPb)(nil)
|
||||
|
||||
// ProtoPb is a gwruntime.Marshaler that uses github.com/gogo/protobuf/proto.
|
||||
type ProtoPb struct{}
|
||||
|
||||
// ContentType implements gwruntime.Marshaler.
|
||||
func (*ProtoPb) ContentType() string {
|
||||
return httputil.ProtoContentType
|
||||
}
|
||||
|
||||
// Marshal implements gwruntime.Marshaler.
|
||||
func (*ProtoPb) Marshal(v interface{}) ([]byte, error) {
|
||||
if p, ok := v.(proto.Message); ok {
|
||||
return Marshal(p)
|
||||
}
|
||||
return nil, errors.Errorf("unexpected type %T does not implement %s", v, typeProtoMessage)
|
||||
}
|
||||
|
||||
// Unmarshal implements gwruntime.Marshaler.
|
||||
func (*ProtoPb) Unmarshal(data []byte, v interface{}) error {
|
||||
if p, ok := v.(proto.Message); ok {
|
||||
return proto.Unmarshal(data, p)
|
||||
}
|
||||
return errors.Errorf("unexpected type %T does not implement %s", v, typeProtoMessage)
|
||||
}
|
||||
|
||||
type protoDecoder struct {
|
||||
r io.Reader
|
||||
}
|
||||
|
||||
// NewDecoder implements gwruntime.Marshaler.
|
||||
func (*ProtoPb) NewDecoder(r io.Reader) gwruntime.Decoder {
|
||||
return &protoDecoder{r: r}
|
||||
}
|
||||
|
||||
// Decode implements gwruntime.Marshaler.
|
||||
func (d *protoDecoder) Decode(v interface{}) error {
|
||||
if p, ok := v.(proto.Message); ok {
|
||||
bytes, err := ioutil.ReadAll(d.r)
|
||||
if err == nil {
|
||||
err = proto.Unmarshal(bytes, p)
|
||||
}
|
||||
return err
|
||||
}
|
||||
return errors.Errorf("unexpected type %T does not implement %s", v, typeProtoMessage)
|
||||
}
|
||||
|
||||
type protoEncoder struct {
|
||||
w io.Writer
|
||||
}
|
||||
|
||||
// NewEncoder implements gwruntime.Marshaler.
|
||||
func (*ProtoPb) NewEncoder(w io.Writer) gwruntime.Encoder {
|
||||
return &protoEncoder{w: w}
|
||||
}
|
||||
|
||||
// Encode implements gwruntime.Marshaler.
|
||||
func (e *protoEncoder) Encode(v interface{}) error {
|
||||
if p, ok := v.(proto.Message); ok {
|
||||
bytes, err := Marshal(p)
|
||||
if err == nil {
|
||||
_, err = e.w.Write(bytes)
|
||||
}
|
||||
return err
|
||||
}
|
||||
return errors.Errorf("unexpected type %T does not implement %s", v, typeProtoMessage)
|
||||
}
|
47
vendor/github.com/cockroachdb/cockroach/pkg/util/syncutil/mutex_deadlock.go
generated
vendored
47
vendor/github.com/cockroachdb/cockroach/pkg/util/syncutil/mutex_deadlock.go
generated
vendored
|
@ -1,47 +0,0 @@
|
|||
// Copyright 2016 The Cockroach 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.
|
||||
//
|
||||
// Author: Tamir Duberstein (tamird@gmail.com)
|
||||
|
||||
// +build deadlock
|
||||
|
||||
package syncutil
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
deadlock "github.com/sasha-s/go-deadlock"
|
||||
)
|
||||
|
||||
func init() {
|
||||
deadlock.Opts.DeadlockTimeout = 5 * time.Minute
|
||||
}
|
||||
|
||||
// A Mutex is a mutual exclusion lock.
|
||||
type Mutex struct {
|
||||
deadlock.Mutex
|
||||
}
|
||||
|
||||
// AssertHeld is a no-op for deadlock mutexes.
|
||||
func (m *Mutex) AssertHeld() {
|
||||
}
|
||||
|
||||
// An RWMutex is a reader/writer mutual exclusion lock.
|
||||
type RWMutex struct {
|
||||
deadlock.RWMutex
|
||||
}
|
||||
|
||||
// AssertHeld is a no-op for deadlock mutexes.
|
||||
func (m *RWMutex) AssertHeld() {
|
||||
}
|
92
vendor/github.com/cockroachdb/cockroach/pkg/util/syncutil/mutex_sync.go
generated
vendored
92
vendor/github.com/cockroachdb/cockroach/pkg/util/syncutil/mutex_sync.go
generated
vendored
|
@ -1,92 +0,0 @@
|
|||
// Copyright 2016 The Cockroach 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.
|
||||
//
|
||||
// Author: Tamir Duberstein (tamird@gmail.com)
|
||||
|
||||
// +build !deadlock
|
||||
|
||||
package syncutil
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
)
|
||||
|
||||
// A Mutex is a mutual exclusion lock.
|
||||
type Mutex struct {
|
||||
mu sync.Mutex
|
||||
isLocked int32 // updated atomically
|
||||
}
|
||||
|
||||
// Lock implements sync.Locker.
|
||||
func (m *Mutex) Lock() {
|
||||
m.mu.Lock()
|
||||
atomic.StoreInt32(&m.isLocked, 1)
|
||||
}
|
||||
|
||||
// Unlock implements sync.Locker.
|
||||
func (m *Mutex) Unlock() {
|
||||
atomic.StoreInt32(&m.isLocked, 0)
|
||||
m.mu.Unlock()
|
||||
}
|
||||
|
||||
// AssertHeld may panic if the mutex is not locked (but it is not required to
|
||||
// do so). Functions which require that their callers hold a particular lock
|
||||
// may use this to enforce this requirement more directly than relying on the
|
||||
// race detector.
|
||||
//
|
||||
// Note that we do not require the lock to be held by any particular thread,
|
||||
// just that some thread holds the lock. This is both more efficient and allows
|
||||
// for rare cases where a mutex is locked in one thread and used in another.
|
||||
func (m *Mutex) AssertHeld() {
|
||||
if atomic.LoadInt32(&m.isLocked) == 0 {
|
||||
panic("mutex is not locked")
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(pmattis): Mutex.AssertHeld is neither used or tested. Silence unused
|
||||
// warning.
|
||||
var _ = (*Mutex).AssertHeld
|
||||
|
||||
// An RWMutex is a reader/writer mutual exclusion lock.
|
||||
type RWMutex struct {
|
||||
sync.RWMutex
|
||||
isLocked int32 // updated atomically
|
||||
}
|
||||
|
||||
// Lock implements sync.Locker.
|
||||
func (m *RWMutex) Lock() {
|
||||
m.RWMutex.Lock()
|
||||
atomic.StoreInt32(&m.isLocked, 1)
|
||||
}
|
||||
|
||||
// Unlock implements sync.Locker.
|
||||
func (m *RWMutex) Unlock() {
|
||||
atomic.StoreInt32(&m.isLocked, 0)
|
||||
m.RWMutex.Unlock()
|
||||
}
|
||||
|
||||
// AssertHeld may panic if the mutex is not locked for writing (but it is not
|
||||
// required to do so). Functions which require that their callers hold a
|
||||
// particular lock may use this to enforce this requirement more directly than
|
||||
// relying on the race detector.
|
||||
//
|
||||
// Note that we do not require the lock to be held by any particular thread,
|
||||
// just that some thread holds the lock. This is both more efficient and allows
|
||||
// for rare cases where a mutex is locked in one thread and used in another.
|
||||
func (m *RWMutex) AssertHeld() {
|
||||
if atomic.LoadInt32(&m.isLocked) == 0 {
|
||||
panic("mutex is not locked")
|
||||
}
|
||||
}
|
1416
vendor/github.com/gogo/protobuf/jsonpb/jsonpb.go
generated
vendored
1416
vendor/github.com/gogo/protobuf/jsonpb/jsonpb.go
generated
vendored
File diff suppressed because it is too large
Load diff
4
vendor/github.com/petermattis/goid/.gitignore
generated
vendored
4
vendor/github.com/petermattis/goid/.gitignore
generated
vendored
|
@ -1,4 +0,0 @@
|
|||
*~
|
||||
*.test
|
||||
.*.swp
|
||||
.DS_Store
|
10
vendor/github.com/petermattis/goid/.travis.yml
generated
vendored
10
vendor/github.com/petermattis/goid/.travis.yml
generated
vendored
|
@ -1,10 +0,0 @@
|
|||
language: go
|
||||
|
||||
go:
|
||||
- 1.3.x
|
||||
- 1.4.x
|
||||
- 1.5.x
|
||||
- 1.6.x
|
||||
- 1.7.x
|
||||
- 1.8.x
|
||||
- master
|
202
vendor/github.com/petermattis/goid/LICENSE
generated
vendored
202
vendor/github.com/petermattis/goid/LICENSE
generated
vendored
|
@ -1,202 +0,0 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
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.
|
||||
|
4
vendor/github.com/petermattis/goid/README.md
generated
vendored
4
vendor/github.com/petermattis/goid/README.md
generated
vendored
|
@ -1,4 +0,0 @@
|
|||
# goid [![Build Status](https://travis-ci.org/petermattis/goid.svg?branch=master)](https://travis-ci.org/petermattis/goid)
|
||||
|
||||
Programatically retrieve the current goroutine's ID. See [the CI
|
||||
configuration](.travis.yml) for supported Go versions.
|
35
vendor/github.com/petermattis/goid/goid.go
generated
vendored
35
vendor/github.com/petermattis/goid/goid.go
generated
vendored
|
@ -1,35 +0,0 @@
|
|||
// Copyright 2016 Peter Mattis.
|
||||
//
|
||||
// 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. See the AUTHORS file
|
||||
// for names of contributors.
|
||||
|
||||
package goid
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"runtime"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func ExtractGID(s []byte) int64 {
|
||||
s = s[len("goroutine "):]
|
||||
s = s[:bytes.IndexByte(s, ' ')]
|
||||
gid, _ := strconv.ParseInt(string(s), 10, 64)
|
||||
return gid
|
||||
}
|
||||
|
||||
// Parse the goid from runtime.Stack() output. Slow, but it works.
|
||||
func getSlow() int64 {
|
||||
var buf [64]byte
|
||||
return ExtractGID(buf[:runtime.Stack(buf[:], false)])
|
||||
}
|
23
vendor/github.com/petermattis/goid/goid_go1.3.c
generated
vendored
23
vendor/github.com/petermattis/goid/goid_go1.3.c
generated
vendored
|
@ -1,23 +0,0 @@
|
|||
// Copyright 2015 Peter Mattis.
|
||||
//
|
||||
// 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. See the AUTHORS file
|
||||
// for names of contributors.
|
||||
|
||||
// +build !go1.4
|
||||
|
||||
#include <runtime.h>
|
||||
|
||||
void ·Get(int64 ret) {
|
||||
ret = g->goid;
|
||||
USED(&ret);
|
||||
}
|
21
vendor/github.com/petermattis/goid/goid_go1.3.go
generated
vendored
21
vendor/github.com/petermattis/goid/goid_go1.3.go
generated
vendored
|
@ -1,21 +0,0 @@
|
|||
// Copyright 2015 Peter Mattis.
|
||||
//
|
||||
// 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. See the AUTHORS file
|
||||
// for names of contributors.
|
||||
|
||||
// +build !go1.4
|
||||
|
||||
package goid
|
||||
|
||||
// Get returns the id of the current goroutine.
|
||||
func Get() int64
|
34
vendor/github.com/petermattis/goid/goid_go1.4.go
generated
vendored
34
vendor/github.com/petermattis/goid/goid_go1.4.go
generated
vendored
|
@ -1,34 +0,0 @@
|
|||
// Copyright 2015 Peter Mattis.
|
||||
//
|
||||
// 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. See the AUTHORS file
|
||||
// for names of contributors.
|
||||
|
||||
// +build go1.4,!go1.5
|
||||
|
||||
package goid
|
||||
|
||||
import "unsafe"
|
||||
|
||||
var pointerSize = unsafe.Sizeof(uintptr(0))
|
||||
|
||||
// Backdoor access to runtime·getg().
|
||||
func getg() uintptr // in goid_go1.4.s
|
||||
|
||||
// Get returns the id of the current goroutine.
|
||||
func Get() int64 {
|
||||
// The goid is the 16th field in the G struct where each field is a
|
||||
// pointer, uintptr or padded to that size. See runtime.h from the
|
||||
// Go sources. I'm not aware of a cleaner way to determine the
|
||||
// offset.
|
||||
return *(*int64)(unsafe.Pointer(getg() + 16*pointerSize))
|
||||
}
|
18
vendor/github.com/petermattis/goid/goid_go1.4.s
generated
vendored
18
vendor/github.com/petermattis/goid/goid_go1.4.s
generated
vendored
|
@ -1,18 +0,0 @@
|
|||
// Copyright 2014 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Assembly to get into package runtime without using exported symbols.
|
||||
// See https://github.com/golang/go/blob/release-branch.go1.4/misc/cgo/test/backdoor/thunk.s
|
||||
|
||||
// +build amd64 amd64p32 arm 386
|
||||
// +build go1.4,!go1.5
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
#ifdef GOARCH_arm
|
||||
#define JMP B
|
||||
#endif
|
||||
|
||||
TEXT ·getg(SB),NOSPLIT,$0-0
|
||||
JMP runtime·getg(SB)
|
67
vendor/github.com/petermattis/goid/goid_go1.5.go
generated
vendored
67
vendor/github.com/petermattis/goid/goid_go1.5.go
generated
vendored
|
@ -1,67 +0,0 @@
|
|||
// Copyright 2016 Peter Mattis.
|
||||
//
|
||||
// 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. See the AUTHORS file
|
||||
// for names of contributors.
|
||||
|
||||
// +build amd64 amd64p32 arm
|
||||
// +build go1.5,!go1.6
|
||||
|
||||
package goid
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// Just enough of the structs from runtime/runtime2.go to get the offset to goid.
|
||||
// See https://github.com/golang/go/blob/release-branch.go1.5/src/runtime/runtime2.go
|
||||
|
||||
type stack struct {
|
||||
lo uintptr
|
||||
hi uintptr
|
||||
}
|
||||
|
||||
type gobuf struct {
|
||||
sp uintptr
|
||||
pc uintptr
|
||||
g uintptr
|
||||
ctxt uintptr
|
||||
ret uintptr
|
||||
lr uintptr
|
||||
bp uintptr
|
||||
}
|
||||
|
||||
type g struct {
|
||||
stack stack
|
||||
stackguard0 uintptr
|
||||
stackguard1 uintptr
|
||||
|
||||
_panic uintptr
|
||||
_defer uintptr
|
||||
m uintptr
|
||||
stackAlloc uintptr
|
||||
sched gobuf
|
||||
syscallsp uintptr
|
||||
syscallpc uintptr
|
||||
stkbar []uintptr
|
||||
stkbarPos uintptr
|
||||
param unsafe.Pointer
|
||||
atomicstatus uint32
|
||||
stackLock uint32
|
||||
goid int64 // Here it is!
|
||||
}
|
||||
|
||||
// Backdoor access to runtime·getg().
|
||||
func getg() uintptr // in goid_go1.5plus.s
|
||||
|
||||
func Get() int64 {
|
||||
gg := (*g)(unsafe.Pointer(getg()))
|
||||
return gg.goid
|
||||
}
|
27
vendor/github.com/petermattis/goid/goid_go1.5plus.s
generated
vendored
27
vendor/github.com/petermattis/goid/goid_go1.5plus.s
generated
vendored
|
@ -1,27 +0,0 @@
|
|||
// Copyright 2016 Peter Mattis.
|
||||
//
|
||||
// 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. See the AUTHORS file
|
||||
// for names of contributors.
|
||||
|
||||
// Assembly to mimic runtime.getg.
|
||||
|
||||
// +build amd64 amd64p32
|
||||
// +build go1.5
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
// func getg() uintptr
|
||||
TEXT ·getg(SB),NOSPLIT,$0-8
|
||||
MOVQ (TLS), BX
|
||||
MOVQ BX, ret+0(FP)
|
||||
RET
|
27
vendor/github.com/petermattis/goid/goid_go1.5plus_arm.s
generated
vendored
27
vendor/github.com/petermattis/goid/goid_go1.5plus_arm.s
generated
vendored
|
@ -1,27 +0,0 @@
|
|||
// Copyright 2016 Peter Mattis.
|
||||
//
|
||||
// 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. See the AUTHORS file
|
||||
// for names of contributors.
|
||||
|
||||
// Assembly to mimic runtime.getg.
|
||||
// This should work on arm64 as well, but it hasn't been tested.
|
||||
|
||||
// +build arm
|
||||
// +build go1.5
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
// func getg() uintptr
|
||||
TEXT ·getg(SB),NOSPLIT,$0-8
|
||||
MOVW g, ret+0(FP)
|
||||
RET
|
53
vendor/github.com/petermattis/goid/goid_go1.6plus.go
generated
vendored
53
vendor/github.com/petermattis/goid/goid_go1.6plus.go
generated
vendored
|
@ -1,53 +0,0 @@
|
|||
// +build amd64 amd64p32 arm
|
||||
// +build go1.6,!go1.9
|
||||
|
||||
package goid
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// Just enough of the structs from runtime/runtime2.go to get the offset to goid.
|
||||
// See https://github.com/golang/go/blob/release-branch.go1.6/src/runtime/runtime2.go
|
||||
|
||||
type stack struct {
|
||||
lo uintptr
|
||||
hi uintptr
|
||||
}
|
||||
|
||||
type gobuf struct {
|
||||
sp uintptr
|
||||
pc uintptr
|
||||
g uintptr
|
||||
ctxt uintptr
|
||||
ret uintptr
|
||||
lr uintptr
|
||||
bp uintptr
|
||||
}
|
||||
|
||||
type g struct {
|
||||
stack stack
|
||||
stackguard0 uintptr
|
||||
stackguard1 uintptr
|
||||
|
||||
_panic uintptr
|
||||
_defer uintptr
|
||||
m uintptr
|
||||
stackAlloc uintptr
|
||||
sched gobuf
|
||||
syscallsp uintptr
|
||||
syscallpc uintptr
|
||||
stkbar []uintptr
|
||||
stkbarPos uintptr
|
||||
stktopsp uintptr
|
||||
param unsafe.Pointer
|
||||
atomicstatus uint32
|
||||
stackLock uint32
|
||||
goid int64 // Here it is!
|
||||
}
|
||||
|
||||
// Backdoor access to runtime·getg().
|
||||
func getg() uintptr // in goid_go1.5plus{,_arm}.s
|
||||
|
||||
func Get() int64 {
|
||||
gg := (*g)(unsafe.Pointer(getg()))
|
||||
return gg.goid
|
||||
}
|
47
vendor/github.com/petermattis/goid/goid_go1.9plus.go
generated
vendored
47
vendor/github.com/petermattis/goid/goid_go1.9plus.go
generated
vendored
|
@ -1,47 +0,0 @@
|
|||
// +build amd64 amd64p32 arm
|
||||
// +build go1.9
|
||||
|
||||
package goid
|
||||
|
||||
import "unsafe"
|
||||
|
||||
type stack struct {
|
||||
lo uintptr
|
||||
hi uintptr
|
||||
}
|
||||
|
||||
type gobuf struct {
|
||||
sp uintptr
|
||||
pc uintptr
|
||||
g uintptr
|
||||
ctxt uintptr
|
||||
ret uintptr
|
||||
lr uintptr
|
||||
bp uintptr
|
||||
}
|
||||
|
||||
type g struct {
|
||||
stack stack
|
||||
stackguard0 uintptr
|
||||
stackguard1 uintptr
|
||||
|
||||
_panic uintptr
|
||||
_defer uintptr
|
||||
m uintptr
|
||||
sched gobuf
|
||||
syscallsp uintptr
|
||||
syscallpc uintptr
|
||||
stktopsp uintptr
|
||||
param unsafe.Pointer
|
||||
atomicstatus uint32
|
||||
stackLock uint32
|
||||
goid int64 // Here it is!
|
||||
}
|
||||
|
||||
// Backdoor access to runtime·getg().
|
||||
func getg() uintptr // in goid_go1.5plus{,_arm}.s
|
||||
|
||||
func Get() int64 {
|
||||
gg := (*g)(unsafe.Pointer(getg()))
|
||||
return gg.goid
|
||||
}
|
23
vendor/github.com/petermattis/goid/goid_slow.go
generated
vendored
23
vendor/github.com/petermattis/goid/goid_slow.go
generated
vendored
|
@ -1,23 +0,0 @@
|
|||
// Copyright 2016 Peter Mattis.
|
||||
//
|
||||
// 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. See the AUTHORS file
|
||||
// for names of contributors.
|
||||
|
||||
// +build go1.4,!go1.5,!amd64,!amd64p32,!arm,!386 go1.5,!go1.6,!amd64,!amd64p32,!arm go1.6,!amd64,!amd64p32,!arm go1.9,!amd64,!amd64p32,!arm
|
||||
|
||||
package goid
|
||||
|
||||
// Get returns the id of the current goroutine.
|
||||
func Get() int64 {
|
||||
return getSlow()
|
||||
}
|
8
vendor/github.com/sasha-s/go-deadlock/.travis.yml
generated
vendored
8
vendor/github.com/sasha-s/go-deadlock/.travis.yml
generated
vendored
|
@ -1,8 +0,0 @@
|
|||
language: go
|
||||
|
||||
go:
|
||||
- 1.3
|
||||
- 1.4
|
||||
- 1.5
|
||||
- 1.6
|
||||
- 1.7
|
201
vendor/github.com/sasha-s/go-deadlock/LICENSE
generated
vendored
201
vendor/github.com/sasha-s/go-deadlock/LICENSE
generated
vendored
|
@ -1,201 +0,0 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
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.
|
112
vendor/github.com/sasha-s/go-deadlock/Readme.md
generated
vendored
112
vendor/github.com/sasha-s/go-deadlock/Readme.md
generated
vendored
|
@ -1,112 +0,0 @@
|
|||
# Online deadlock detection in go (golang). [Docs](https://godoc.org/github.com/sasha-s/go-deadlock). [![Build Status](https://travis-ci.org/sasha-s/go-deadlock.svg?branch=master)](https://travis-ci.org/sasha-s/go-deadlock)
|
||||
## Why
|
||||
Deadlocks happen and are painful to debug.
|
||||
|
||||
## What
|
||||
go-deadlock provides (RW)Mutex drop-in replacements for sync.(RW)Mutex.
|
||||
It would not work if you create a spaghetti of channels.
|
||||
Mutexes only.
|
||||
|
||||
## Installation
|
||||
```sh
|
||||
go get github.com/sasha-s/go-deadlock/...
|
||||
```
|
||||
|
||||
## Usage
|
||||
```go
|
||||
import "github.com/sasha-s/go-deadlock"
|
||||
var mu deadlock.Mutex
|
||||
// Use normally, it works exactly like sync.Mutex does.
|
||||
mu.Lock()
|
||||
|
||||
defer mu.Unlock()
|
||||
// Or
|
||||
var rw deadlock.RWMutex
|
||||
rw.RLock()
|
||||
defer rw.RUnlock()
|
||||
```
|
||||
|
||||
### Deadlocks
|
||||
One of the most common sources of deadlocks is inconsistent lock ordering:
|
||||
say, you have two mutexes A and B, and in some goroutines you have
|
||||
```go
|
||||
A.Lock() // defer A.Unlock() or similar.
|
||||
...
|
||||
B.Lock() // defer B.Unlock() or similar.
|
||||
```
|
||||
And in another goroutine the order of locks is reversed:
|
||||
```go
|
||||
B.Lock() // defer B.Unlock() or similar.
|
||||
...
|
||||
A.Lock() // defer A.Unlock() or similar.
|
||||
```
|
||||
This does not guarantee a deadlock (maybe the goroutines above can never be running at the same time), but it usually a design flaw at least.
|
||||
|
||||
go-deadlock can detect such cases (unless you cross goroutine boundary - say lock A, then spawn a goroutine, block until it is singals, and lock B inside of the goroutine), even if the deadlock itself happens very infrequently and is painful to reproduce!
|
||||
|
||||
Each time go-deadlock sees a lock attempt for lock B, it records the order A before B, for each lock that is currently being held in the same goroutine, and it prints (and exits the program by default) when it sees the locking order being violated.
|
||||
|
||||
In addition, if it sees that we are waiting on a lock for a long time (opts.DeadlockTimeout, 30 seconds by default), it reports a potential deadlock, also printing the stacktrace for a goroutine that is currently holding the lock we are desperately trying to grab.
|
||||
|
||||
|
||||
## Sample output
|
||||
####Inconsistent lock ordering:
|
||||
```
|
||||
POTENTIAL DEADLOCK: Inconsistent locking. saw this ordering in one goroutine:
|
||||
happened before
|
||||
inmem.go:623 bttest.(*server).ReadModifyWriteRow { r.mu.Lock() } <<<<<
|
||||
inmem_test.go:118 bttest.TestConcurrentMutationsReadModifyAndGC.func4 { _, _ = s.ReadModifyWriteRow(ctx, rmw()) }
|
||||
|
||||
happened after
|
||||
inmem.go:629 bttest.(*server).ReadModifyWriteRow { tbl.mu.RLock() } <<<<<
|
||||
inmem_test.go:118 bttest.TestConcurrentMutationsReadModifyAndGC.func4 { _, _ = s.ReadModifyWriteRow(ctx, rmw()) }
|
||||
|
||||
in another goroutine: happened before
|
||||
inmem.go:799 bttest.(*table).gc { t.mu.RLock() } <<<<<
|
||||
inmem_test.go:125 bttest.TestConcurrentMutationsReadModifyAndGC.func5 { tbl.gc() }
|
||||
|
||||
happend after
|
||||
inmem.go:814 bttest.(*table).gc { r.mu.Lock() } <<<<<
|
||||
inmem_test.go:125 bttest.TestConcurrentMutationsReadModifyAndGC.func5 { tbl.gc() }
|
||||
```
|
||||
|
||||
#### Waiting for a lock for a long time:
|
||||
|
||||
```
|
||||
POTENTIAL DEADLOCK:
|
||||
Previous place where the lock was grabbed
|
||||
goroutine 240 lock 0xc820160440
|
||||
inmem.go:799 bttest.(*table).gc { t.mu.RLock() } <<<<<
|
||||
inmem_test.go:125 bttest.TestConcurrentMutationsReadModifyAndGC.func5 { tbl.gc() }
|
||||
|
||||
Have been trying to lock it again for more than 40ms
|
||||
goroutine 68 lock 0xc820160440
|
||||
inmem.go:785 bttest.(*table).mutableRow { t.mu.Lock() } <<<<<
|
||||
inmem.go:428 bttest.(*server).MutateRow { r := tbl.mutableRow(string(req.RowKey)) }
|
||||
inmem_test.go:111 bttest.TestConcurrentMutationsReadModifyAndGC.func3 { s.MutateRow(ctx, req) }
|
||||
|
||||
|
||||
Here is what goroutine 240 doing now
|
||||
goroutine 240 [select]:
|
||||
github.com/sasha-s/go-deadlock.lock(0xc82028ca10, 0x5189e0, 0xc82013a9b0)
|
||||
/Users/sasha/go/src/github.com/sasha-s/go-deadlock/deadlock.go:163 +0x1640
|
||||
github.com/sasha-s/go-deadlock.(*Mutex).Lock(0xc82013a9b0)
|
||||
/Users/sasha/go/src/github.com/sasha-s/go-deadlock/deadlock.go:54 +0x86
|
||||
google.golang.org/cloud/bigtable/bttest.(*table).gc(0xc820160440)
|
||||
/Users/sasha/go/src/google.golang.org/cloud/bigtable/bttest/inmem.go:814 +0x28d
|
||||
google.golang.org/cloud/bigtable/bttest.TestConcurrentMutationsReadModifyAndGC.func5(0xc82015c760, 0xc820160440) /Users/sasha/go/src/google.golang.org/cloud/bigtable/bttest/inmem_test.go:125 +0x48
|
||||
created by google.golang.org/cloud/bigtable/bttest.TestConcurrentMutationsReadModifyAndGC
|
||||
/Users/sasha/go/src/google.golang.org/cloud/bigtable/bttest/inmem_test.go:126 +0xb6f
|
||||
```
|
||||
|
||||
## Used in
|
||||
[cockroachdb: Potential deadlock between Gossip.SetStorage and Node.gossipStores](https://github.com/cockroachdb/cockroach/issues/7972)
|
||||
|
||||
[bigtable/bttest: A race between GC and row mutations](https://code-review.googlesource.com#/c/5301/)
|
||||
|
||||
## Need a mutex that works with net.context?
|
||||
I have [one](https://github.com/sasha-s/go-csync).
|
||||
|
||||
## Warning: Black magic inside
|
||||
go-deadlock is parsing goroutine ID from stacktraces for fun and profit.
|
||||
See [Goroutine IDs](http://blog.sgmansfield.com/2015/12/goroutine-ids/) blog post by [Scott Mansfield](http://blog.sgmansfield.com).
|
297
vendor/github.com/sasha-s/go-deadlock/deadlock.go
generated
vendored
297
vendor/github.com/sasha-s/go-deadlock/deadlock.go
generated
vendored
|
@ -1,297 +0,0 @@
|
|||
package deadlock
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/petermattis/goid"
|
||||
)
|
||||
|
||||
// Opts control how deadlock detection behaves.
|
||||
// Options are supposed to be set once at a startup (say, when parsing flags).
|
||||
var Opts = struct {
|
||||
// Mutex/RWMutex would work exactly as their sync counterparts
|
||||
// -- almost no runtime penalty, no deadlock detection if Disable == true.
|
||||
Disable bool
|
||||
// Would disable lock order based deadlock detection if DisableLockOrderDetection == true.
|
||||
DisableLockOrderDetection bool
|
||||
// Waiting for a lock for longer than DeadlockTimeout is considered a deadlock.
|
||||
// Ignored is DeadlockTimeout <= 0.
|
||||
DeadlockTimeout time.Duration
|
||||
// OnPotentialDeadlock is called each time a potential deadlock is deetcted -- either based on
|
||||
// lock order or on lock wait time.
|
||||
OnPotentialDeadlock func()
|
||||
// Will keep MaxMapSize lock pairs (happens before // happens after) in the map.
|
||||
// The map resets once the threshold is reached.
|
||||
MaxMapSize int
|
||||
// Will print to deadlock info to log buffer.
|
||||
LogBuf io.Writer
|
||||
}{
|
||||
DeadlockTimeout: time.Second * 30,
|
||||
OnPotentialDeadlock: func() {
|
||||
os.Exit(2)
|
||||
},
|
||||
MaxMapSize: 1024 * 64,
|
||||
LogBuf: os.Stderr,
|
||||
}
|
||||
|
||||
// A Mutex is a drop-in replacement for sync.Mutex.
|
||||
// Performs deadlock detection unless disabled in Opts.
|
||||
type Mutex struct {
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
// Lock locks the mutex.
|
||||
// If the lock is already in use, the calling goroutine
|
||||
// blocks until the mutex is available.
|
||||
//
|
||||
// Unless deadlock detection is disabled, logs potential deadlocks to stderr,
|
||||
// calling Opts.OnPotentialDeadlock on each occasion.
|
||||
func (m *Mutex) Lock() {
|
||||
lock(m.mu.Lock, m)
|
||||
}
|
||||
|
||||
// Unlock unlocks the mutex.
|
||||
// It is a run-time error if m is not locked on entry to Unlock.
|
||||
//
|
||||
// A locked Mutex is not associated with a particular goroutine.
|
||||
// It is allowed for one goroutine to lock a Mutex and then
|
||||
// arrange for another goroutine to unlock it.
|
||||
func (m *Mutex) Unlock() {
|
||||
m.mu.Unlock()
|
||||
if !Opts.Disable {
|
||||
PostUnlock(m)
|
||||
}
|
||||
}
|
||||
|
||||
// An RWMutex is a drop-in replacement for sync.RWMutex.
|
||||
// Performs deadlock detection unless disabled in Opts.
|
||||
type RWMutex struct {
|
||||
mu sync.RWMutex
|
||||
}
|
||||
|
||||
// Lock locks rw for writing.
|
||||
// If the lock is already locked for reading or writing,
|
||||
// Lock blocks until the lock is available.
|
||||
// To ensure that the lock eventually becomes available,
|
||||
// a blocked Lock call excludes new readers from acquiring
|
||||
// the lock.
|
||||
//
|
||||
// Unless deadlock detection is disabled, logs potential deadlocks to stderr,
|
||||
// calling Opts.OnPotentialDeadlock on each occasion.
|
||||
func (m *RWMutex) Lock() {
|
||||
lock(m.mu.Lock, m)
|
||||
}
|
||||
|
||||
// Unlock unlocks the mutex for writing. It is a run-time error if rw is
|
||||
// not locked for writing on entry to Unlock.
|
||||
//
|
||||
// As with Mutexes, a locked RWMutex is not associated with a particular
|
||||
// goroutine. One goroutine may RLock (Lock) an RWMutex and then
|
||||
// arrange for another goroutine to RUnlock (Unlock) it.
|
||||
func (m *RWMutex) Unlock() {
|
||||
m.mu.Unlock()
|
||||
if !Opts.Disable {
|
||||
PostUnlock(m)
|
||||
}
|
||||
}
|
||||
|
||||
// RLock locks the mutex for reading.
|
||||
//
|
||||
// Unless deadlock detection is disabled, logs potential deadlocks to stderr,
|
||||
// calling Opts.OnPotentialDeadlock on each occasion.
|
||||
func (m *RWMutex) RLock() {
|
||||
lock(m.mu.RLock, m)
|
||||
}
|
||||
|
||||
// RUnlock undoes a single RLock call;
|
||||
// it does not affect other simultaneous readers.
|
||||
// It is a run-time error if rw is not locked for reading
|
||||
// on entry to RUnlock.
|
||||
func (m *RWMutex) RUnlock() {
|
||||
if !Opts.Disable {
|
||||
PostUnlock(m)
|
||||
}
|
||||
m.mu.RUnlock()
|
||||
}
|
||||
|
||||
// RLocker returns a Locker interface that implements
|
||||
// the Lock and Unlock methods by calling RLock and RUnlock.
|
||||
func (m *RWMutex) RLocker() sync.Locker {
|
||||
return (*rlocker)(m)
|
||||
}
|
||||
|
||||
func PreLock(skip int, p interface{}) {
|
||||
lo.PreLock(skip, p)
|
||||
}
|
||||
|
||||
func PostLock(skip int, p interface{}) {
|
||||
lo.PostLock(skip, p)
|
||||
}
|
||||
|
||||
func PostUnlock(p interface{}) {
|
||||
lo.PostUnlock(p)
|
||||
}
|
||||
|
||||
func lock(lockFn func(), ptr interface{}) {
|
||||
if Opts.Disable {
|
||||
lockFn()
|
||||
return
|
||||
}
|
||||
PreLock(4, ptr)
|
||||
if Opts.DeadlockTimeout <= 0 {
|
||||
lockFn()
|
||||
} else {
|
||||
ch := make(chan struct{})
|
||||
go func() {
|
||||
lockFn()
|
||||
close(ch)
|
||||
}()
|
||||
for {
|
||||
t := time.NewTimer(Opts.DeadlockTimeout)
|
||||
defer t.Stop()
|
||||
select {
|
||||
case <-t.C:
|
||||
lo.mu.Lock()
|
||||
prev, ok := lo.cur[ptr]
|
||||
if !ok {
|
||||
lo.mu.Unlock()
|
||||
break // Nobody seems to be holding a lock, try again.
|
||||
}
|
||||
fmt.Fprintln(Opts.LogBuf, header)
|
||||
fmt.Fprintln(Opts.LogBuf, "Previous place where the lock was grabbed")
|
||||
fmt.Fprintf(Opts.LogBuf, "goroutine %v lock %p\n", prev.gid, ptr)
|
||||
printStack(Opts.LogBuf, prev.stack)
|
||||
fmt.Fprintln(Opts.LogBuf, "Have been trying to lock it again for more than", Opts.DeadlockTimeout)
|
||||
fmt.Fprintf(Opts.LogBuf, "goroutine %v lock %p\n", goid.Get(), ptr)
|
||||
printStack(Opts.LogBuf, callers(2))
|
||||
fmt.Fprintln(Opts.LogBuf)
|
||||
stacks := stacks()
|
||||
grs := bytes.Split(stacks, []byte("\n\n"))
|
||||
for _, g := range grs {
|
||||
if goid.ExtractGID(g) == prev.gid {
|
||||
fmt.Fprintln(Opts.LogBuf, "Here is what goroutine", prev.gid, "doing now")
|
||||
Opts.LogBuf.Write(g)
|
||||
fmt.Fprintln(Opts.LogBuf)
|
||||
}
|
||||
}
|
||||
lo.other(ptr)
|
||||
fmt.Fprintln(Opts.LogBuf, "All current goroutines:")
|
||||
Opts.LogBuf.Write(stacks)
|
||||
lo.mu.Unlock()
|
||||
Opts.OnPotentialDeadlock()
|
||||
<-ch
|
||||
PostLock(4, ptr)
|
||||
return
|
||||
case <-ch:
|
||||
PostLock(4, ptr)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
PostLock(4, ptr)
|
||||
}
|
||||
|
||||
type lockOrder struct {
|
||||
mu sync.Mutex
|
||||
cur map[interface{}]stackGID // stacktraces + gids for the locks currently taken.
|
||||
order map[beforeAfter]ss // expected order of locks.
|
||||
}
|
||||
|
||||
type stackGID struct {
|
||||
stack []uintptr
|
||||
gid int64
|
||||
}
|
||||
|
||||
type beforeAfter struct {
|
||||
before interface{}
|
||||
after interface{}
|
||||
}
|
||||
|
||||
type ss struct {
|
||||
before []uintptr
|
||||
after []uintptr
|
||||
}
|
||||
|
||||
var lo = newLockOrder()
|
||||
|
||||
func newLockOrder() *lockOrder {
|
||||
return &lockOrder{
|
||||
cur: map[interface{}]stackGID{},
|
||||
order: map[beforeAfter]ss{},
|
||||
}
|
||||
}
|
||||
|
||||
func (l *lockOrder) PostLock(skip int, p interface{}) {
|
||||
stack := callers(skip)
|
||||
gid := goid.Get()
|
||||
l.mu.Lock()
|
||||
l.cur[p] = stackGID{stack, gid}
|
||||
l.mu.Unlock()
|
||||
}
|
||||
|
||||
func (l *lockOrder) PreLock(skip int, p interface{}) {
|
||||
if Opts.DisableLockOrderDetection {
|
||||
return
|
||||
}
|
||||
stack := callers(skip)
|
||||
gid := goid.Get()
|
||||
l.mu.Lock()
|
||||
for b, bs := range l.cur {
|
||||
if b == p {
|
||||
continue
|
||||
}
|
||||
if bs.gid != gid { // We want locks taken in the same goroutine only.
|
||||
continue
|
||||
}
|
||||
if s, ok := l.order[beforeAfter{p, b}]; ok {
|
||||
fmt.Fprintln(Opts.LogBuf, header, "Inconsistent locking. saw this ordering in one goroutine:")
|
||||
fmt.Fprintln(Opts.LogBuf, "happened before")
|
||||
printStack(Opts.LogBuf, s.before)
|
||||
fmt.Fprintln(Opts.LogBuf, "happened after")
|
||||
printStack(Opts.LogBuf, s.after)
|
||||
fmt.Fprintln(Opts.LogBuf, "in another goroutine: happened before")
|
||||
printStack(Opts.LogBuf, bs.stack)
|
||||
fmt.Fprintln(Opts.LogBuf, "happend after")
|
||||
printStack(Opts.LogBuf, stack)
|
||||
l.other(p)
|
||||
Opts.OnPotentialDeadlock()
|
||||
}
|
||||
l.order[beforeAfter{b, p}] = ss{bs.stack, stack}
|
||||
if len(l.order) == Opts.MaxMapSize { // Reset the map to keep memory footprint bounded.
|
||||
l.order = map[beforeAfter]ss{}
|
||||
}
|
||||
}
|
||||
l.cur[p] = stackGID{stack, gid}
|
||||
l.mu.Unlock()
|
||||
}
|
||||
|
||||
func (l *lockOrder) PostUnlock(p interface{}) {
|
||||
l.mu.Lock()
|
||||
delete(l.cur, p)
|
||||
l.mu.Unlock()
|
||||
}
|
||||
|
||||
type rlocker RWMutex
|
||||
|
||||
func (r *rlocker) Lock() { (*RWMutex)(r).RLock() }
|
||||
func (r *rlocker) Unlock() { (*RWMutex)(r).RUnlock() }
|
||||
|
||||
// Under lo.mu Locked.
|
||||
func (l *lockOrder) other(ptr interface{}) {
|
||||
fmt.Fprintln(Opts.LogBuf, "\nOther goroutines holding locks:")
|
||||
for k, pp := range l.cur {
|
||||
if k == ptr {
|
||||
continue
|
||||
}
|
||||
fmt.Fprintf(Opts.LogBuf, "goroutine %v lock %p\n", pp.gid, k)
|
||||
printStack(Opts.LogBuf, pp.stack)
|
||||
}
|
||||
fmt.Fprintln(Opts.LogBuf)
|
||||
}
|
||||
|
||||
const header = "POTENTIAL DEADLOCK:"
|
107
vendor/github.com/sasha-s/go-deadlock/stacktraces.go
generated
vendored
107
vendor/github.com/sasha-s/go-deadlock/stacktraces.go
generated
vendored
|
@ -1,107 +0,0 @@
|
|||
package deadlock
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
func callers(skip int) []uintptr {
|
||||
s := make([]uintptr, 50) // Most relevant context seem to appear near the top of the stack.
|
||||
return s[:runtime.Callers(2+skip, s)]
|
||||
}
|
||||
|
||||
func printStack(w io.Writer, stack []uintptr) {
|
||||
home := os.Getenv("HOME")
|
||||
usr, err := user.Current()
|
||||
if err == nil {
|
||||
home = usr.HomeDir
|
||||
}
|
||||
cwd, _ := os.Getwd()
|
||||
|
||||
for i, pc := range stack {
|
||||
f := runtime.FuncForPC(pc)
|
||||
name := f.Name()
|
||||
pkg := ""
|
||||
if pos := strings.LastIndex(name, "/"); pos >= 0 {
|
||||
name = name[pos+1:]
|
||||
}
|
||||
if pos := strings.Index(name, "."); pos >= 0 {
|
||||
pkg = name[:pos]
|
||||
name = name[pos+1:]
|
||||
}
|
||||
file, line := f.FileLine(pc - 1)
|
||||
if (pkg == "runtime" && name == "goexit") || (pkg == "testing" && name == "tRunner") {
|
||||
fmt.Fprintln(w)
|
||||
return
|
||||
}
|
||||
tail := ""
|
||||
if i == 0 {
|
||||
tail = " <<<<<" // Make the line performing a lock prominent.
|
||||
}
|
||||
// Shorten the file name.
|
||||
clean := file
|
||||
if cwd != "" {
|
||||
cl, err := filepath.Rel(cwd, file)
|
||||
if err == nil {
|
||||
clean = cl
|
||||
}
|
||||
}
|
||||
if home != "" {
|
||||
s2 := strings.Replace(file, home, "~", 1)
|
||||
if len(clean) > len(s2) {
|
||||
clean = s2
|
||||
}
|
||||
}
|
||||
fmt.Fprintf(w, "%s:%d %s.%s %s%s\n", clean, line, pkg, name, code(file, line), tail)
|
||||
}
|
||||
fmt.Fprintln(w)
|
||||
}
|
||||
|
||||
var fileSources struct {
|
||||
sync.Mutex
|
||||
lines map[string][][]byte
|
||||
}
|
||||
|
||||
// Reads souce file lines from disk if not cached already.
|
||||
func getSourceLines(file string) [][]byte {
|
||||
fileSources.Lock()
|
||||
defer fileSources.Unlock()
|
||||
if fileSources.lines == nil {
|
||||
fileSources.lines = map[string][][]byte{}
|
||||
}
|
||||
if lines, ok := fileSources.lines[file]; ok {
|
||||
return lines
|
||||
}
|
||||
text, _ := ioutil.ReadFile(file)
|
||||
fileSources.lines[file] = bytes.Split(text, []byte{'\n'})
|
||||
return fileSources.lines[file]
|
||||
}
|
||||
|
||||
func code(file string, line int) string {
|
||||
lines := getSourceLines(file)
|
||||
// lines are 1 based.
|
||||
if line >= len(lines) || line <= 0 {
|
||||
return "???"
|
||||
}
|
||||
return "{ " + string(bytes.TrimSpace(lines[line-1])) + " }"
|
||||
}
|
||||
|
||||
// Stacktraces for all goroutines.
|
||||
func stacks() []byte {
|
||||
buf := make([]byte, 1024*16)
|
||||
for {
|
||||
n := runtime.Stack(buf, true)
|
||||
if n < len(buf) {
|
||||
return buf[:n]
|
||||
}
|
||||
buf = make([]byte, 2*len(buf))
|
||||
}
|
||||
}
|
9
vendor/modules.txt
vendored
9
vendor/modules.txt
vendored
|
@ -69,10 +69,6 @@ github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1
|
|||
github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1
|
||||
# github.com/cespare/xxhash v1.1.0
|
||||
github.com/cespare/xxhash
|
||||
# github.com/cockroachdb/cockroach v0.0.0-20170608034007-84bc9597164f
|
||||
github.com/cockroachdb/cockroach/pkg/util/protoutil
|
||||
github.com/cockroachdb/cockroach/pkg/util/httputil
|
||||
github.com/cockroachdb/cockroach/pkg/util/syncutil
|
||||
# github.com/davecgh/go-spew v1.1.1
|
||||
github.com/davecgh/go-spew/spew
|
||||
# github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
|
@ -121,7 +117,6 @@ github.com/gogo/protobuf/sortkeys
|
|||
github.com/gogo/protobuf/protoc-gen-gogo/descriptor
|
||||
github.com/gogo/protobuf/vanity
|
||||
github.com/gogo/protobuf/vanity/command
|
||||
github.com/gogo/protobuf/jsonpb
|
||||
github.com/gogo/protobuf/plugin/compare
|
||||
github.com/gogo/protobuf/plugin/defaultcheck
|
||||
github.com/gogo/protobuf/plugin/description
|
||||
|
@ -247,8 +242,6 @@ github.com/opentracing-contrib/go-stdlib/nethttp
|
|||
github.com/opentracing/opentracing-go
|
||||
github.com/opentracing/opentracing-go/log
|
||||
github.com/opentracing/opentracing-go/ext
|
||||
# github.com/petermattis/goid v0.0.0-20170504144140-0ded85884ba5
|
||||
github.com/petermattis/goid
|
||||
# github.com/pkg/errors v0.8.1
|
||||
github.com/pkg/errors
|
||||
# github.com/pmezard/go-difflib v1.0.0
|
||||
|
@ -291,8 +284,6 @@ github.com/prometheus/tsdb/goversion
|
|||
github.com/prometheus/tsdb/index
|
||||
# github.com/samuel/go-zookeeper v0.0.0-20161028232340-1d7be4effb13
|
||||
github.com/samuel/go-zookeeper/zk
|
||||
# github.com/sasha-s/go-deadlock v0.0.0-20161201235124-341000892f3d
|
||||
github.com/sasha-s/go-deadlock
|
||||
# github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371
|
||||
github.com/shurcooL/httpfs/filter
|
||||
github.com/shurcooL/httpfs/union
|
||||
|
|
|
@ -24,7 +24,6 @@ import (
|
|||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/cockroachdb/cockroach/pkg/util/protoutil"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prometheus/tsdb"
|
||||
|
@ -65,7 +64,7 @@ func (api *API) RegisterGRPC(srv *grpc.Server) {
|
|||
|
||||
// HTTPHandler returns an HTTP handler for a REST API gateway to the given grpc address.
|
||||
func (api *API) HTTPHandler(ctx context.Context, grpcAddr string) (http.Handler, error) {
|
||||
enc := new(protoutil.JSONPb)
|
||||
enc := new(runtime.JSONPb)
|
||||
mux := runtime.NewServeMux(runtime.WithMarshalerOption(enc.ContentType(), enc))
|
||||
|
||||
opts := []grpc.DialOption{
|
||||
|
|
Loading…
Reference in a new issue