pbio 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +14 -4
- data/Gemfile.lock +25 -20
- data/LICENSE +1 -1
- data/Makefile +6 -0
- data/go.mod +9 -0
- data/go.sum +99 -0
- data/pbio.gemspec +1 -1
- data/pbio.go +74 -0
- data/pbio_test.go +82 -0
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 196e40074dc6c976fdbe3baa82798d5a16d6306f888ab23f6e5f7d787e7ff738
|
4
|
+
data.tar.gz: 409ccd274f900c6aece878f22b9b77ad067745f595243ee91ae6d63c6282ff9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67b446b5d48100205542e92d63dd1502fd7f45984459920ed095301ee1259de121e5e1a35d9add4ebc4efae7fa60d6d562b71480cfb2cff673a56a0155075f3b
|
7
|
+
data.tar.gz: 6af99307c3c1a263cd73240b4e407afde9c1e70712f5d597aea39199304c092df4c1d2d24e222bdcac90ecf7f69a9a854ff6be0636ebf9a88ef463678bf8aaf3
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,45 +1,50 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pbio (0.2.
|
4
|
+
pbio (0.2.2)
|
5
5
|
google-protobuf
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
ast (2.4.
|
11
|
-
diff-lcs (1.
|
12
|
-
google-protobuf (3.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
ast (~> 2.4.0)
|
10
|
+
ast (2.4.1)
|
11
|
+
diff-lcs (1.4.4)
|
12
|
+
google-protobuf (3.13.0)
|
13
|
+
parallel (1.19.2)
|
14
|
+
parser (2.7.1.4)
|
15
|
+
ast (~> 2.4.1)
|
17
16
|
rainbow (3.0.0)
|
18
17
|
rake (13.0.1)
|
18
|
+
regexp_parser (1.7.1)
|
19
|
+
rexml (3.2.4)
|
19
20
|
rspec (3.9.0)
|
20
21
|
rspec-core (~> 3.9.0)
|
21
22
|
rspec-expectations (~> 3.9.0)
|
22
23
|
rspec-mocks (~> 3.9.0)
|
23
|
-
rspec-core (3.9.
|
24
|
-
rspec-support (~> 3.9.
|
25
|
-
rspec-expectations (3.9.
|
24
|
+
rspec-core (3.9.2)
|
25
|
+
rspec-support (~> 3.9.3)
|
26
|
+
rspec-expectations (3.9.2)
|
26
27
|
diff-lcs (>= 1.2.0, < 2.0)
|
27
28
|
rspec-support (~> 3.9.0)
|
28
29
|
rspec-mocks (3.9.1)
|
29
30
|
diff-lcs (>= 1.2.0, < 2.0)
|
30
31
|
rspec-support (~> 3.9.0)
|
31
|
-
rspec-support (3.9.
|
32
|
-
rubocop (0.
|
33
|
-
jaro_winkler (~> 1.5.1)
|
32
|
+
rspec-support (3.9.3)
|
33
|
+
rubocop (0.90.0)
|
34
34
|
parallel (~> 1.10)
|
35
|
-
parser (>= 2.7.
|
35
|
+
parser (>= 2.7.1.1)
|
36
36
|
rainbow (>= 2.2.2, < 4.0)
|
37
|
+
regexp_parser (>= 1.7)
|
38
|
+
rexml
|
39
|
+
rubocop-ast (>= 0.3.0, < 1.0)
|
37
40
|
ruby-progressbar (~> 1.7)
|
38
|
-
unicode-display_width (>= 1.4.0, <
|
39
|
-
rubocop-
|
40
|
-
|
41
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
42
|
+
rubocop-ast (0.3.0)
|
43
|
+
parser (>= 2.7.1.4)
|
44
|
+
rubocop-performance (1.8.0)
|
45
|
+
rubocop (>= 0.87.0)
|
41
46
|
ruby-progressbar (1.10.1)
|
42
|
-
unicode-display_width (1.
|
47
|
+
unicode-display_width (1.7.0)
|
43
48
|
|
44
49
|
PLATFORMS
|
45
50
|
ruby
|
@@ -53,4 +58,4 @@ DEPENDENCIES
|
|
53
58
|
rubocop-performance
|
54
59
|
|
55
60
|
BUNDLED WITH
|
56
|
-
2.1.
|
61
|
+
2.1.4
|
data/LICENSE
CHANGED
data/Makefile
ADDED
data/go.mod
ADDED
data/go.sum
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
2
|
+
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
3
|
+
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
4
|
+
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
5
|
+
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
6
|
+
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
7
|
+
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
8
|
+
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
9
|
+
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
10
|
+
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
11
|
+
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
12
|
+
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
13
|
+
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
14
|
+
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
15
|
+
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
16
|
+
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
17
|
+
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
18
|
+
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
19
|
+
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
20
|
+
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
21
|
+
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
22
|
+
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
23
|
+
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
24
|
+
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
25
|
+
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
26
|
+
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
27
|
+
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
|
28
|
+
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
29
|
+
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
30
|
+
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
|
31
|
+
github.com/onsi/ginkgo v1.14.1 h1:jMU0WaQrP0a/YAEq8eJmJKjBoMs+pClEr1vDMlM/Do4=
|
32
|
+
github.com/onsi/ginkgo v1.14.1/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
|
33
|
+
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
34
|
+
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
35
|
+
github.com/onsi/gomega v1.10.2 h1:aY/nuoWlKJud2J6U0E3NWsjlg+0GtwXxgEqthRdzlcs=
|
36
|
+
github.com/onsi/gomega v1.10.2/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
37
|
+
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
38
|
+
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
39
|
+
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
40
|
+
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
41
|
+
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
42
|
+
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
43
|
+
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
44
|
+
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
45
|
+
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
46
|
+
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
47
|
+
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
48
|
+
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7 h1:AeiKBIuRw3UomYXSbLy0Mc2dDLfdtbT/IVn4keq83P0=
|
49
|
+
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
50
|
+
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
51
|
+
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
52
|
+
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
53
|
+
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
54
|
+
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
55
|
+
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
56
|
+
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
57
|
+
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
58
|
+
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
59
|
+
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
60
|
+
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
61
|
+
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 h1:DYfZAGf2WMFjMxbgTjaC+2HC7NkNAQs+6Q8b9WEB/F4=
|
62
|
+
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
63
|
+
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
64
|
+
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
65
|
+
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
66
|
+
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
67
|
+
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
68
|
+
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
69
|
+
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
70
|
+
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
71
|
+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
72
|
+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
73
|
+
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
74
|
+
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
75
|
+
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
76
|
+
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
77
|
+
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
78
|
+
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
79
|
+
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
80
|
+
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
81
|
+
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
82
|
+
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
83
|
+
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
84
|
+
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
85
|
+
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
86
|
+
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
87
|
+
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
88
|
+
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
89
|
+
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
|
90
|
+
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
91
|
+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
92
|
+
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
93
|
+
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
94
|
+
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
95
|
+
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
96
|
+
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
97
|
+
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
98
|
+
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
99
|
+
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
data/pbio.gemspec
CHANGED
data/pbio.go
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
package pbio
|
2
|
+
|
3
|
+
import (
|
4
|
+
"bufio"
|
5
|
+
"encoding/binary"
|
6
|
+
"io"
|
7
|
+
|
8
|
+
"google.golang.org/protobuf/proto"
|
9
|
+
)
|
10
|
+
|
11
|
+
// Encoder encodes protobuf messages and writes to the underlying writer.
|
12
|
+
type Encoder struct {
|
13
|
+
w io.Writer
|
14
|
+
buf []byte
|
15
|
+
}
|
16
|
+
|
17
|
+
// NewEncoder inits a new encoder.
|
18
|
+
func NewEncoder(w io.Writer) *Encoder {
|
19
|
+
return &Encoder{
|
20
|
+
w: w,
|
21
|
+
buf: make([]byte, binary.MaxVarintLen64),
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
// Encode encodes a message.
|
26
|
+
func (e *Encoder) Encode(msg proto.Message) error {
|
27
|
+
opt := proto.MarshalOptions{}
|
28
|
+
sz := opt.Size(msg)
|
29
|
+
e.buf = e.buf[:binary.PutUvarint(e.buf, uint64(sz))]
|
30
|
+
|
31
|
+
data, err := opt.MarshalAppend(e.buf, msg)
|
32
|
+
if err != nil {
|
33
|
+
return err
|
34
|
+
}
|
35
|
+
e.buf = data
|
36
|
+
|
37
|
+
_, err = e.w.Write(data)
|
38
|
+
return err
|
39
|
+
}
|
40
|
+
|
41
|
+
// --------------------------------------------------------------------
|
42
|
+
|
43
|
+
// Decoder decodes protobuf messages from an underlying reader.
|
44
|
+
type Decoder struct {
|
45
|
+
r *bufio.Reader
|
46
|
+
buf []byte
|
47
|
+
}
|
48
|
+
|
49
|
+
// NewDecoder inits a new Decoder.
|
50
|
+
func NewDecoder(r io.Reader) *Decoder {
|
51
|
+
return &Decoder{
|
52
|
+
r: bufio.NewReader(r),
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
// Decode decodes a message.
|
57
|
+
func (d *Decoder) Decode(msg proto.Message) error {
|
58
|
+
sz, err := binary.ReadUvarint(d.r)
|
59
|
+
if err != nil {
|
60
|
+
return err
|
61
|
+
}
|
62
|
+
|
63
|
+
if n := int(sz); cap(d.buf) < n {
|
64
|
+
d.buf = make([]byte, n)
|
65
|
+
} else {
|
66
|
+
d.buf = d.buf[:n]
|
67
|
+
}
|
68
|
+
if _, err := io.ReadFull(d.r, d.buf); err != nil {
|
69
|
+
return err
|
70
|
+
}
|
71
|
+
|
72
|
+
opt := proto.UnmarshalOptions{}
|
73
|
+
return opt.Unmarshal(d.buf, msg)
|
74
|
+
}
|
data/pbio_test.go
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
package pbio_test
|
2
|
+
|
3
|
+
import (
|
4
|
+
"bytes"
|
5
|
+
"testing"
|
6
|
+
|
7
|
+
"github.com/bsm/pbio"
|
8
|
+
. "github.com/onsi/ginkgo"
|
9
|
+
. "github.com/onsi/gomega"
|
10
|
+
"google.golang.org/protobuf/types/known/structpb"
|
11
|
+
)
|
12
|
+
|
13
|
+
var message, _ = structpb.NewValue(map[string]interface{}{
|
14
|
+
"firstName": "John",
|
15
|
+
"lastName": "Smith",
|
16
|
+
"isAlive": true,
|
17
|
+
"age": 27,
|
18
|
+
"address": map[string]interface{}{
|
19
|
+
"streetAddress": "21 2nd Street",
|
20
|
+
"city": "New York",
|
21
|
+
"state": "NY",
|
22
|
+
"postalCode": "10021-3100",
|
23
|
+
},
|
24
|
+
})
|
25
|
+
|
26
|
+
var _ = Describe("Encoder", func() {
|
27
|
+
var subject *pbio.Encoder
|
28
|
+
var buf *bytes.Buffer
|
29
|
+
|
30
|
+
BeforeEach(func() {
|
31
|
+
buf = new(bytes.Buffer)
|
32
|
+
subject = pbio.NewEncoder(buf)
|
33
|
+
})
|
34
|
+
|
35
|
+
It("should encode", func() {
|
36
|
+
Expect(subject.Encode(message)).To(Succeed())
|
37
|
+
Expect(buf.Len()).To(BeNumerically("~", 192, 20))
|
38
|
+
Expect(subject.Encode(message)).To(Succeed())
|
39
|
+
Expect(buf.Len()).To(BeNumerically("~", 384, 20))
|
40
|
+
})
|
41
|
+
})
|
42
|
+
|
43
|
+
var _ = Describe("Decoder", func() {
|
44
|
+
var subject *pbio.Decoder
|
45
|
+
|
46
|
+
BeforeEach(func() {
|
47
|
+
buf := new(bytes.Buffer)
|
48
|
+
enc := pbio.NewEncoder(buf)
|
49
|
+
Expect(enc.Encode(message)).To(Succeed())
|
50
|
+
Expect(enc.Encode(message)).To(Succeed())
|
51
|
+
|
52
|
+
subject = pbio.NewDecoder(buf)
|
53
|
+
})
|
54
|
+
|
55
|
+
It("should decode", func() {
|
56
|
+
m1 := new(structpb.Value)
|
57
|
+
Expect(subject.Decode(m1)).To(Succeed())
|
58
|
+
Expect(m1.MarshalJSON()).To(MatchJSON(`{
|
59
|
+
"firstName":"John",
|
60
|
+
"lastName":"Smith",
|
61
|
+
"isAlive":true,
|
62
|
+
"age":27,
|
63
|
+
"address":{
|
64
|
+
"city":"New York",
|
65
|
+
"postalCode":"10021-3100",
|
66
|
+
"state":"NY",
|
67
|
+
"streetAddress":"21 2nd Street"
|
68
|
+
}
|
69
|
+
}`))
|
70
|
+
|
71
|
+
m2 := new(structpb.Value)
|
72
|
+
Expect(subject.Decode(m2)).To(Succeed())
|
73
|
+
|
74
|
+
m3 := new(structpb.Value)
|
75
|
+
Expect(subject.Decode(m3)).To(MatchError(`EOF`))
|
76
|
+
})
|
77
|
+
})
|
78
|
+
|
79
|
+
func TestSuite(t *testing.T) {
|
80
|
+
RegisterFailHandler(Fail)
|
81
|
+
RunSpecs(t, "pbio")
|
82
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pbio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitrij Denissenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-protobuf
|
@@ -107,11 +107,16 @@ files:
|
|
107
107
|
- Gemfile
|
108
108
|
- Gemfile.lock
|
109
109
|
- LICENSE
|
110
|
+
- Makefile
|
110
111
|
- README.md
|
111
112
|
- Rakefile
|
113
|
+
- go.mod
|
114
|
+
- go.sum
|
112
115
|
- lib/pbio.rb
|
113
116
|
- lib/pbio/delimited.rb
|
114
117
|
- pbio.gemspec
|
118
|
+
- pbio.go
|
119
|
+
- pbio_test.go
|
115
120
|
- spec/lib/pbio/delimited_spec.rb
|
116
121
|
- spec/spec_helper.rb
|
117
122
|
homepage: https://github.com/bsm/pbio
|
@@ -133,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
138
|
- !ruby/object:Gem::Version
|
134
139
|
version: '0'
|
135
140
|
requirements: []
|
136
|
-
rubygems_version: 3.
|
141
|
+
rubygems_version: 3.1.2
|
137
142
|
signing_key:
|
138
143
|
specification_version: 4
|
139
144
|
summary: Protobuf Streaming
|