ing
This commit is contained in:
parent
a8273a816c
commit
f3fa65c8b2
9
external/grpc/grpc.go
vendored
9
external/grpc/grpc.go
vendored
|
@ -7,12 +7,12 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"git.loafle.net/commons/logging-go"
|
"git.loafle.net/commons/logging-go"
|
||||||
oci "git.loafle.net/overflow/central_api/golang"
|
oci "git.loafle.net/overflow/central-api/golang"
|
||||||
ocec "git.loafle.net/overflow/commons-go/external/config"
|
ocec "git.loafle.net/overflow/commons-go/external/config"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
var grpcClient oci.OverflowApiServerClient
|
var grpcClient oci.CentralAPIClient
|
||||||
|
|
||||||
func InitPackage(config *ocec.GRPC) {
|
func InitPackage(config *ocec.GRPC) {
|
||||||
if nil == config {
|
if nil == config {
|
||||||
|
@ -23,7 +23,7 @@ func InitPackage(config *ocec.GRPC) {
|
||||||
if nil != err {
|
if nil != err {
|
||||||
logging.Logger().Panic(err)
|
logging.Logger().Panic(err)
|
||||||
}
|
}
|
||||||
grpcClient = oci.NewOverflowApiServerClient(conn)
|
grpcClient = oci.NewCentralAPIClient(conn)
|
||||||
logging.Logger().Infof("GRPC: connected to %s", config.Address)
|
logging.Logger().Infof("GRPC: connected to %s", config.Address)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ func StartPackage(config *ocec.GRPC) {
|
||||||
if nil == config {
|
if nil == config {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func StopPackage(config *ocec.GRPC) {
|
func StopPackage(config *ocec.GRPC) {
|
||||||
|
@ -66,7 +65,7 @@ func Exec(ctx context.Context, method string, params ...string) (string, error)
|
||||||
|
|
||||||
execMtx.Lock()
|
execMtx.Lock()
|
||||||
defer execMtx.Unlock()
|
defer execMtx.Unlock()
|
||||||
so, err := grpcClient.(oci.OverflowApiServerClient).Exec(ctx, si)
|
so, err := grpcClient.(oci.CentralAPIClient).Exec(ctx, si)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package: git.loafle.net/overflow/gateway
|
package: git.loafle.net/overflow/gateway
|
||||||
import:
|
import:
|
||||||
- package: git.loafle.net/overflow/central_api
|
|
||||||
- package: git.loafle.net/commons/logging-go
|
- package: git.loafle.net/commons/logging-go
|
||||||
- package: google.golang.org/grpc
|
- package: google.golang.org/grpc
|
||||||
version: ^1.11.2
|
version: ^1.11.2
|
||||||
|
@ -8,3 +7,4 @@ import:
|
||||||
version: ^2.0.0
|
version: ^2.0.0
|
||||||
- package: github.com/segmentio/kafka-go
|
- package: github.com/segmentio/kafka-go
|
||||||
- package: git.loafle.net/commons/util-go
|
- package: git.loafle.net/commons/util-go
|
||||||
|
- package: git.loafle.net/overflow/central-api
|
||||||
|
|
Loading…
Reference in New Issue
Block a user