Skip to content

Commit 0ee0777

Browse files
committed
feat:add the third_party and the code generate tool
1 parent be000b3 commit 0ee0777

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+10419
-0
lines changed

api/user/v1/user.proto

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import "google/protobuf/empty.proto";
33
option go_package = "./;v1";
44

55
// protoc --proto_path=. --go_out=. --go-grpc_out=require_unimplemented_servers=false:. user.proto
6+
//protoc -I. --proto_path=../../../third_party --go_out=. --go-grpc_out=require_unimplemented_servers=false:. --gin_out=. user.proto 注意子路径 v1等
7+
//protoc -I. --proto_path=../../../third_party --go_out=. --go-grpc_out=. --gin_out=. user.proto 注意子路径 v1等
68
service User{
79
rpc GetUserList(PageInfo) returns (UserListResponse); // 用户列表
810
rpc GetUserByMobile(MobileRequest) returns (UserInfoResponse); //通过mobile查询用户

third_party/CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#### Version 1.0.1
2+
3+
> 1.gogo.protobuf迁移到third_party/github目录下
4+
5+
#### Version 1.0.0
6+
7+
> 1.添加 gogo proto

third_party/forked/murmur3/.gitignore

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Compiled Object files, Static and Dynamic libs (Shared Objects)
2+
*.o
3+
*.a
4+
*.so
5+
6+
# Folders
7+
_obj
8+
_test
9+
10+
# Architecture specific extensions/prefixes
11+
*.[568vq]
12+
[568vq].out
13+
14+
*.cgo1.go
15+
*.cgo2.c
16+
_cgo_defun.c
17+
_cgo_gotypes.go
18+
_cgo_export.*
19+
20+
_testmain.go
21+
22+
*.exe
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language: go
2+
3+
go:
4+
- 1.x
5+
- master
6+
7+
script: go test

third_party/forked/murmur3/LICENSE

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Copyright 2013, Sébastien Paolacci.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
* Redistributions of source code must retain the above copyright
7+
notice, this list of conditions and the following disclaimer.
8+
* Redistributions in binary form must reproduce the above copyright
9+
notice, this list of conditions and the following disclaimer in the
10+
documentation and/or other materials provided with the distribution.
11+
* Neither the name of the library nor the
12+
names of its contributors may be used to endorse or promote products
13+
derived from this software without specific prior written permission.
14+
15+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18+
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
19+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

third_party/forked/murmur3/README.md

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
murmur3
2+
=======
3+
4+
[![Build Status](https://travis-ci.org/spaolacci/murmur3.svg?branch=master)](https://travis-ci.org/spaolacci/murmur3)
5+
6+
Native Go implementation of Austin Appleby's third MurmurHash revision (aka
7+
MurmurHash3).
8+
9+
Reference algorithm has been slightly hacked as to support the streaming mode
10+
required by Go's standard [Hash interface](http://golang.org/pkg/hash/#Hash).
11+
12+
13+
Benchmarks
14+
----------
15+
16+
Go tip as of 2014-06-12 (i.e almost go1.3), core i7 @ 3.4 Ghz. All runs
17+
include hasher instantiation and sequence finalization.
18+
19+
<pre>
20+
21+
Benchmark32_1 500000000 7.69 ns/op 130.00 MB/s
22+
Benchmark32_2 200000000 8.83 ns/op 226.42 MB/s
23+
Benchmark32_4 500000000 7.99 ns/op 500.39 MB/s
24+
Benchmark32_8 200000000 9.47 ns/op 844.69 MB/s
25+
Benchmark32_16 100000000 12.1 ns/op 1321.61 MB/s
26+
Benchmark32_32 100000000 18.3 ns/op 1743.93 MB/s
27+
Benchmark32_64 50000000 30.9 ns/op 2071.64 MB/s
28+
Benchmark32_128 50000000 57.6 ns/op 2222.96 MB/s
29+
Benchmark32_256 20000000 116 ns/op 2188.60 MB/s
30+
Benchmark32_512 10000000 226 ns/op 2260.59 MB/s
31+
Benchmark32_1024 5000000 452 ns/op 2263.73 MB/s
32+
Benchmark32_2048 2000000 891 ns/op 2296.02 MB/s
33+
Benchmark32_4096 1000000 1787 ns/op 2290.92 MB/s
34+
Benchmark32_8192 500000 3593 ns/op 2279.68 MB/s
35+
Benchmark128_1 100000000 26.1 ns/op 38.33 MB/s
36+
Benchmark128_2 100000000 29.0 ns/op 69.07 MB/s
37+
Benchmark128_4 50000000 29.8 ns/op 134.17 MB/s
38+
Benchmark128_8 50000000 31.6 ns/op 252.86 MB/s
39+
Benchmark128_16 100000000 26.5 ns/op 603.42 MB/s
40+
Benchmark128_32 100000000 28.6 ns/op 1117.15 MB/s
41+
Benchmark128_64 50000000 35.5 ns/op 1800.97 MB/s
42+
Benchmark128_128 50000000 50.9 ns/op 2515.50 MB/s
43+
Benchmark128_256 20000000 76.9 ns/op 3330.11 MB/s
44+
Benchmark128_512 20000000 135 ns/op 3769.09 MB/s
45+
Benchmark128_1024 10000000 250 ns/op 4094.38 MB/s
46+
Benchmark128_2048 5000000 477 ns/op 4290.75 MB/s
47+
Benchmark128_4096 2000000 940 ns/op 4353.29 MB/s
48+
Benchmark128_8192 1000000 1838 ns/op 4455.47 MB/s
49+
50+
</pre>
51+
52+
53+
<pre>
54+
55+
benchmark Go1.0 MB/s Go1.1 MB/s speedup Go1.2 MB/s speedup Go1.3 MB/s speedup
56+
Benchmark32_1 98.90 118.59 1.20x 114.79 0.97x 130.00 1.13x
57+
Benchmark32_2 168.04 213.31 1.27x 210.65 0.99x 226.42 1.07x
58+
Benchmark32_4 414.01 494.19 1.19x 490.29 0.99x 500.39 1.02x
59+
Benchmark32_8 662.19 836.09 1.26x 836.46 1.00x 844.69 1.01x
60+
Benchmark32_16 917.46 1304.62 1.42x 1297.63 0.99x 1321.61 1.02x
61+
Benchmark32_32 1141.93 1737.54 1.52x 1728.24 0.99x 1743.93 1.01x
62+
Benchmark32_64 1289.47 2039.51 1.58x 2038.20 1.00x 2071.64 1.02x
63+
Benchmark32_128 1299.23 2097.63 1.61x 2177.13 1.04x 2222.96 1.02x
64+
Benchmark32_256 1369.90 2202.34 1.61x 2213.15 1.00x 2188.60 0.99x
65+
Benchmark32_512 1399.56 2255.72 1.61x 2264.49 1.00x 2260.59 1.00x
66+
Benchmark32_1024 1410.90 2285.82 1.62x 2270.99 0.99x 2263.73 1.00x
67+
Benchmark32_2048 1422.14 2297.62 1.62x 2269.59 0.99x 2296.02 1.01x
68+
Benchmark32_4096 1420.53 2307.81 1.62x 2273.43 0.99x 2290.92 1.01x
69+
Benchmark32_8192 1424.79 2312.87 1.62x 2286.07 0.99x 2279.68 1.00x
70+
Benchmark128_1 8.32 30.15 3.62x 30.84 1.02x 38.33 1.24x
71+
Benchmark128_2 16.38 59.72 3.65x 59.37 0.99x 69.07 1.16x
72+
Benchmark128_4 32.26 112.96 3.50x 114.24 1.01x 134.17 1.17x
73+
Benchmark128_8 62.68 217.88 3.48x 218.18 1.00x 252.86 1.16x
74+
Benchmark128_16 128.47 451.57 3.51x 474.65 1.05x 603.42 1.27x
75+
Benchmark128_32 246.18 910.42 3.70x 871.06 0.96x 1117.15 1.28x
76+
Benchmark128_64 449.05 1477.64 3.29x 1449.24 0.98x 1800.97 1.24x
77+
Benchmark128_128 762.61 2222.42 2.91x 2217.30 1.00x 2515.50 1.13x
78+
Benchmark128_256 1179.92 3005.46 2.55x 2931.55 0.98x 3330.11 1.14x
79+
Benchmark128_512 1616.51 3590.75 2.22x 3592.08 1.00x 3769.09 1.05x
80+
Benchmark128_1024 1964.36 3979.67 2.03x 4034.01 1.01x 4094.38 1.01x
81+
Benchmark128_2048 2225.07 4156.93 1.87x 4244.17 1.02x 4290.75 1.01x
82+
Benchmark128_4096 2360.15 4299.09 1.82x 4392.35 1.02x 4353.29 0.99x
83+
Benchmark128_8192 2411.50 4356.84 1.81x 4480.68 1.03x 4455.47 0.99x
84+
85+
</pre>
86+

third_party/forked/murmur3/murmur.go

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
Package murmur3 implements Austin Appleby's non-cryptographic MurmurHash3.
3+
4+
Reference implementation:
5+
http://code.google.com/p/smhasher/wiki/MurmurHash3
6+
7+
History, characteristics and (legacy) perfs:
8+
https://sites.google.com/site/murmurhash/
9+
https://sites.google.com/site/murmurhash/statistics
10+
*/
11+
package murmur3
12+
13+
type bmixer interface {
14+
bmix(p []byte) (tail []byte)
15+
Size() (n int)
16+
reset()
17+
}
18+
19+
type digest struct {
20+
clen int // Digested input cumulative length.
21+
tail []byte // 0 to Size()-1 bytes view of `buf'.
22+
buf [16]byte // Expected (but not required) to be Size() large.
23+
seed uint32 // Seed for initializing the hash.
24+
bmixer
25+
}
26+
27+
func (d *digest) BlockSize() int { return 1 }
28+
29+
func (d *digest) Write(p []byte) (n int, err error) {
30+
n = len(p)
31+
d.clen += n
32+
33+
if len(d.tail) > 0 {
34+
// Stick back pending bytes.
35+
nfree := d.Size() - len(d.tail) // nfree ∈ [1, d.Size()-1].
36+
if nfree < len(p) {
37+
// One full block can be formed.
38+
block := append(d.tail, p[:nfree]...)
39+
p = p[nfree:]
40+
_ = d.bmix(block) // No tail.
41+
} else {
42+
// Tail's buf is large enough to prevent reallocs.
43+
p = append(d.tail, p...)
44+
}
45+
}
46+
47+
d.tail = d.bmix(p)
48+
49+
// Keep own copy of the 0 to Size()-1 pending bytes.
50+
nn := copy(d.buf[:], d.tail)
51+
d.tail = d.buf[:nn]
52+
53+
return n, nil
54+
}
55+
56+
func (d *digest) Reset() {
57+
d.clen = 0
58+
d.tail = nil
59+
d.bmixer.reset()
60+
}

0 commit comments

Comments
 (0)