Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9e2dfc2
commit 1db8b2c
Showing
13 changed files
with
4,307 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bin/ | ||
tmp-protoc/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
gomod := github.com/mattrobenolt/ps-http-sim | ||
|
||
PSDB_PROTO_OUT := types | ||
PSDB_PROTO_ROOT := $(PSDB_PROTO_OUT)/psdb | ||
PSDB_V1ALPHA1 := $(PSDB_PROTO_ROOT)/v1alpha1 | ||
|
||
PROTOC_VERSION=21.5 | ||
|
||
BIN := bin | ||
|
||
UNAME_OS := $(shell uname -s) | ||
UNAME_ARCH := $(shell uname -m) | ||
|
||
proto: \ | ||
$(PSDB_V1ALPHA1)/database.pb.go | ||
|
||
clean: clean-proto clean-bin | ||
|
||
clean-proto: | ||
rm -rf $(PSDB_PROTO_OUT) | ||
|
||
clean-bin: | ||
rm -rf $(BIN) | ||
|
||
$(BIN): | ||
mkdir -p $(BIN) | ||
|
||
$(PSDB_PROTO_OUT): | ||
mkdir -p $(PSDB_PROTO_OUT) | ||
|
||
GO_INSTALL := env GOBIN=$(PWD)/$(BIN) go install | ||
|
||
$(BIN)/protoc-gen-go: Makefile | $(BIN) | ||
$(GO_INSTALL) google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1 | ||
|
||
$(BIN)/protoc-gen-connect-go: Makefile | $(BIN) | ||
$(GO_INSTALL) github.com/bufbuild/connect-go/cmd/protoc-gen-connect-go@v0.4.0 | ||
|
||
$(BIN)/protoc-gen-go-vtproto: Makefile | $(BIN) | ||
$(GO_INSTALL) github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto@v0.3.0 | ||
|
||
ifeq ($(UNAME_OS),Darwin) | ||
PROTOC_OS := osx | ||
ifeq ($(UNAME_ARCH),arm64) | ||
PROTOC_ARCH := aarch_64 | ||
else | ||
PROTOC_ARCH := x86_64 | ||
endif | ||
endif | ||
ifeq ($(UNAME_OS),Linux) | ||
PROTOC_OS = linux | ||
ifeq ($(UNAME_ARCH),aarch64) | ||
PROTOC_ARCH := aarch_64 | ||
else | ||
PROTOC_ARCH := $(UNAME_ARCH) | ||
endif | ||
endif | ||
|
||
$(BIN)/protoc: | $(BIN) | ||
rm -rf tmp-protoc | ||
mkdir -p tmp-protoc | ||
wget -O tmp-protoc/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v$(PROTOC_VERSION)/protoc-$(PROTOC_VERSION)-$(PROTOC_OS)-$(PROTOC_ARCH).zip | ||
unzip -d tmp-protoc tmp-protoc/protoc.zip | ||
mv tmp-protoc/bin/protoc $(BIN)/ | ||
rm -rf tmp-protoc | ||
|
||
PROTO_TOOLS := $(BIN)/protoc $(BIN)/protoc-gen-go $(BIN)/protoc-gen-connect-go $(BIN)/protoc-gen-go-vtproto | ||
tools: $(PROTO_TOOLS) | ||
|
||
$(PSDB_V1ALPHA1)/database.pb.go: $(PROTO_TOOLS) proto-src/psdb/v1alpha1/database.proto | $(PSDB_PROTO_OUT) | ||
$(BIN)/protoc \ | ||
--plugin=protoc-gen-go=$(BIN)/protoc-gen-go \ | ||
--plugin=protoc-gen-go-vtproto=$(BIN)/protoc-gen-go-vtproto \ | ||
--plugin=protoc-gen-connect-go=$(BIN)/protoc-gen-connect-go \ | ||
--go_out=$(PSDB_PROTO_OUT) \ | ||
--go-vtproto_out=$(PSDB_PROTO_OUT) \ | ||
--connect-go_out=$(PSDB_PROTO_OUT) \ | ||
--go_opt=paths=source_relative \ | ||
--go-vtproto_opt=features=marshal+unmarshal+size \ | ||
--go-vtproto_opt=paths=source_relative \ | ||
--connect-go_opt=paths=source_relative \ | ||
-I proto-src \ | ||
-I proto-src/vitess \ | ||
proto-src/psdb/v1alpha1/database.proto | ||
|
||
run: proto | ||
go run $(gomod) \ | ||
-http-addr=127.0.0.1 \ | ||
-http-port=8080 \ | ||
-mysql-addr=127.0.0.1 \ | ||
-mysql-port=3306 \ | ||
-mysql-idle-timeout=5s \ | ||
-mysql-no-pass \ | ||
-mysql-max-rows=1000 \ | ||
-mysql-dbname=mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
module github.com/mattrobenolt/ps-http-sim | ||
|
||
go 1.19 | ||
|
||
require ( | ||
github.com/bufbuild/connect-go v0.4.0 | ||
github.com/matoous/go-nanoid/v2 v2.0.0 | ||
github.com/planetscale/psdb v0.0.0-20220813004532-622beb9d3552 | ||
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 | ||
google.golang.org/protobuf v1.28.1 | ||
vitess.io/vitess v0.14.1 | ||
) | ||
|
||
require ( | ||
github.com/AdaLogics/go-fuzz-headers v0.0.0-20211102141018-f7be0cbad29c // indirect | ||
github.com/beorn7/perks v1.0.1 // indirect | ||
github.com/cespare/xxhash/v2 v2.1.1 // indirect | ||
github.com/cyphar/filepath-securejoin v0.2.3 // indirect | ||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect | ||
github.com/golang/protobuf v1.5.2 // indirect | ||
github.com/grpc-ecosystem/go-grpc-middleware v1.1.0 // indirect | ||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect | ||
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect | ||
github.com/opentracing-contrib/go-grpc v0.0.0-20180928155321-4b5a12d3ff02 // indirect | ||
github.com/opentracing/opentracing-go v1.1.0 // indirect | ||
github.com/philhofer/fwd v1.0.0 // indirect | ||
github.com/pires/go-proxyproto v0.6.1 // indirect | ||
github.com/pkg/errors v0.9.1 // indirect | ||
github.com/prometheus/client_golang v1.11.0 // indirect | ||
github.com/prometheus/client_model v0.2.0 // indirect | ||
github.com/prometheus/common v0.29.0 // indirect | ||
github.com/prometheus/procfs v0.6.0 // indirect | ||
github.com/segmentio/asm v1.2.0 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/spyzhov/ajson v0.4.2 // indirect | ||
github.com/tinylib/msgp v1.1.1 // indirect | ||
github.com/uber/jaeger-client-go v2.16.0+incompatible // indirect | ||
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect | ||
golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664 // indirect | ||
golang.org/x/text v0.3.7 // indirect | ||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect | ||
google.golang.org/genproto v0.0.0-20210701191553-46259e63a0a9 // indirect | ||
google.golang.org/grpc v1.45.0 // indirect | ||
gopkg.in/DataDog/dd-trace-go.v1 v1.17.0 // indirect | ||
k8s.io/apimachinery v0.20.6 // indirect | ||
) |
Oops, something went wrong.