gorealis v2 refactor (#5)
* Changing default timeout for start maintenance. * Upgrading dependencies to gorealis v2 and thrift 0.12.0 * Refactored to update to gorealis v2.
This commit is contained in:
parent
ad4dd9606e
commit
6ab5c9334d
1335 changed files with 137431 additions and 61530 deletions
22
vendor/git.apache.org/thrift.git/tutorial/go/Makefile.am
generated
vendored
22
vendor/git.apache.org/thrift.git/tutorial/go/Makefile.am
generated
vendored
|
@ -17,30 +17,28 @@
|
|||
# under the License.
|
||||
#
|
||||
|
||||
THRIFT = $(top_builddir)/compiler/cpp/thrift
|
||||
|
||||
gen-go/tutorial/calculator.go gen-go/shared/shared_service.go: $(top_srcdir)/tutorial/tutorial.thrift
|
||||
$(THRIFT) --gen go -r $<
|
||||
$(THRIFT) --gen go$(COMPILER_EXTRAFLAG) -r $<
|
||||
|
||||
all-local: gen-go/tutorial/calculator.go
|
||||
|
||||
|
||||
check: src/git.apache.org/thrift.git/lib/go/thrift
|
||||
$(THRIFT) -r --gen go $(top_srcdir)/tutorial/tutorial.thrift
|
||||
check: src/github.com/apache/thrift/lib/go/thrift thirdparty-dep
|
||||
$(THRIFT) -r --gen go$(COMPILER_EXTRAFLAG) $(top_srcdir)/tutorial/tutorial.thrift
|
||||
cp -r gen-go/* src/
|
||||
GOPATH=`pwd` $(GO) build ./...
|
||||
GOPATH=`pwd` $(GO) build -o go-tutorial src/*.go
|
||||
GOPATH=`pwd` $(GO) build -o go-tutorial ./src
|
||||
GOPATH=`pwd` $(GO) build -o calculator-remote src/tutorial/calculator-remote/calculator-remote.go
|
||||
|
||||
src/git.apache.org/thrift.git/lib/go/thrift:
|
||||
mkdir -p src/git.apache.org/thrift.git/lib/go
|
||||
ln -sf $(realpath $(top_srcdir)/lib/go/thrift) src/git.apache.org/thrift.git/lib/go/thrift
|
||||
src/github.com/apache/thrift/lib/go/thrift:
|
||||
mkdir -p src/github.com/apache/thrift/lib/go
|
||||
ln -sf $(realpath $(top_srcdir)/lib/go/thrift) src/github.com/apache/thrift/lib/go/thrift
|
||||
|
||||
thirdparty-dep:
|
||||
|
||||
tutorialserver: all
|
||||
GOPATH=`pwd` $(GO) run src/*.go -server=true
|
||||
|
||||
tutorialclient: all
|
||||
GOPATH=`pwd` $(GO) run src/*.go
|
||||
GOPATH=`pwd` $(GO) run src/*.go
|
||||
|
||||
tutorialsecureserver: all
|
||||
GOPATH=`pwd` $(GO) run src/*.go -server=true -secure=true
|
||||
|
|
20
vendor/git.apache.org/thrift.git/tutorial/go/src/client.go
generated
vendored
20
vendor/git.apache.org/thrift.git/tutorial/go/src/client.go
generated
vendored
|
@ -20,24 +20,28 @@ package main
|
|||
*/
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"git.apache.org/thrift.git/lib/go/thrift"
|
||||
"tutorial"
|
||||
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
)
|
||||
|
||||
var defaultCtx = context.Background()
|
||||
|
||||
func handleClient(client *tutorial.CalculatorClient) (err error) {
|
||||
client.Ping()
|
||||
client.Ping(defaultCtx)
|
||||
fmt.Println("ping()")
|
||||
|
||||
sum, _ := client.Add(1, 1)
|
||||
sum, _ := client.Add(defaultCtx, 1, 1)
|
||||
fmt.Print("1+1=", sum, "\n")
|
||||
|
||||
work := tutorial.NewWork()
|
||||
work.Op = tutorial.Operation_DIVIDE
|
||||
work.Num1 = 1
|
||||
work.Num2 = 0
|
||||
quotient, err := client.Calculate(1, work)
|
||||
quotient, err := client.Calculate(defaultCtx, 1, work)
|
||||
if err != nil {
|
||||
switch v := err.(type) {
|
||||
case *tutorial.InvalidOperation:
|
||||
|
@ -53,7 +57,7 @@ func handleClient(client *tutorial.CalculatorClient) (err error) {
|
|||
work.Op = tutorial.Operation_SUBTRACT
|
||||
work.Num1 = 15
|
||||
work.Num2 = 10
|
||||
diff, err := client.Calculate(1, work)
|
||||
diff, err := client.Calculate(defaultCtx, 1, work)
|
||||
if err != nil {
|
||||
switch v := err.(type) {
|
||||
case *tutorial.InvalidOperation:
|
||||
|
@ -66,7 +70,7 @@ func handleClient(client *tutorial.CalculatorClient) (err error) {
|
|||
fmt.Print("15-10=", diff, "\n")
|
||||
}
|
||||
|
||||
log, err := client.GetStruct(1)
|
||||
log, err := client.GetStruct(defaultCtx, 1)
|
||||
if err != nil {
|
||||
fmt.Println("Unable to get struct:", err)
|
||||
return err
|
||||
|
@ -98,5 +102,7 @@ func runClient(transportFactory thrift.TTransportFactory, protocolFactory thrift
|
|||
if err := transport.Open(); err != nil {
|
||||
return err
|
||||
}
|
||||
return handleClient(tutorial.NewCalculatorClientFactory(transport, protocolFactory))
|
||||
iprot := protocolFactory.GetProtocol(transport)
|
||||
oprot := protocolFactory.GetProtocol(transport)
|
||||
return handleClient(tutorial.NewCalculatorClient(thrift.NewTStandardClient(iprot, oprot)))
|
||||
}
|
||||
|
|
11
vendor/git.apache.org/thrift.git/tutorial/go/src/handler.go
generated
vendored
11
vendor/git.apache.org/thrift.git/tutorial/go/src/handler.go
generated
vendored
|
@ -20,6 +20,7 @@ package main
|
|||
*/
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"shared"
|
||||
"strconv"
|
||||
|
@ -34,17 +35,17 @@ func NewCalculatorHandler() *CalculatorHandler {
|
|||
return &CalculatorHandler{log: make(map[int]*shared.SharedStruct)}
|
||||
}
|
||||
|
||||
func (p *CalculatorHandler) Ping() (err error) {
|
||||
func (p *CalculatorHandler) Ping(ctx context.Context) (err error) {
|
||||
fmt.Print("ping()\n")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *CalculatorHandler) Add(num1 int32, num2 int32) (retval17 int32, err error) {
|
||||
func (p *CalculatorHandler) Add(ctx context.Context, num1 int32, num2 int32) (retval17 int32, err error) {
|
||||
fmt.Print("add(", num1, ",", num2, ")\n")
|
||||
return num1 + num2, nil
|
||||
}
|
||||
|
||||
func (p *CalculatorHandler) Calculate(logid int32, w *tutorial.Work) (val int32, err error) {
|
||||
func (p *CalculatorHandler) Calculate(ctx context.Context, logid int32, w *tutorial.Work) (val int32, err error) {
|
||||
fmt.Print("calculate(", logid, ", {", w.Op, ",", w.Num1, ",", w.Num2, "})\n")
|
||||
switch w.Op {
|
||||
case tutorial.Operation_ADD:
|
||||
|
@ -89,13 +90,13 @@ func (p *CalculatorHandler) Calculate(logid int32, w *tutorial.Work) (val int32,
|
|||
return val, err
|
||||
}
|
||||
|
||||
func (p *CalculatorHandler) GetStruct(key int32) (*shared.SharedStruct, error) {
|
||||
func (p *CalculatorHandler) GetStruct(ctx context.Context, key int32) (*shared.SharedStruct, error) {
|
||||
fmt.Print("getStruct(", key, ")\n")
|
||||
v, _ := p.log[int(key)]
|
||||
return v, nil
|
||||
}
|
||||
|
||||
func (p *CalculatorHandler) Zip() (err error) {
|
||||
func (p *CalculatorHandler) Zip(ctx context.Context) (err error) {
|
||||
fmt.Print("zip()\n")
|
||||
return nil
|
||||
}
|
||||
|
|
2
vendor/git.apache.org/thrift.git/tutorial/go/src/main.go
generated
vendored
2
vendor/git.apache.org/thrift.git/tutorial/go/src/main.go
generated
vendored
|
@ -22,7 +22,7 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"git.apache.org/thrift.git/lib/go/thrift"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"os"
|
||||
)
|
||||
|
||||
|
|
2
vendor/git.apache.org/thrift.git/tutorial/go/src/server.go
generated
vendored
2
vendor/git.apache.org/thrift.git/tutorial/go/src/server.go
generated
vendored
|
@ -22,7 +22,7 @@ package main
|
|||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"git.apache.org/thrift.git/lib/go/thrift"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"tutorial"
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue