starpc 0.41.2 → 0.43.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -20
- package/dist/mock/mock.pb.d.ts +1 -1
- package/dist/mock/mock.pb.js +4 -5
- package/dist/mock/mock_srpc.pb.d.ts +3 -3
- package/dist/mock/mock_srpc.pb.js +5 -5
- package/echo/Cargo.toml +21 -0
- package/echo/build.rs +15 -0
- package/echo/echo.pb.cc +405 -0
- package/echo/echo.pb.go +9 -27
- package/echo/echo.pb.h +364 -0
- package/echo/echo_srpc.pb.go +1 -1
- package/echo/gen/mod.rs +3 -0
- package/echo/main.rs +162 -0
- package/go.mod +18 -10
- package/go.sum +28 -18
- package/mock/mock.pb.cc +394 -0
- package/mock/mock.pb.go +9 -27
- package/mock/mock.pb.h +366 -0
- package/mock/mock.pb.ts +11 -13
- package/mock/mock_srpc.pb.go +1 -1
- package/mock/mock_srpc.pb.ts +12 -9
- package/package.json +27 -25
- package/srpc/Cargo.toml +26 -0
- package/srpc/build.rs +15 -0
- package/srpc/client.rs +356 -0
- package/srpc/codec.rs +225 -0
- package/srpc/error.rs +177 -0
- package/srpc/handler.rs +163 -0
- package/srpc/invoker.rs +192 -0
- package/srpc/lib.rs +107 -0
- package/srpc/message.rs +9 -0
- package/srpc/mux.rs +353 -0
- package/srpc/packet.rs +334 -0
- package/srpc/proto/mod.rs +10 -0
- package/srpc/rpc.rs +777 -0
- package/srpc/rpcproto.pb.cc +1381 -0
- package/srpc/rpcproto.pb.go +75 -183
- package/srpc/rpcproto.pb.h +1451 -0
- package/srpc/server.rs +337 -0
- package/srpc/stream.rs +304 -0
- package/srpc/testing.rs +290 -0
- package/srpc/tests/integration_test.rs +495 -0
- package/srpc/transport.rs +218 -0
- package/Makefile +0 -154
package/Makefile
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
# https://github.com/aperturerobotics/template
|
|
2
|
-
|
|
3
|
-
SHELL:=bash
|
|
4
|
-
PROTOWRAP=tools/bin/protowrap
|
|
5
|
-
PROTOC_GEN_GO=tools/bin/protoc-gen-go-lite
|
|
6
|
-
PROTOC_GEN_STARPC=tools/bin/protoc-gen-go-starpc
|
|
7
|
-
GOIMPORTS=tools/bin/goimports
|
|
8
|
-
GOFUMPT=tools/bin/gofumpt
|
|
9
|
-
GOLANGCI_LINT=tools/bin/golangci-lint
|
|
10
|
-
GO_MOD_OUTDATED=tools/bin/go-mod-outdated
|
|
11
|
-
GOLIST=go list -f "{{ .Dir }}" -m
|
|
12
|
-
|
|
13
|
-
export GO111MODULE=on
|
|
14
|
-
undefine GOARCH
|
|
15
|
-
undefine GOOS
|
|
16
|
-
|
|
17
|
-
all:
|
|
18
|
-
|
|
19
|
-
vendor:
|
|
20
|
-
go mod vendor
|
|
21
|
-
|
|
22
|
-
$(PROTOC_GEN_GO):
|
|
23
|
-
cd ./tools; \
|
|
24
|
-
go build -v \
|
|
25
|
-
-o ./bin/protoc-gen-go-lite \
|
|
26
|
-
github.com/aperturerobotics/protobuf-go-lite/cmd/protoc-gen-go-lite
|
|
27
|
-
|
|
28
|
-
$(GOIMPORTS):
|
|
29
|
-
cd ./tools; \
|
|
30
|
-
go build -v \
|
|
31
|
-
-o ./bin/goimports \
|
|
32
|
-
golang.org/x/tools/cmd/goimports
|
|
33
|
-
|
|
34
|
-
$(GOFUMPT):
|
|
35
|
-
cd ./tools; \
|
|
36
|
-
go build -v \
|
|
37
|
-
-o ./bin/gofumpt \
|
|
38
|
-
mvdan.cc/gofumpt
|
|
39
|
-
|
|
40
|
-
$(PROTOWRAP):
|
|
41
|
-
cd ./tools; \
|
|
42
|
-
go build -v \
|
|
43
|
-
-o ./bin/protowrap \
|
|
44
|
-
github.com/aperturerobotics/goprotowrap/cmd/protowrap
|
|
45
|
-
|
|
46
|
-
$(GOLANGCI_LINT):
|
|
47
|
-
cd ./tools; \
|
|
48
|
-
go build -v \
|
|
49
|
-
-o ./bin/golangci-lint \
|
|
50
|
-
github.com/golangci/golangci-lint/v2/cmd/golangci-lint
|
|
51
|
-
|
|
52
|
-
$(GO_MOD_OUTDATED):
|
|
53
|
-
cd ./tools; \
|
|
54
|
-
go build -v \
|
|
55
|
-
-o ./bin/go-mod-outdated \
|
|
56
|
-
github.com/psampaz/go-mod-outdated
|
|
57
|
-
|
|
58
|
-
$(PROTOC_GEN_STARPC):
|
|
59
|
-
cd ./tools; \
|
|
60
|
-
go build -v \
|
|
61
|
-
-o ./bin/protoc-gen-go-starpc \
|
|
62
|
-
github.com/aperturerobotics/starpc/cmd/protoc-gen-go-starpc
|
|
63
|
-
|
|
64
|
-
node_modules:
|
|
65
|
-
yarn install
|
|
66
|
-
|
|
67
|
-
.PHONY: genproto
|
|
68
|
-
genproto: vendor node_modules $(GOIMPORTS) $(PROTOWRAP) $(PROTOC_GEN_GO) $(PROTOC_GEN_STARPC)
|
|
69
|
-
shopt -s globstar; \
|
|
70
|
-
set -eo pipefail; \
|
|
71
|
-
export PROTOBUF_GO_TYPES_PKG=github.com/aperturerobotics/protobuf-go-lite/types; \
|
|
72
|
-
export PROJECT=$$(go list -m); \
|
|
73
|
-
export PATH=$$(pwd)/tools/bin:$${PATH}; \
|
|
74
|
-
export OUT=./vendor; \
|
|
75
|
-
mkdir -p $${OUT}/$$(dirname $${PROJECT}); \
|
|
76
|
-
rm ./vendor/$${PROJECT} || true; \
|
|
77
|
-
ln -s $$(pwd) ./vendor/$${PROJECT} ; \
|
|
78
|
-
protogen() { \
|
|
79
|
-
PROTO_FILES=$$(git ls-files "$$1"); \
|
|
80
|
-
$(PROTOWRAP) \
|
|
81
|
-
-I $${OUT} \
|
|
82
|
-
--plugin=./node_modules/.bin/protoc-gen-es-lite \
|
|
83
|
-
--plugin=./cmd/protoc-gen-es-starpc/dev/protoc-gen-es-starpc \
|
|
84
|
-
--go-lite_out=$${OUT} \
|
|
85
|
-
--go-lite_opt=features=marshal+unmarshal+size+equal+json+clone+text \
|
|
86
|
-
--es-lite_out=$${OUT} \
|
|
87
|
-
--es-lite_opt target=ts \
|
|
88
|
-
--es-lite_opt ts_nocheck=false \
|
|
89
|
-
--go-starpc_out=$${OUT} \
|
|
90
|
-
--es-starpc_out=$${OUT} \
|
|
91
|
-
--es-starpc_opt target=ts \
|
|
92
|
-
--es-starpc_opt ts_nocheck=false \
|
|
93
|
-
--proto_path $${OUT} \
|
|
94
|
-
--print_structure \
|
|
95
|
-
--only_specified_files \
|
|
96
|
-
$$(echo "$$PROTO_FILES" | xargs printf -- "./vendor/$${PROJECT}/%s "); \
|
|
97
|
-
for proto_file in $${PROTO_FILES}; do \
|
|
98
|
-
proto_dir=$$(dirname $$proto_file); \
|
|
99
|
-
proto_name=$${proto_file%".proto"}; \
|
|
100
|
-
TS_FILES=$$(git ls-files ":(glob)$${proto_dir}/${proto_name}*_pb.ts"); \
|
|
101
|
-
if [ -z "$$TS_FILES" ]; then continue; fi; \
|
|
102
|
-
for ts_file in $${TS_FILES}; do \
|
|
103
|
-
prettier -w $$ts_file; \
|
|
104
|
-
ts_file_dir=$$(dirname $$ts_file); \
|
|
105
|
-
relative_path=$${ts_file_dir#"./"}; \
|
|
106
|
-
depth=$$(echo $$relative_path | awk -F/ '{print NF+1}'); \
|
|
107
|
-
prefix=$$(printf '../%0.s' $$(seq 1 $$depth)); \
|
|
108
|
-
istmts=$$(grep -oE "from\s+\"$$prefix[^\"]+\"" $$ts_file) || continue; \
|
|
109
|
-
if [ -z "$$istmts" ]; then continue; fi; \
|
|
110
|
-
ipaths=$$(echo "$$istmts" | awk -F'"' '{print $$2}'); \
|
|
111
|
-
for import_path in $$ipaths; do \
|
|
112
|
-
rel_import_path=$$(realpath -s --relative-to=./vendor \
|
|
113
|
-
"./vendor/$${PROJECT}/$${ts_file_dir}/$${import_path}"); \
|
|
114
|
-
go_import_path=$$(echo $$rel_import_path | sed -e "s|^|@go/|"); \
|
|
115
|
-
sed -i -e "s|$$import_path|$$go_import_path|g" $$ts_file; \
|
|
116
|
-
done; \
|
|
117
|
-
done; \
|
|
118
|
-
done; \
|
|
119
|
-
}; \
|
|
120
|
-
protogen "./*.proto"; \
|
|
121
|
-
rm -f ./vendor/$${PROJECT}
|
|
122
|
-
$(GOIMPORTS) -w ./
|
|
123
|
-
|
|
124
|
-
.PHONY: gen
|
|
125
|
-
gen: genproto
|
|
126
|
-
|
|
127
|
-
.PHONY: outdated
|
|
128
|
-
outdated: $(GO_MOD_OUTDATED)
|
|
129
|
-
go list -mod=mod -u -m -json all | $(GO_MOD_OUTDATED) -update -direct
|
|
130
|
-
|
|
131
|
-
.PHONY: list
|
|
132
|
-
list: $(GO_MOD_OUTDATED)
|
|
133
|
-
go list -mod=mod -u -m -json all | $(GO_MOD_OUTDATED)
|
|
134
|
-
|
|
135
|
-
.PHONY: lint
|
|
136
|
-
lint: $(GOLANGCI_LINT)
|
|
137
|
-
$(GOLANGCI_LINT) run
|
|
138
|
-
|
|
139
|
-
.PHONY: fix
|
|
140
|
-
fix: $(GOLANGCI_LINT)
|
|
141
|
-
$(GOLANGCI_LINT) run --fix
|
|
142
|
-
|
|
143
|
-
.PHONY: test
|
|
144
|
-
test:
|
|
145
|
-
go test -v ./...
|
|
146
|
-
|
|
147
|
-
.PHONY: format
|
|
148
|
-
format: $(GOFUMPT) $(GOIMPORTS)
|
|
149
|
-
$(GOIMPORTS) -w ./
|
|
150
|
-
$(GOFUMPT) -w ./
|
|
151
|
-
|
|
152
|
-
.PHONY: integration
|
|
153
|
-
integration: node_modules vendor
|
|
154
|
-
cd ./integration && bash ./integration.bash
|