mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 07:26:55 +08:00
refactor: distributed load testing
This commit is contained in:
@@ -2,6 +2,7 @@ package boomer
|
||||
|
||||
import (
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/json"
|
||||
"golang.org/x/net/context"
|
||||
"math"
|
||||
"os"
|
||||
"os/signal"
|
||||
@@ -84,20 +85,6 @@ func (b *Boomer) SetProfile(profile *Profile) {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Profile) dispatch(workers int64) *Profile {
|
||||
workerProfile := *p
|
||||
if p.SpawnCount > 0 {
|
||||
workerProfile.SpawnCount = p.SpawnCount / workers
|
||||
}
|
||||
if p.SpawnRate > 0 {
|
||||
workerProfile.SpawnRate = p.SpawnRate / float64(workers)
|
||||
}
|
||||
if p.MaxRPS > 0 {
|
||||
workerProfile.MaxRPS = p.MaxRPS / workers
|
||||
}
|
||||
return &workerProfile
|
||||
}
|
||||
|
||||
// SetMode only accepts boomer.DistributedMasterMode、boomer.DistributedWorkerMode and boomer.StandaloneMode.
|
||||
func (b *Boomer) SetMode(mode Mode) {
|
||||
switch mode {
|
||||
@@ -169,14 +156,9 @@ func (b *Boomer) RunWorker() {
|
||||
b.workerRunner.run()
|
||||
}
|
||||
|
||||
// GetTestCaseBytesChan gets test case bytes chan
|
||||
func (b *Boomer) GetTestCaseBytesChan() chan []byte {
|
||||
switch b.mode {
|
||||
case DistributedMasterMode:
|
||||
return b.masterRunner.testCaseBytes
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
// TestCaseBytesChan gets test case bytes chan
|
||||
func (b *Boomer) TestCaseBytesChan() chan []byte {
|
||||
return b.masterRunner.testCaseBytes
|
||||
}
|
||||
|
||||
func ProfileToBytes(profile *Profile) []byte {
|
||||
@@ -197,18 +179,8 @@ func BytesToProfile(profileBytes []byte) *Profile {
|
||||
return profile
|
||||
}
|
||||
|
||||
// GetProfileBytesChan gets profile bytes chan
|
||||
func (b *Boomer) GetProfileBytesChan() chan []byte {
|
||||
switch b.mode {
|
||||
case DistributedMasterMode:
|
||||
return b.masterRunner.profileBytes
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// GetTasksChan gets profile bytes chan
|
||||
func (b *Boomer) GetTasksChan() chan *profileMessage {
|
||||
// GetTasksChan getsTasks chan
|
||||
func (b *Boomer) GetTasksChan() chan *task {
|
||||
switch b.mode {
|
||||
case DistributedWorkerMode:
|
||||
return b.workerRunner.tasksChan
|
||||
@@ -373,13 +345,16 @@ func (b *Boomer) EnableMemoryProfile(memoryProfile string, duration time.Duratio
|
||||
}
|
||||
|
||||
// EnableGracefulQuit catch SIGINT and SIGTERM signals to quit gracefully
|
||||
func (b *Boomer) EnableGracefulQuit() {
|
||||
func (b *Boomer) EnableGracefulQuit(ctx context.Context) context.Context {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, syscall.SIGTERM, syscall.SIGINT)
|
||||
go func() {
|
||||
<-c
|
||||
b.Quit()
|
||||
cancel()
|
||||
}()
|
||||
return ctx
|
||||
}
|
||||
|
||||
// Run accepts a slice of Task and connects to the locust master.
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package boomer
|
||||
|
||||
type client interface {
|
||||
connect() (err error)
|
||||
close()
|
||||
recvChannel() chan *genericMessage
|
||||
sendChannel() chan *genericMessage
|
||||
disconnectedChannel() chan bool
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package boomer
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
@@ -12,27 +11,30 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
"google.golang.org/grpc/credentials/oauth"
|
||||
"google.golang.org/grpc/metadata"
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/data"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/grpc/messager"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/boomer/data"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/boomer/grpc/messager"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
type grpcClient struct {
|
||||
messager.MessageClient
|
||||
masterHost string
|
||||
masterPort int
|
||||
identity string // nodeID
|
||||
|
||||
config *grpcClientConfig
|
||||
|
||||
fromMaster chan *genericMessage
|
||||
toMaster chan *genericMessage
|
||||
disconnectedFromMaster chan bool
|
||||
shutdownChan chan bool
|
||||
fromMaster chan *genericMessage
|
||||
toMaster chan *genericMessage
|
||||
disconnectedChan chan bool
|
||||
shutdownChan chan bool
|
||||
|
||||
failCount int32
|
||||
|
||||
wg sync.WaitGroup
|
||||
wg *sync.WaitGroup
|
||||
}
|
||||
|
||||
type grpcClientConfig struct {
|
||||
@@ -48,10 +50,6 @@ type grpcClientConfig struct {
|
||||
|
||||
const token = "httprunner-secret-token"
|
||||
|
||||
func logger(format string, a ...interface{}) {
|
||||
log.Logger.Log().Msg(fmt.Sprintf(format, a...))
|
||||
}
|
||||
|
||||
// unaryInterceptor is an example unary interceptor.
|
||||
func unaryInterceptor(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
|
||||
var credsConfigured bool
|
||||
@@ -94,6 +92,15 @@ func newWrappedStream(s grpc.ClientStream) grpc.ClientStream {
|
||||
return &wrappedStream{s}
|
||||
}
|
||||
|
||||
func extractToken(ctx context.Context) (tkn string, ok bool) {
|
||||
md, ok := metadata.FromIncomingContext(ctx)
|
||||
if !ok || len(md[token]) == 0 {
|
||||
return "", false
|
||||
}
|
||||
|
||||
return md[token][0], true
|
||||
}
|
||||
|
||||
// streamInterceptor is an example stream interceptor.
|
||||
func streamInterceptor(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) {
|
||||
var credsConfigured bool
|
||||
@@ -133,26 +140,27 @@ func newClient(masterHost string, masterPort int, identity string) (client *grpc
|
||||
// Initiate the stream with a context that supports cancellation.
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
client = &grpcClient{
|
||||
masterHost: masterHost,
|
||||
masterPort: masterPort,
|
||||
identity: identity,
|
||||
fromMaster: make(chan *genericMessage, 100),
|
||||
toMaster: make(chan *genericMessage, 100),
|
||||
disconnectedFromMaster: make(chan bool),
|
||||
shutdownChan: make(chan bool),
|
||||
masterHost: masterHost,
|
||||
masterPort: masterPort,
|
||||
identity: identity,
|
||||
fromMaster: make(chan *genericMessage, 100),
|
||||
toMaster: make(chan *genericMessage, 100),
|
||||
disconnectedChan: make(chan bool),
|
||||
shutdownChan: make(chan bool),
|
||||
config: &grpcClientConfig{
|
||||
ctx: ctx,
|
||||
ctxCancel: cancel,
|
||||
mutex: sync.RWMutex{},
|
||||
},
|
||||
wg: &sync.WaitGroup{},
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
func (c *grpcClient) connect() (err error) {
|
||||
func (c *grpcClient) start() (err error) {
|
||||
addr := fmt.Sprintf("%v:%v", c.masterHost, c.masterPort)
|
||||
// Create tls based credential.
|
||||
creds, err := credentials.NewClientTLSFromFile(data.Path("x509/ca_cert.pem"), "x.test.example.com")
|
||||
creds, err := credentials.NewClientTLSFromFile(data.Path("x509/ca_cert.pem"), "www.httprunner.com")
|
||||
if err != nil {
|
||||
log.Fatal().Msg(fmt.Sprintf("failed to load credentials: %v", err))
|
||||
}
|
||||
@@ -160,7 +168,7 @@ func (c *grpcClient) connect() (err error) {
|
||||
// oauth.NewOauthAccess requires the configuration of transport
|
||||
// credentials.
|
||||
grpc.WithTransportCredentials(creds),
|
||||
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(1024 * 1024 * 1024)),
|
||||
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(32 * 10e9)),
|
||||
grpc.WithUnaryInterceptor(unaryInterceptor),
|
||||
grpc.WithStreamInterceptor(streamInterceptor),
|
||||
}
|
||||
@@ -169,43 +177,47 @@ func (c *grpcClient) connect() (err error) {
|
||||
log.Error().Err(err).Msg("failed to connect")
|
||||
return err
|
||||
}
|
||||
grpc.MaxCallRecvMsgSize(32 * 10e9)
|
||||
go c.recv()
|
||||
go c.send()
|
||||
|
||||
biStream, err := messager.NewMessageClient(c.config.conn).BidirectionalStreamingMessage(c.config.ctx)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("call bidirectional streaming message err")
|
||||
return err
|
||||
}
|
||||
c.config.setBiStreamClient(biStream)
|
||||
log.Info().Msg(fmt.Sprintf("Boomer is connected to master(%s) press Ctrl+c to quit.\n", addr))
|
||||
|
||||
c.MessageClient = messager.NewMessageClient(c.config.conn)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *grpcClient) reConnect() (err error) {
|
||||
biStream, err := messager.NewMessageClient(c.config.conn).BidirectionalStreamingMessage(c.config.ctx)
|
||||
func (c *grpcClient) register(ctx context.Context) error {
|
||||
ctx, cancel := context.WithTimeout(ctx, time.Second)
|
||||
defer cancel()
|
||||
res, err := c.Register(ctx, &messager.RegisterRequest{NodeID: c.identity})
|
||||
if err != nil {
|
||||
return
|
||||
return err
|
||||
}
|
||||
c.config.setBiStreamClient(biStream)
|
||||
|
||||
// register worker information to master
|
||||
c.sendChannel() <- newGenericMessage("register", nil, c.identity)
|
||||
//// tell master, I'm ready
|
||||
//log.Info().Msg("send client ready signal")
|
||||
//c.sendChannel() <- newClientReadyMessageToMaster(c.identity)
|
||||
log.Info().Msg(fmt.Sprintf("Boomer is reConnected to master press Ctrl+c to quit.\n"))
|
||||
return
|
||||
if res.Code != "0" {
|
||||
return errors.New(res.Message)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *grpcClient) close() {
|
||||
close(c.shutdownChan)
|
||||
c.config.ctxCancel()
|
||||
if c.config.conn != nil {
|
||||
c.config.conn.Close()
|
||||
func (c *grpcClient) signOut(ctx context.Context) error {
|
||||
ctx, cancel := context.WithTimeout(ctx, time.Second)
|
||||
defer cancel()
|
||||
|
||||
res, err := c.SignOut(ctx, &messager.SignOutRequest{NodeID: c.identity})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if res.Code != "0" {
|
||||
return errors.New(res.Message)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *grpcClient) newBiStreamClient() (err error) {
|
||||
md := metadata.New(map[string]string{token: c.identity})
|
||||
ctx := metadata.NewOutgoingContext(c.config.ctx, md)
|
||||
biStream, err := c.BidirectionalStreamingMessage(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.config.setBiStreamClient(biStream)
|
||||
println("successful to establish bidirectional stream with master, press Ctrl+c to quit.\n")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *grpcClient) recvChannel() chan *genericMessage {
|
||||
@@ -213,8 +225,6 @@ func (c *grpcClient) recvChannel() chan *genericMessage {
|
||||
}
|
||||
|
||||
func (c *grpcClient) recv() {
|
||||
c.wg.Add(1)
|
||||
defer c.wg.Done()
|
||||
for {
|
||||
select {
|
||||
case <-c.shutdownChan:
|
||||
@@ -235,7 +245,7 @@ func (c *grpcClient) recv() {
|
||||
}
|
||||
|
||||
if msg.NodeID != c.identity {
|
||||
log.Warn().
|
||||
log.Info().
|
||||
Str("nodeID", msg.NodeID).
|
||||
Str("type", msg.Type).
|
||||
Interface("data", msg.Data).
|
||||
@@ -266,8 +276,6 @@ func (c *grpcClient) sendChannel() chan *genericMessage {
|
||||
}
|
||||
|
||||
func (c *grpcClient) send() {
|
||||
c.wg.Add(1)
|
||||
defer c.wg.Done()
|
||||
for {
|
||||
select {
|
||||
case <-c.shutdownChan:
|
||||
@@ -278,7 +286,7 @@ func (c *grpcClient) send() {
|
||||
// We may send genericMessage to master.
|
||||
switch msg.Type {
|
||||
case "quit":
|
||||
c.disconnectedFromMaster <- true
|
||||
c.disconnectedChan <- true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -298,9 +306,6 @@ func (c *grpcClient) sendMessage(msg *genericMessage) {
|
||||
switch err {
|
||||
case nil:
|
||||
atomic.StoreInt32(&c.failCount, 0)
|
||||
break
|
||||
case io.EOF:
|
||||
fallthrough
|
||||
default:
|
||||
//log.Error().Err(err).Interface("genericMessage", *msg).Msg("failed to send message")
|
||||
atomic.AddInt32(&c.failCount, 1)
|
||||
@@ -308,5 +313,13 @@ func (c *grpcClient) sendMessage(msg *genericMessage) {
|
||||
}
|
||||
|
||||
func (c *grpcClient) disconnectedChannel() chan bool {
|
||||
return c.disconnectedFromMaster
|
||||
return c.disconnectedChan
|
||||
}
|
||||
|
||||
func (c *grpcClient) close() {
|
||||
close(c.shutdownChan)
|
||||
c.config.ctxCancel()
|
||||
if c.config.conn != nil {
|
||||
c.config.conn.Close()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2020 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
// Package data provides convenience routines to access files in the data
|
||||
// directory.
|
||||
package data
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
// basepath is the root directory of this package.
|
||||
var basepath string
|
||||
|
||||
func init() {
|
||||
_, currentFile, _, _ := runtime.Caller(0)
|
||||
basepath = filepath.Dir(currentFile)
|
||||
}
|
||||
|
||||
// Path returns the absolute path the given relative file or directory path,
|
||||
// relative to the google.golang.org/grpc/examples/data directory in the
|
||||
// user's GOPATH. If rel is already absolute, it is returned unmodified.
|
||||
func Path(rel string) string {
|
||||
if filepath.IsAbs(rel) {
|
||||
return rel
|
||||
}
|
||||
|
||||
return filepath.Join(basepath, rel)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
This directory contains x509 certificates and associated private keys used in
|
||||
examples.
|
||||
|
||||
How were these test certs/keys generated ?
|
||||
------------------------------------------
|
||||
Run `./create.sh`
|
||||
@@ -0,0 +1,34 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIF6jCCA9KgAwIBAgIJAKg0eWNBWobLMA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNV
|
||||
BAYTAlVTMQswCQYDVQQIDAJDQTEMMAoGA1UEBwwDU1ZMMQ0wCwYDVQQKDARnUlBD
|
||||
MRcwFQYDVQQDDA50ZXN0LXNlcnZlcl9jYTAeFw0yMjA3MTAwNDMwMTJaFw0zMjA3
|
||||
MDcwNDMwMTJaMFAxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEMMAoGA1UEBwwD
|
||||
U1ZMMQ0wCwYDVQQKDARnUlBDMRcwFQYDVQQDDA50ZXN0LXNlcnZlcl9jYTCCAiIw
|
||||
DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANpgfrPDdZAqqXrRbjmiXYbBdCvL
|
||||
Oh4B/1p6yNulFspn8wTm0V1V1pPqUBWolSOpSUuxT9XDnkGq89loYaMGnRm8V6un
|
||||
tNLQx3zzLjLoVeyEajztIIg1p/k9Boe4g90eLbF/Dirg9tOI1yw50Ay0v/Wvp6/d
|
||||
+h3kTAXXfB4Rc78dh40/FlnEjqeywLObHQftxojC4CcwvMLVqxEZgz8/ZUoBw1Rd
|
||||
I7muiMItMw8vyf3yhSpTntNoa1dqZ6a1tZzdvPlnvdP3ByEdh7MI7PKthlLZhPoU
|
||||
zjFhI3+vgHq+U8yuyEpbBILBJqQ2Kd5H7x6EGiRMpeC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YkB8r+A60uIqocni8fzU0F7hdN
|
||||
R3RIS3kWW+o/4Xz8a3fE19+RFSZd4vUgS1U+8eTeVvuCw4KaAQsEUDv8pEH6GjD+
|
||||
xQwtPbg4grufTmC1a3PmEjeeYagP0BdSbuvRqXCl4i6QK/Yp2lPUWmGVC27+X0UL
|
||||
xXibxUfcgT26eIAddepO2RUVG6QAtYC6GMgCbANAIVm37Sc8JV+quF/gloBIKCY9
|
||||
dSi+x8wOTAsmJkceyAt+UOhayn1+u6+6YGqIiRt4/wBpuZj0UyvaZLmDcxdNXDBc
|
||||
cZAAUwvcsa0yt/QiF7IE+/GS1mja0NcuzBjamnf/LqTcgQin9bEpVTw5suKUqmCR
|
||||
BdUlu7drONjYIhMb3zY/QFmTGD7rPu/DaHE63ThL
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,52 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIJRAIBADANBgkqhkiG9w0BAQEFAASCCS4wggkqAgEAAoICAQDaYH6zw3WQKql6
|
||||
0W45ol2GwXQryzoeAf9aesjbpRbKZ/ME5tFdVdaT6lAVqJUjqUlLsU/Vw55BqvPZ
|
||||
aGGjBp0ZvFerp7TS0Md88y4y6FXshGo87SCINaf5PQaHuIPdHi2xfw4q4PbTiNcs
|
||||
OdAMtL/1r6ev3fod5EwF13weEXO/HYeNPxZZxI6nssCzmx0H7caIwuAnMLzC1asR
|
||||
GYM/P2VKAcNUXSO5rojCLTMPL8n98oUqU57TaGtXamemtbWc3bz5Z73T9wchHYez
|
||||
COzyrYZS2YT6FM4xYSN/r4B6vlPMrshKWwSCwSakNineR+8ehBokTKXglsyHZfz8
|
||||
HF4YMLlEg1VE8usP6ik5ocz8rSIgv8Mrh3F/Ar4XtAoeeMdWADytOwQfXZ2i1bEr
|
||||
QLMOzttnkr1hu2gBRWl1IQRlr5Ec/+21pQJUS/0bfO6F64xdIQg6LXGlkTJx+Zkm
|
||||
PTfS7Bmy3dIlTx+cwCha94srRfRd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AcMA1NWTDENMAsGA1UECgwEZ1JQQzEXMBUGA1UEAwwOdGVzdC1jbGllbnRfY2GC
|
||||
CQCkWVzXgHR18zAOBgNVHQ8BAf8EBAMCAgQwDQYJKoZIhvcNAQELBQADggIBAHpl
|
||||
MizBOtEWJ7WGhCWFpbrZJPMx+vQ0ixY2Uz/wjj2jiE7O4kIR45OxgQws/LdG/D8v
|
||||
nhumeau8JjYPXZHF2wVa/CbF183OHzJEgL7DRteL5qfR+simSMWdXkKXrGK6riCl
|
||||
IWT2CET1u//fa9I0245KdBDlzmkxpYUB2If+jOYKIzJ3o041zWGVx7+uQ8wQuNSU
|
||||
6WWNP+g9k4hgNPO8kPkbOq+YX+mcxgKslKP2HfIonzeTtLcnvBCDY7fsag9wVfTT
|
||||
bP84k3c5ocvQIta/S+3rSLo6Q1EvYclV8qkI0meap91DisCVsKWekNQgnRoWjMrZ
|
||||
QpSuFjnfM6rWRBlZD+Vq47WaxzxkWarOX9+XuHXf1K5VyAVbe9n7QLeXFm42eRBr
|
||||
lZtwTH7aDifdyuGzG3/xu06NzLSFi+G4WedG46j3GVGj0Uche3sCx5K5HE5dIJQN
|
||||
iQ7hV7hAkPyCkY8uviQWwA91ffPIJJb/bBSySo354IgRtfmPqhpfLrf75lUuy9kE
|
||||
/HgRHZf916JL4A52XEX7S66JcZGqtram2/Vo64ksjnyM9ZRKE+jWRIS8YYAnDmkX
|
||||
NZCAQFD3CE0zlwQQLCPtMqeSk7MrXj58y80e3mUZoZQoPWYuBIktlbCmCiRKmNGm
|
||||
WHrY9obxbjh5CBJb3Ilior3lnm24S9M9bClr6RpY
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,52 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQDTH1Dgsleea77f
|
||||
5xCy8puAki9f13oOzT1qF3AJI2bdD+I+fz0c39YuZL5Xm/Sl4yi8sQRXfktfhZxo
|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5d
|
||||
PwhAxn4aVK8zXFdYmwNfXNXBpLaEILxYFpeExaA9Gr5Mn/h+vD987GTW9F4fBhht
|
||||
MtkfvRA=
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,51 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIJKAIBAAKCAgEArfrnbe/lIQz4nxF423dRLDKURGhQyrKChBFMjLuKnN87Z2aj
|
||||
k4A0Wwm09vcIf5gHqRL2WUCKgtr1Q2sPpIGVHbc2j9Al5cGJeClRcAQMIuFD9qPR
|
||||
8TLwASdb5rqYzmOawQc7L87er8oXUl2M0DVPse4FLpwi+nn7usXWsb23MksutfBR
|
||||
ksqUyN0IO4vGn+q1hSgfzUIi695YA4Mfehp3nn0eAPpQGANGe11P3TYhSdN6MIA5
|
||||
j1DTJOVwwxvP4UQxnjdergTz1hDsx6X7GRvSUvsfqY1pu99lNf7mqb1EO3Gs28sf
|
||||
6Fn4486naqt/IkFqP/I/7hNM3ikLjLlWqSruxnV+N/H2BlOxAsC+avr9z9nn0iWw
|
||||
Ai+21tqbsUU2vBWVawPm5E/YNnIpdONFEIDw2cGj1+W0PUVsop69yq4+KUyLKDz5
|
||||
0meErE54yXDVZLHSHwUVT6N/gwUVf6oWwkHsRyyzVtamehixp4oYwbuZw7HnB6CV
|
||||
GVVxwNCiWVkFeggz+kMok2sBsDyi0pdsYaXUsljbQdks1g8hFGUfal5igvKFSLUA
|
||||
oUx5wfFwY4jGUdVnSB8ShZwKFi+VaLoz/T1zZC2qr9B8qEPsMBeYwNLFgWyTIABh
|
||||
LGBfZD/ljqY/6pHMPFPRCbknI35RXSVqpDUoEDXX4EXxEquIwZhJfLhp8MkCAwEA
|
||||
AQKCAgA2Vgo5d5bj/50WcOqCAH3Fg/ZydvHknGPOw2hY+6mK3N08qf2kb4HqfNmb
|
||||
2AM7dkvOLjHqJhIcVC4NZD56bk4X/cR4ndV4MD2y3ZSlm13+9sO3H+rNnc7/TT+S
|
||||
i+x1a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4YRgRlzP1NLbAO82OdO
|
||||
1opIzPaxb+9JxvFm+xILb8kvNe0THkLhLM2nNImTydshCqLXGP6/jahw7Vh9NJNj
|
||||
QrCHEx9RnJYdcdaayWeDzSJO8oGARs0CXMZXzgPYiFnNXcFFG/R+Ughv0yctIz4o
|
||||
af6elMwheOPXEyNu1yV0ALlvO/xkPpBRs3HuffJ5EiMkT5SKFa4ErFUaAlDaYpRz
|
||||
EITcEh6UKnZiAhQADl9rHSymWUlt88xhXw4wEDTBvNmzgOgQvfjnoud8JXO8a7S0
|
||||
ihaKprOq1WFRss1USidGfm7lBxIPM60AeSHKt2VsVgpf+KgXgNs3RONhY8c=
|
||||
-----END RSA PRIVATE KEY-----
|
||||
Executable
+69
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Create the server CA certs.
|
||||
openssl req -x509 \
|
||||
-newkey rsa:4096 \
|
||||
-nodes \
|
||||
-days 3650 \
|
||||
-keyout ca_key.pem \
|
||||
-out ca_cert.pem \
|
||||
-subj /C=US/ST=CA/L=SVL/O=gRPC/CN=test-server_ca/ \
|
||||
-config ./openssl.cnf \
|
||||
-extensions test_ca \
|
||||
-sha256
|
||||
|
||||
# Create the client CA certs.
|
||||
openssl req -x509 \
|
||||
-newkey rsa:4096 \
|
||||
-nodes \
|
||||
-days 3650 \
|
||||
-keyout client_ca_key.pem \
|
||||
-out client_ca_cert.pem \
|
||||
-subj /C=US/ST=CA/L=SVL/O=gRPC/CN=test-client_ca/ \
|
||||
-config ./openssl.cnf \
|
||||
-extensions test_ca \
|
||||
-sha256
|
||||
|
||||
# Generate a server cert.
|
||||
openssl genrsa -out server_key.pem 4096
|
||||
openssl req -new \
|
||||
-key server_key.pem \
|
||||
-days 3650 \
|
||||
-out server_csr.pem \
|
||||
-subj /C=US/ST=CA/L=SVL/O=gRPC/CN=test-server1/ \
|
||||
-config ./openssl.cnf \
|
||||
-reqexts test_server
|
||||
openssl x509 -req \
|
||||
-in server_csr.pem \
|
||||
-CAkey ca_key.pem \
|
||||
-CA ca_cert.pem \
|
||||
-days 3650 \
|
||||
-set_serial 1000 \
|
||||
-out server_cert.pem \
|
||||
-extfile ./openssl.cnf \
|
||||
-extensions test_server \
|
||||
-sha256
|
||||
openssl verify -verbose -CAfile ca_cert.pem server_cert.pem
|
||||
|
||||
# Generate a client cert.
|
||||
openssl genrsa -out client_key.pem 4096
|
||||
openssl req -new \
|
||||
-key client_key.pem \
|
||||
-days 3650 \
|
||||
-out client_csr.pem \
|
||||
-subj /C=US/ST=CA/L=SVL/O=gRPC/CN=test-client1/ \
|
||||
-config ./openssl.cnf \
|
||||
-reqexts test_client
|
||||
openssl x509 -req \
|
||||
-in client_csr.pem \
|
||||
-CAkey client_ca_key.pem \
|
||||
-CA client_ca_cert.pem \
|
||||
-days 3650 \
|
||||
-set_serial 1000 \
|
||||
-out client_cert.pem \
|
||||
-extfile ./openssl.cnf \
|
||||
-extensions test_client \
|
||||
-sha256
|
||||
openssl verify -verbose -CAfile client_ca_cert.pem client_cert.pem
|
||||
|
||||
rm *_csr.pem
|
||||
@@ -0,0 +1,28 @@
|
||||
[req]
|
||||
distinguished_name = req_distinguished_name
|
||||
attributes = req_attributes
|
||||
|
||||
[req_distinguished_name]
|
||||
|
||||
[req_attributes]
|
||||
|
||||
[test_ca]
|
||||
basicConstraints = critical,CA:TRUE
|
||||
subjectKeyIdentifier = hash
|
||||
authorityKeyIdentifier = keyid:always,issuer:always
|
||||
keyUsage = critical,keyCertSign
|
||||
|
||||
[test_server]
|
||||
basicConstraints = critical,CA:FALSE
|
||||
subjectKeyIdentifier = hash
|
||||
keyUsage = critical,digitalSignature,keyEncipherment,keyAgreement
|
||||
subjectAltName = @server_alt_names
|
||||
|
||||
[server_alt_names]
|
||||
DNS.1 = *.httprunner.com
|
||||
|
||||
[test_client]
|
||||
basicConstraints = critical,CA:FALSE
|
||||
subjectKeyIdentifier = hash
|
||||
keyUsage = critical,nonRepudiation,digitalSignature,keyEncipherment
|
||||
extend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
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,51 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIJKAIBAAKCAgEAvQdNpNphDUZu9n8/Lc0l/dZI7Nd2b+qH0W/uECzwUY8QQMJG
|
||||
Gu8UyNaoDCncSJCRFq8uBO/i3WGSBr3L+Fzu3+r0BMWbxILcO12SDZfRh3GzKi09
|
||||
paBRKawgnS7AIgyRTmgYTUnZ+il0HEbztP5AZSjWvhDENAZDYf0IywPbXsJr492t
|
||||
2V1y02z8PYBWRdN7DUF3+c1o5eHe9zXj/hvzpjsDYc4UXJGLdBp6YkmSycfQKaHJ
|
||||
1GhvmsBlBEKV+3OOuL2BpR8lbktJRgFefdjHWBqbqUzktw+WBYuZez3C2F+Sxjpi
|
||||
WkJrU212c1tkhj7pwIc3rK1I+P/UFjz4L3nhzJJK41VKwAC+bwLzRnOGc1qK+F2i
|
||||
6+ZZNkzx95ueuu3qqjRIS2ef5GTNTOc6NVXHI99+CMjyziA1zcMAht+gPCsCDE0X
|
||||
2dcCh5hNU5TF4ZyN4bx8gpx8LunF8jr96MyJRTsuQvmsQht9PZsXoRae0bKvFhE1
|
||||
3D5VfYzE0288odRS73QlMLHONpQJKdHiWFq1xA8p5hWefkj6O/qQybkUCSNXCThT
|
||||
+7tbUO0J51o32dQk1FbCm0epfZVdyczST20DnIG0EznnJ/TNgfP987NEn9uofNuz
|
||||
n6KXTu7W550xQn1f2mnzk+bQ8UPXNu/wzBl61MmKADgJ1ThdTwrno3MC9zUCAwEA
|
||||
AQKCAgBXlDapFnS4zdVDZ5lCAzaC8PFAqmM5XxQmORG3dNqzLvF8z4XjnLmog6vA
|
||||
VvS0uiY+uFM9/lbB8x7Q+Maz/3q9TAJa46NT3L1k0+mDWr+9XTSBagyR3EE+aX2C
|
||||
1dI29FOuXBRGWt0fRm2BXG41gUccl1tHHEWLRQubLr0QMm1E7hdGr8KIXv+AbZJA
|
||||
fGF8YIs2jQqlNkJPn+LJ7rH/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nrlb2AYHAs4x1LSd73mf2GR82eahcBNpFkG5NN7vg/mySN3DoBuFx2ZvrlYuw
|
||||
yjvNf51QcIlOFEWcbfOvsE9/2aXGkdmySqUZ+BJato/FMmuvSdjVOsb2zdtRG/j8
|
||||
D3nvxRqJITI849PHWVEMWeDOFT4dRTqgzd1yDB7UUggQwHExujAn9ZbTOivjn6H5
|
||||
j/aLw4IjkKge1qz9c5a13LMulYkYE8bn2GZ7Jali1v5dV5gIWtq+wtZ+32s=
|
||||
-----END RSA PRIVATE KEY-----
|
||||
@@ -0,0 +1,567 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.28.0
|
||||
// protoc v3.19.4
|
||||
// source: grpc/proto/messager.proto
|
||||
|
||||
package messager
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type StreamRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
|
||||
Data map[string]int64 `protobuf:"bytes,2,rep,name=data,proto3" json:"data,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||
NodeID string `protobuf:"bytes,3,opt,name=NodeID,proto3" json:"NodeID,omitempty"`
|
||||
}
|
||||
|
||||
func (x *StreamRequest) Reset() {
|
||||
*x = StreamRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_grpc_proto_messager_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *StreamRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*StreamRequest) ProtoMessage() {}
|
||||
|
||||
func (x *StreamRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_proto_messager_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use StreamRequest.ProtoReflect.Descriptor instead.
|
||||
func (*StreamRequest) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_proto_messager_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *StreamRequest) GetType() string {
|
||||
if x != nil {
|
||||
return x.Type
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *StreamRequest) GetData() map[string]int64 {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *StreamRequest) GetNodeID() string {
|
||||
if x != nil {
|
||||
return x.NodeID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type StreamResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
|
||||
Profile []byte `protobuf:"bytes,2,opt,name=profile,proto3" json:"profile,omitempty"`
|
||||
Data map[string]int64 `protobuf:"bytes,3,rep,name=data,proto3" json:"data,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||
NodeID string `protobuf:"bytes,4,opt,name=NodeID,proto3" json:"NodeID,omitempty"`
|
||||
Tasks []byte `protobuf:"bytes,5,opt,name=tasks,proto3" json:"tasks,omitempty"`
|
||||
}
|
||||
|
||||
func (x *StreamResponse) Reset() {
|
||||
*x = StreamResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_grpc_proto_messager_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *StreamResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*StreamResponse) ProtoMessage() {}
|
||||
|
||||
func (x *StreamResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_proto_messager_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use StreamResponse.ProtoReflect.Descriptor instead.
|
||||
func (*StreamResponse) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_proto_messager_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *StreamResponse) GetType() string {
|
||||
if x != nil {
|
||||
return x.Type
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *StreamResponse) GetProfile() []byte {
|
||||
if x != nil {
|
||||
return x.Profile
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *StreamResponse) GetData() map[string]int64 {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *StreamResponse) GetNodeID() string {
|
||||
if x != nil {
|
||||
return x.NodeID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *StreamResponse) GetTasks() []byte {
|
||||
if x != nil {
|
||||
return x.Tasks
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type RegisterRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
NodeID string `protobuf:"bytes,1,opt,name=NodeID,proto3" json:"NodeID,omitempty"`
|
||||
}
|
||||
|
||||
func (x *RegisterRequest) Reset() {
|
||||
*x = RegisterRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_grpc_proto_messager_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RegisterRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RegisterRequest) ProtoMessage() {}
|
||||
|
||||
func (x *RegisterRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_proto_messager_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RegisterRequest.ProtoReflect.Descriptor instead.
|
||||
func (*RegisterRequest) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_proto_messager_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *RegisterRequest) GetNodeID() string {
|
||||
if x != nil {
|
||||
return x.NodeID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type RegisterResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
|
||||
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
|
||||
}
|
||||
|
||||
func (x *RegisterResponse) Reset() {
|
||||
*x = RegisterResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_grpc_proto_messager_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RegisterResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RegisterResponse) ProtoMessage() {}
|
||||
|
||||
func (x *RegisterResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_proto_messager_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RegisterResponse.ProtoReflect.Descriptor instead.
|
||||
func (*RegisterResponse) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_proto_messager_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *RegisterResponse) GetCode() string {
|
||||
if x != nil {
|
||||
return x.Code
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RegisterResponse) GetMessage() string {
|
||||
if x != nil {
|
||||
return x.Message
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type SignOutRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
NodeID string `protobuf:"bytes,1,opt,name=NodeID,proto3" json:"NodeID,omitempty"`
|
||||
}
|
||||
|
||||
func (x *SignOutRequest) Reset() {
|
||||
*x = SignOutRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_grpc_proto_messager_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SignOutRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SignOutRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SignOutRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_proto_messager_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SignOutRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SignOutRequest) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_proto_messager_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *SignOutRequest) GetNodeID() string {
|
||||
if x != nil {
|
||||
return x.NodeID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type SignOutResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
|
||||
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
|
||||
}
|
||||
|
||||
func (x *SignOutResponse) Reset() {
|
||||
*x = SignOutResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_grpc_proto_messager_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SignOutResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SignOutResponse) ProtoMessage() {}
|
||||
|
||||
func (x *SignOutResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_grpc_proto_messager_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SignOutResponse.ProtoReflect.Descriptor instead.
|
||||
func (*SignOutResponse) Descriptor() ([]byte, []int) {
|
||||
return file_grpc_proto_messager_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *SignOutResponse) GetCode() string {
|
||||
if x != nil {
|
||||
return x.Code
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *SignOutResponse) GetMessage() string {
|
||||
if x != nil {
|
||||
return x.Message
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_grpc_proto_messager_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_grpc_proto_messager_proto_rawDesc = []byte{
|
||||
0x0a, 0x19, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6d, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x22, 0xaa, 0x01, 0x0a, 0x0d, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x34, 0x0a, 0x04, 0x64, 0x61,
|
||||
0x74, 0x61, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61,
|
||||
0x67, 0x65, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x2e, 0x44, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61,
|
||||
0x12, 0x16, 0x0a, 0x06, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x06, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x44, 0x1a, 0x37, 0x0a, 0x09, 0x44, 0x61, 0x74, 0x61,
|
||||
0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38,
|
||||
0x01, 0x22, 0xdc, 0x01, 0x0a, 0x0e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x66,
|
||||
0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x66, 0x69,
|
||||
0x6c, 0x65, 0x12, 0x35, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b,
|
||||
0x32, 0x21, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61,
|
||||
0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x45, 0x6e,
|
||||
0x74, 0x72, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x4e, 0x6f, 0x64,
|
||||
0x65, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4e, 0x6f, 0x64, 0x65, 0x49,
|
||||
0x44, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c,
|
||||
0x52, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x1a, 0x37, 0x0a, 0x09, 0x44, 0x61, 0x74, 0x61, 0x45,
|
||||
0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01,
|
||||
0x22, 0x29, 0x0a, 0x0f, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x44, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x44, 0x22, 0x40, 0x0a, 0x10, 0x52,
|
||||
0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63,
|
||||
0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x28, 0x0a,
|
||||
0x0e, 0x53, 0x69, 0x67, 0x6e, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
|
||||
0x16, 0x0a, 0x06, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x06, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x44, 0x22, 0x3f, 0x0a, 0x0f, 0x53, 0x69, 0x67, 0x6e, 0x4f,
|
||||
0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f,
|
||||
0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18,
|
||||
0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0xe4, 0x01, 0x0a, 0x07, 0x4d, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x12, 0x41, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72,
|
||||
0x12, 0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73,
|
||||
0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6d, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x07, 0x53, 0x69, 0x67, 0x6e, 0x4f,
|
||||
0x75, 0x74, 0x12, 0x17, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x69, 0x67,
|
||||
0x6e, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x56, 0x0a, 0x1d, 0x42, 0x69, 0x64, 0x69, 0x72,
|
||||
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e,
|
||||
0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x16, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61,
|
||||
0x67, 0x65, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x17, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61,
|
||||
0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x42,
|
||||
0x0f, 0x5a, 0x0d, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x72,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_grpc_proto_messager_proto_rawDescOnce sync.Once
|
||||
file_grpc_proto_messager_proto_rawDescData = file_grpc_proto_messager_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_grpc_proto_messager_proto_rawDescGZIP() []byte {
|
||||
file_grpc_proto_messager_proto_rawDescOnce.Do(func() {
|
||||
file_grpc_proto_messager_proto_rawDescData = protoimpl.X.CompressGZIP(file_grpc_proto_messager_proto_rawDescData)
|
||||
})
|
||||
return file_grpc_proto_messager_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_grpc_proto_messager_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_grpc_proto_messager_proto_goTypes = []interface{}{
|
||||
(*StreamRequest)(nil), // 0: message.StreamRequest
|
||||
(*StreamResponse)(nil), // 1: message.StreamResponse
|
||||
(*RegisterRequest)(nil), // 2: message.RegisterRequest
|
||||
(*RegisterResponse)(nil), // 3: message.RegisterResponse
|
||||
(*SignOutRequest)(nil), // 4: message.SignOutRequest
|
||||
(*SignOutResponse)(nil), // 5: message.SignOutResponse
|
||||
nil, // 6: message.StreamRequest.DataEntry
|
||||
nil, // 7: message.StreamResponse.DataEntry
|
||||
}
|
||||
var file_grpc_proto_messager_proto_depIdxs = []int32{
|
||||
6, // 0: message.StreamRequest.data:type_name -> message.StreamRequest.DataEntry
|
||||
7, // 1: message.StreamResponse.data:type_name -> message.StreamResponse.DataEntry
|
||||
2, // 2: message.Message.Register:input_type -> message.RegisterRequest
|
||||
4, // 3: message.Message.SignOut:input_type -> message.SignOutRequest
|
||||
0, // 4: message.Message.BidirectionalStreamingMessage:input_type -> message.StreamRequest
|
||||
3, // 5: message.Message.Register:output_type -> message.RegisterResponse
|
||||
5, // 6: message.Message.SignOut:output_type -> message.SignOutResponse
|
||||
1, // 7: message.Message.BidirectionalStreamingMessage:output_type -> message.StreamResponse
|
||||
5, // [5:8] is the sub-list for method output_type
|
||||
2, // [2:5] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_grpc_proto_messager_proto_init() }
|
||||
func file_grpc_proto_messager_proto_init() {
|
||||
if File_grpc_proto_messager_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_grpc_proto_messager_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*StreamRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_grpc_proto_messager_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*StreamResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_grpc_proto_messager_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RegisterRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_grpc_proto_messager_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RegisterResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_grpc_proto_messager_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SignOutRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_grpc_proto_messager_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SignOutResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_grpc_proto_messager_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 8,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_grpc_proto_messager_proto_goTypes,
|
||||
DependencyIndexes: file_grpc_proto_messager_proto_depIdxs,
|
||||
MessageInfos: file_grpc_proto_messager_proto_msgTypes,
|
||||
}.Build()
|
||||
File_grpc_proto_messager_proto = out.File
|
||||
file_grpc_proto_messager_proto_rawDesc = nil
|
||||
file_grpc_proto_messager_proto_goTypes = nil
|
||||
file_grpc_proto_messager_proto_depIdxs = nil
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v3.19.4
|
||||
// source: grpc/proto/messager.proto
|
||||
|
||||
package messager
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// MessageClient is the client API for Message service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type MessageClient interface {
|
||||
Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterResponse, error)
|
||||
SignOut(ctx context.Context, in *SignOutRequest, opts ...grpc.CallOption) (*SignOutResponse, error)
|
||||
BidirectionalStreamingMessage(ctx context.Context, opts ...grpc.CallOption) (Message_BidirectionalStreamingMessageClient, error)
|
||||
}
|
||||
|
||||
type messageClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewMessageClient(cc grpc.ClientConnInterface) MessageClient {
|
||||
return &messageClient{cc}
|
||||
}
|
||||
|
||||
func (c *messageClient) Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterResponse, error) {
|
||||
out := new(RegisterResponse)
|
||||
err := c.cc.Invoke(ctx, "/message.Message/Register", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *messageClient) SignOut(ctx context.Context, in *SignOutRequest, opts ...grpc.CallOption) (*SignOutResponse, error) {
|
||||
out := new(SignOutResponse)
|
||||
err := c.cc.Invoke(ctx, "/message.Message/SignOut", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *messageClient) BidirectionalStreamingMessage(ctx context.Context, opts ...grpc.CallOption) (Message_BidirectionalStreamingMessageClient, error) {
|
||||
stream, err := c.cc.NewStream(ctx, &Message_ServiceDesc.Streams[0], "/message.Message/BidirectionalStreamingMessage", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &messageBidirectionalStreamingMessageClient{stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type Message_BidirectionalStreamingMessageClient interface {
|
||||
Send(*StreamRequest) error
|
||||
Recv() (*StreamResponse, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type messageBidirectionalStreamingMessageClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *messageBidirectionalStreamingMessageClient) Send(m *StreamRequest) error {
|
||||
return x.ClientStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *messageBidirectionalStreamingMessageClient) Recv() (*StreamResponse, error) {
|
||||
m := new(StreamResponse)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// MessageServer is the server API for Message service.
|
||||
// All implementations must embed UnimplementedMessageServer
|
||||
// for forward compatibility
|
||||
type MessageServer interface {
|
||||
Register(context.Context, *RegisterRequest) (*RegisterResponse, error)
|
||||
SignOut(context.Context, *SignOutRequest) (*SignOutResponse, error)
|
||||
BidirectionalStreamingMessage(Message_BidirectionalStreamingMessageServer) error
|
||||
mustEmbedUnimplementedMessageServer()
|
||||
}
|
||||
|
||||
// UnimplementedMessageServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedMessageServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedMessageServer) Register(context.Context, *RegisterRequest) (*RegisterResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Register not implemented")
|
||||
}
|
||||
func (UnimplementedMessageServer) SignOut(context.Context, *SignOutRequest) (*SignOutResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SignOut not implemented")
|
||||
}
|
||||
func (UnimplementedMessageServer) BidirectionalStreamingMessage(Message_BidirectionalStreamingMessageServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method BidirectionalStreamingMessage not implemented")
|
||||
}
|
||||
func (UnimplementedMessageServer) mustEmbedUnimplementedMessageServer() {}
|
||||
|
||||
// UnsafeMessageServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to MessageServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeMessageServer interface {
|
||||
mustEmbedUnimplementedMessageServer()
|
||||
}
|
||||
|
||||
func RegisterMessageServer(s grpc.ServiceRegistrar, srv MessageServer) {
|
||||
s.RegisterService(&Message_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Message_Register_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RegisterRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MessageServer).Register(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/message.Message/Register",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MessageServer).Register(ctx, req.(*RegisterRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Message_SignOut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SignOutRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MessageServer).SignOut(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/message.Message/SignOut",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MessageServer).SignOut(ctx, req.(*SignOutRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Message_BidirectionalStreamingMessage_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(MessageServer).BidirectionalStreamingMessage(&messageBidirectionalStreamingMessageServer{stream})
|
||||
}
|
||||
|
||||
type Message_BidirectionalStreamingMessageServer interface {
|
||||
Send(*StreamResponse) error
|
||||
Recv() (*StreamRequest, error)
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type messageBidirectionalStreamingMessageServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *messageBidirectionalStreamingMessageServer) Send(m *StreamResponse) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *messageBidirectionalStreamingMessageServer) Recv() (*StreamRequest, error) {
|
||||
m := new(StreamRequest)
|
||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// Message_ServiceDesc is the grpc.ServiceDesc for Message service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Message_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "message.Message",
|
||||
HandlerType: (*MessageServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Register",
|
||||
Handler: _Message_Register_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SignOut",
|
||||
Handler: _Message_SignOut_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "BidirectionalStreamingMessage",
|
||||
Handler: _Message_BidirectionalStreamingMessage_Handler,
|
||||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
},
|
||||
Metadata: "grpc/proto/messager.proto",
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package message;
|
||||
|
||||
option go_package = "grpc/messager";
|
||||
|
||||
service Message {
|
||||
rpc Register(RegisterRequest) returns (RegisterResponse) {}
|
||||
rpc SignOut(SignOutRequest) returns (SignOutResponse) {}
|
||||
rpc BidirectionalStreamingMessage(stream StreamRequest) returns (stream StreamResponse){};
|
||||
}
|
||||
|
||||
message StreamRequest{
|
||||
string type = 1;
|
||||
map<string, int64> data = 2;
|
||||
string NodeID = 3;
|
||||
}
|
||||
|
||||
message StreamResponse{
|
||||
string type = 1;
|
||||
bytes profile = 2;
|
||||
map<string, int64> data = 3;
|
||||
string NodeID = 4;
|
||||
bytes tasks = 5;
|
||||
}
|
||||
|
||||
message RegisterRequest{
|
||||
string NodeID = 1;
|
||||
}
|
||||
|
||||
message RegisterResponse{
|
||||
string code = 1;
|
||||
string message = 2;
|
||||
}
|
||||
|
||||
message SignOutRequest{
|
||||
string NodeID = 1;
|
||||
}
|
||||
|
||||
message SignOutResponse{
|
||||
string code = 1;
|
||||
string message = 2;
|
||||
}
|
||||
@@ -18,9 +18,9 @@ type genericMessage struct {
|
||||
Tasks []byte `json:"tasks,omitempty"`
|
||||
}
|
||||
|
||||
type profileMessage struct {
|
||||
Profile *Profile `json:"profile,omitempty"`
|
||||
Tasks []byte `json:"tasks,omitempty"`
|
||||
type task struct {
|
||||
Profile *Profile `json:"profile,omitempty"`
|
||||
TestCases []byte `json:"testcases,omitempty"`
|
||||
}
|
||||
|
||||
func newGenericMessage(t string, data map[string]int64, nodeID string) (msg *genericMessage) {
|
||||
|
||||
+333
-127
@@ -10,6 +10,10 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/boomer/grpc/messager"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||
"github.com/jinzhu/copier"
|
||||
|
||||
"github.com/go-errors/errors"
|
||||
|
||||
"github.com/olekukonko/tablewriter"
|
||||
@@ -203,9 +207,21 @@ type runner struct {
|
||||
// close this channel will stop all running workers.
|
||||
stopChan chan bool
|
||||
|
||||
stoppingChan chan bool
|
||||
|
||||
doneChan chan bool
|
||||
|
||||
reportChan chan bool
|
||||
|
||||
// close this channel will stop all goroutines used in runner.
|
||||
closeChan chan bool
|
||||
|
||||
// wgMu blocks concurrent waitgroup mutation while server stopping
|
||||
wgMu sync.RWMutex
|
||||
// wg is used to wait for the goroutines that depends on the server state
|
||||
// to exit when stopping the server.
|
||||
wg sync.WaitGroup
|
||||
|
||||
outputs []Output
|
||||
|
||||
once *sync.Once
|
||||
@@ -343,11 +359,12 @@ func (r *runner) reportTestResult() {
|
||||
}
|
||||
|
||||
func (r *runner) reset() {
|
||||
r.updateState(StateInit)
|
||||
r.controller.reset()
|
||||
r.stats.clearAll()
|
||||
r.rebalance = make(chan bool)
|
||||
r.stopChan = make(chan bool)
|
||||
r.stoppingChan = make(chan bool)
|
||||
r.doneChan = make(chan bool)
|
||||
r.reportChan = make(chan bool)
|
||||
}
|
||||
|
||||
func (r *runner) spawnWorkers(spawnCount int64, spawnRate float64, quit chan bool, spawnCompleteFunc func()) {
|
||||
@@ -376,7 +393,7 @@ func (r *runner) spawnWorkers(spawnCount int64, spawnRate float64, quit chan boo
|
||||
if r.loop != nil {
|
||||
workerLoop = &Loop{loopCount: atomic.LoadInt64(&r.loop.loopCount) / r.controller.spawnCount}
|
||||
}
|
||||
go func() {
|
||||
r.goAttach(func() {
|
||||
for {
|
||||
select {
|
||||
case <-quit:
|
||||
@@ -402,8 +419,7 @@ func (r *runner) spawnWorkers(spawnCount int64, spawnRate float64, quit chan boo
|
||||
// finished count of single worker
|
||||
workerLoop.increaseFinishedCount()
|
||||
if r.loop.isFinished() {
|
||||
r.stop()
|
||||
close(r.rebalance)
|
||||
go r.stop()
|
||||
}
|
||||
}
|
||||
if r.controller.erase() {
|
||||
@@ -411,7 +427,7 @@ func (r *runner) spawnWorkers(spawnCount int64, spawnRate float64, quit chan boo
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -433,6 +449,27 @@ func (r *runner) spawnWorkers(spawnCount int64, spawnRate float64, quit chan boo
|
||||
}
|
||||
}
|
||||
|
||||
// goAttach creates a goroutine on a given function and tracks it using
|
||||
// the runner waitgroup.
|
||||
// The passed function should interrupt on r.StoppingNotify().
|
||||
func (r *runner) goAttach(f func()) {
|
||||
r.wgMu.RLock() // this blocks with ongoing close(s.stopping)
|
||||
defer r.wgMu.RUnlock()
|
||||
select {
|
||||
case <-r.stoppingChan:
|
||||
log.Warn().Msg("server has stopped; skipping GoAttach")
|
||||
return
|
||||
default:
|
||||
}
|
||||
|
||||
// now safe to add since waitgroup wait has not started yet
|
||||
r.wg.Add(1)
|
||||
go func() {
|
||||
defer r.wg.Done()
|
||||
f()
|
||||
}()
|
||||
}
|
||||
|
||||
// setTasks will set the runner's task list AND the total task weight
|
||||
// which is used to get a random task later
|
||||
func (r *runner) setTasks(t []*Task) {
|
||||
@@ -496,6 +533,7 @@ func (r *runner) statsStart() {
|
||||
case <-ticker.C:
|
||||
r.reportStats()
|
||||
if !r.isStarted() {
|
||||
close(r.reportChan)
|
||||
log.Info().Msg("Quitting statsStart")
|
||||
return
|
||||
}
|
||||
@@ -506,13 +544,49 @@ func (r *runner) statsStart() {
|
||||
func (r *runner) stop() {
|
||||
// stop previous goroutines without blocking
|
||||
// those goroutines will exit when r.safeRun returns
|
||||
close(r.stopChan)
|
||||
r.Stop()
|
||||
if r.rateLimitEnabled {
|
||||
r.rateLimiter.Stop()
|
||||
}
|
||||
r.updateState(StateStopped)
|
||||
}
|
||||
|
||||
// HardStop stops the server without coordination with other members in the cluster.
|
||||
func (r *runner) hardStop() {
|
||||
select {
|
||||
case r.stopChan <- true:
|
||||
case <-r.doneChan:
|
||||
return
|
||||
}
|
||||
<-r.doneChan
|
||||
}
|
||||
|
||||
// Stop stops the server gracefully, and shuts down the running goroutine.
|
||||
// Stop should be called after a Start(s), otherwise it will block forever.
|
||||
// When stopping leader, Stop transfers its leadership to one of its peers
|
||||
// before stopping the server.
|
||||
// Stop terminates the Server and performs any necessary finalization.
|
||||
// Do and Process cannot be called after Stop has been invoked.
|
||||
func (r *runner) Stop() {
|
||||
r.hardStop()
|
||||
}
|
||||
|
||||
// StopNotify returns a channel that receives a empty struct
|
||||
// when the server is stopped.
|
||||
func (r *runner) StopNotify() <-chan bool { return r.stopChan }
|
||||
|
||||
// DoneNotify returns a channel that receives a empty struct
|
||||
// when the server is stopped.
|
||||
func (r *runner) DoneNotify() <-chan bool { return r.doneChan }
|
||||
|
||||
// StoppingNotify returns a channel that receives a empty struct
|
||||
// when the server is being stopped.
|
||||
func (r *runner) StoppingNotify() <-chan bool { return r.stoppingChan }
|
||||
|
||||
// RebalanceNotify returns a channel that receives a empty struct
|
||||
// when the server is being stopped.
|
||||
func (r *runner) RebalanceNotify() <-chan bool { return r.rebalance }
|
||||
|
||||
func (r *runner) getState() int32 {
|
||||
return atomic.LoadInt32(&r.state)
|
||||
}
|
||||
@@ -541,13 +615,17 @@ func newLocalRunner(spawnCount int64, spawnRate float64) *localRunner {
|
||||
spawnRate: spawnRate,
|
||||
controller: &Controller{},
|
||||
outputs: make([]Output, 0),
|
||||
stopChan: make(chan bool),
|
||||
closeChan: make(chan bool),
|
||||
once: &sync.Once{},
|
||||
wg: sync.WaitGroup{},
|
||||
wgMu: sync.RWMutex{},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (r *localRunner) start() {
|
||||
r.updateState(StateInit)
|
||||
// init localRunner
|
||||
r.reset()
|
||||
|
||||
@@ -558,34 +636,40 @@ func (r *localRunner) start() {
|
||||
// output setup
|
||||
r.outputOnStart()
|
||||
|
||||
go r.spawnWorkers(r.getSpawnCount(), r.getSpawnRate(), r.stopChan, nil)
|
||||
go r.spawnWorkers(r.getSpawnCount(), r.getSpawnRate(), r.stoppingChan, nil)
|
||||
|
||||
defer func() {
|
||||
r.wgMu.Lock() // block concurrent waitgroup adds in GoAttach while stopping
|
||||
close(r.stoppingChan)
|
||||
close(r.rebalance)
|
||||
r.wgMu.Unlock()
|
||||
|
||||
// wait for goroutines before closing
|
||||
r.wg.Wait()
|
||||
|
||||
r.updateState(StateStopping)
|
||||
|
||||
<-r.reportChan
|
||||
|
||||
// report test result
|
||||
r.reportTestResult()
|
||||
|
||||
// output teardown
|
||||
r.outputOnStop()
|
||||
|
||||
close(r.doneChan)
|
||||
r.updateState(StateQuitting)
|
||||
}()
|
||||
|
||||
// start stats report
|
||||
r.statsStart()
|
||||
go r.statsStart()
|
||||
|
||||
// stop
|
||||
<-r.stopChan
|
||||
r.updateState(StateStopped)
|
||||
|
||||
// stop rate limiter
|
||||
if r.rateLimitEnabled {
|
||||
r.rateLimiter.Stop()
|
||||
}
|
||||
|
||||
// report test result
|
||||
r.reportTestResult()
|
||||
|
||||
// output teardown
|
||||
r.outputOnStop()
|
||||
|
||||
r.updateState(StateQuitting)
|
||||
return
|
||||
}
|
||||
|
||||
func (r *localRunner) stop() {
|
||||
if r.runner.isStarted() {
|
||||
r.runner.stop()
|
||||
close(r.rebalance)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,7 +684,7 @@ type workerRunner struct {
|
||||
|
||||
profile *Profile
|
||||
|
||||
tasksChan chan *profileMessage
|
||||
tasksChan chan *task
|
||||
|
||||
mutex sync.Mutex
|
||||
ignoreQuit bool
|
||||
@@ -612,13 +696,14 @@ func newWorkerRunner(masterHost string, masterPort int) (r *workerRunner) {
|
||||
stats: newRequestStats(),
|
||||
outputs: make([]Output, 0),
|
||||
controller: &Controller{},
|
||||
stopChan: make(chan bool),
|
||||
closeChan: make(chan bool),
|
||||
once: &sync.Once{},
|
||||
},
|
||||
masterHost: masterHost,
|
||||
masterPort: masterPort,
|
||||
nodeID: getNodeID(),
|
||||
tasksChan: make(chan *profileMessage, 10),
|
||||
tasksChan: make(chan *task, 10),
|
||||
mutex: sync.Mutex{},
|
||||
ignoreQuit: false,
|
||||
}
|
||||
@@ -643,9 +728,9 @@ func (r *workerRunner) onSpawnMessage(msg *genericMessage) {
|
||||
if msg.Tasks == nil && len(r.tasks) == 0 {
|
||||
log.Error().Msg("miss tasks")
|
||||
}
|
||||
r.tasksChan <- &profileMessage{
|
||||
Profile: profile,
|
||||
Tasks: msg.Tasks,
|
||||
r.tasksChan <- &task{
|
||||
Profile: profile,
|
||||
TestCases: msg.Tasks,
|
||||
}
|
||||
log.Info().Msg("on spawn message successful")
|
||||
}
|
||||
@@ -658,7 +743,7 @@ func (r *workerRunner) onRebalanceMessage(msg *genericMessage) {
|
||||
r.setSpawnCount(profile.SpawnCount)
|
||||
r.setSpawnRate(profile.SpawnRate)
|
||||
|
||||
r.tasksChan <- &profileMessage{
|
||||
r.tasksChan <- &task{
|
||||
Profile: profile,
|
||||
}
|
||||
log.Info().Msg("on rebalance message successful")
|
||||
@@ -672,6 +757,9 @@ func (r *workerRunner) onMessage(msg *genericMessage) {
|
||||
case "spawn":
|
||||
r.onSpawnMessage(msg)
|
||||
case "quit":
|
||||
if r.ignoreQuit {
|
||||
break
|
||||
}
|
||||
r.close()
|
||||
}
|
||||
case StateSpawning:
|
||||
@@ -698,8 +786,10 @@ func (r *workerRunner) onMessage(msg *genericMessage) {
|
||||
switch msg.Type {
|
||||
case "spawn":
|
||||
r.onSpawnMessage(msg)
|
||||
go r.start()
|
||||
case "quit":
|
||||
if r.ignoreQuit {
|
||||
break
|
||||
}
|
||||
r.close()
|
||||
}
|
||||
}
|
||||
@@ -725,57 +815,88 @@ func (r *workerRunner) startListener() {
|
||||
|
||||
// run worker service
|
||||
func (r *workerRunner) run() {
|
||||
println("\n========================= HttpRunner Worker for Distributed Load Testing ========================= ")
|
||||
r.updateState(StateInit)
|
||||
r.client = newClient(r.masterHost, r.masterPort, r.nodeID)
|
||||
|
||||
err := r.client.connect()
|
||||
println(fmt.Sprintf("ready to connect master to %s:%d", r.masterHost, r.masterPort))
|
||||
err := r.client.start()
|
||||
if err != nil {
|
||||
log.Printf("Failed to connect to master(%s:%d) with error %v\n", r.masterHost, r.masterPort, err)
|
||||
log.Error().Err(err).Msg(fmt.Sprintf("failed to connect to master(%s:%d) with error %v\n", r.masterHost, r.masterPort))
|
||||
}
|
||||
|
||||
if err = r.client.register(r.client.config.ctx); err != nil {
|
||||
log.Error().Err(err).Msg("failed to register")
|
||||
}
|
||||
|
||||
err = r.client.newBiStreamClient()
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("failed to establish bidirectional stream, waiting master launched")
|
||||
}
|
||||
|
||||
go r.client.recv()
|
||||
go r.client.send()
|
||||
|
||||
defer func() {
|
||||
r.wg.Wait()
|
||||
|
||||
var ticker = time.NewTicker(1 * time.Second)
|
||||
if r.client != nil {
|
||||
// waitting for quit message is sent to master
|
||||
select {
|
||||
case <-r.client.disconnectedChannel():
|
||||
case <-ticker.C:
|
||||
log.Warn().Msg("Timeout waiting for sending quit message to master, boomer will quit any way.")
|
||||
}
|
||||
|
||||
if err = r.client.signOut(r.client.config.ctx); err != nil {
|
||||
log.Error().Err(err).Msg("failed to sign out")
|
||||
}
|
||||
r.client.close()
|
||||
}
|
||||
}()
|
||||
|
||||
// listen to master
|
||||
go r.startListener()
|
||||
|
||||
// register worker information to master
|
||||
r.client.sendChannel() <- newGenericMessage("register", nil, r.nodeID)
|
||||
// tell master, I'm ready
|
||||
log.Info().Msg("send client ready signal")
|
||||
r.client.sendChannel() <- newClientReadyMessageToMaster(r.nodeID)
|
||||
|
||||
// heartbeat
|
||||
// See: https://github.com/locustio/locust/commit/a8c0d7d8c588f3980303358298870f2ea394ab93
|
||||
go func() {
|
||||
var ticker = time.NewTicker(heartbeatInterval)
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
if atomic.LoadInt32(&r.client.failCount) > 2 {
|
||||
r.updateState(StateMissing)
|
||||
}
|
||||
if r.getState() == StateMissing {
|
||||
if r.client.reConnect() == nil {
|
||||
r.updateState(StateInit)
|
||||
}
|
||||
}
|
||||
CPUUsage := GetCurrentCPUUsage()
|
||||
data := map[string]int64{
|
||||
"state": int64(r.getState()),
|
||||
"current_cpu_usage": int64(CPUUsage),
|
||||
"spawn_count": r.controller.getCurrentClientsNum(),
|
||||
}
|
||||
r.client.sendChannel() <- newGenericMessage("heartbeat", data, r.nodeID)
|
||||
case <-r.closeChan:
|
||||
return
|
||||
var ticker = time.NewTicker(heartbeatInterval)
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
if atomic.LoadInt32(&r.client.failCount) > 2 {
|
||||
r.updateState(StateMissing)
|
||||
}
|
||||
if r.getState() == StateMissing {
|
||||
err = r.client.register(r.client.config.ctx)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
if r.client.newBiStreamClient() == nil {
|
||||
r.updateState(StateInit)
|
||||
}
|
||||
}
|
||||
CPUUsage := GetCurrentCPUUsage()
|
||||
data := map[string]int64{
|
||||
"state": int64(r.getState()),
|
||||
"current_cpu_usage": int64(CPUUsage),
|
||||
"spawn_count": r.controller.getCurrentClientsNum(),
|
||||
}
|
||||
r.client.sendChannel() <- newGenericMessage("heartbeat", data, r.nodeID)
|
||||
case <-r.closeChan:
|
||||
return
|
||||
}
|
||||
}()
|
||||
<-r.closeChan
|
||||
}
|
||||
}
|
||||
|
||||
// start load test
|
||||
func (r *workerRunner) start() {
|
||||
r.mutex.Lock()
|
||||
defer r.mutex.Unlock()
|
||||
r.updateState(StateInit)
|
||||
r.reset()
|
||||
|
||||
// start rate limiter
|
||||
@@ -785,38 +906,42 @@ func (r *workerRunner) start() {
|
||||
|
||||
r.once.Do(r.outputOnStart)
|
||||
|
||||
go r.spawnWorkers(r.getSpawnCount(), r.getSpawnRate(), r.stopChan, r.spawnComplete)
|
||||
go r.spawnWorkers(r.getSpawnCount(), r.getSpawnRate(), r.stoppingChan, r.spawnComplete)
|
||||
|
||||
defer func() {
|
||||
r.wgMu.Lock() // block concurrent waitgroup adds in GoAttach while stopping
|
||||
close(r.stoppingChan)
|
||||
close(r.rebalance)
|
||||
r.wgMu.Unlock()
|
||||
|
||||
// wait for goroutines before closing
|
||||
r.wg.Wait()
|
||||
|
||||
r.updateState(StateStopping)
|
||||
|
||||
<-r.reportChan
|
||||
|
||||
r.reportTestResult()
|
||||
r.outputOnStop()
|
||||
|
||||
close(r.doneChan)
|
||||
}()
|
||||
|
||||
// start stats report
|
||||
r.statsStart()
|
||||
go r.statsStart()
|
||||
|
||||
r.reportTestResult()
|
||||
r.outputOnStop()
|
||||
<-r.stopChan
|
||||
}
|
||||
|
||||
func (r *workerRunner) stop() {
|
||||
if r.isStarted() {
|
||||
r.runner.stop()
|
||||
close(r.rebalance)
|
||||
}
|
||||
}
|
||||
|
||||
func (r *workerRunner) close() {
|
||||
// waiting report finished
|
||||
time.Sleep(1 * time.Second)
|
||||
r.onQuiting()
|
||||
close(r.closeChan)
|
||||
var ticker = time.NewTicker(1 * time.Second)
|
||||
if r.client != nil {
|
||||
// waitting for quit message is sent to master
|
||||
select {
|
||||
case <-r.client.disconnectedChannel():
|
||||
break
|
||||
case <-ticker.C:
|
||||
log.Warn().Msg("Timeout waiting for sending quit message to master, boomer will quit any way.")
|
||||
r.onQuiting()
|
||||
}
|
||||
r.client.close()
|
||||
}
|
||||
}
|
||||
|
||||
// masterRunner controls worker to spawn goroutines and collect stats.
|
||||
@@ -835,15 +960,18 @@ type masterRunner struct {
|
||||
|
||||
parseTestCasesChan chan bool
|
||||
testCaseBytes chan []byte
|
||||
// set profile to worker
|
||||
profileBytes chan []byte
|
||||
tcb []byte
|
||||
}
|
||||
|
||||
func newMasterRunner(masterBindHost string, masterBindPort int) *masterRunner {
|
||||
return &masterRunner{
|
||||
runner: runner{
|
||||
state: StateInit,
|
||||
closeChan: make(chan bool),
|
||||
state: StateInit,
|
||||
stoppingChan: make(chan bool),
|
||||
doneChan: make(chan bool),
|
||||
closeChan: make(chan bool),
|
||||
wg: sync.WaitGroup{},
|
||||
wgMu: sync.RWMutex{},
|
||||
},
|
||||
masterBindHost: masterBindHost,
|
||||
masterBindPort: masterBindPort,
|
||||
@@ -908,9 +1036,6 @@ func (r *masterRunner) clientListener() {
|
||||
}
|
||||
switch msg.Type {
|
||||
case typeClientReady:
|
||||
if workerInfo.getState() == StateInit {
|
||||
break
|
||||
}
|
||||
workerInfo.setState(StateInit)
|
||||
if r.getState() == StateRunning {
|
||||
log.Warn().Str("worker id", workerInfo.ID).Msg("worker joined, ready to rebalance the load of each worker")
|
||||
@@ -975,40 +1100,52 @@ func (r *masterRunner) run() {
|
||||
return
|
||||
}
|
||||
|
||||
// listen and deal message from worker
|
||||
go r.clientListener()
|
||||
// listen and record heartbeat from worker
|
||||
go r.heartbeatWorker()
|
||||
defer func() {
|
||||
r.wgMu.Lock() // block concurrent waitgroup adds in GoAttach while stopping
|
||||
close(r.stoppingChan)
|
||||
r.wgMu.Unlock()
|
||||
|
||||
r.wg.Wait()
|
||||
|
||||
r.server.close()
|
||||
|
||||
close(r.doneChan)
|
||||
}()
|
||||
|
||||
if r.autoStart {
|
||||
log.Info().Msg("auto start, waiting expected workers joined")
|
||||
var ticker = time.NewTicker(1 * time.Second)
|
||||
var tickerMaxWait = time.NewTicker(time.Duration(r.expectWorkersMaxWait) * time.Second)
|
||||
FOR:
|
||||
for {
|
||||
select {
|
||||
case <-r.closeChan:
|
||||
return
|
||||
case <-ticker.C:
|
||||
c := r.server.getClientsLength()
|
||||
log.Info().Msg(fmt.Sprintf("expected worker number: %v, current worker count: %v", r.expectWorkers, c))
|
||||
if c >= r.expectWorkers {
|
||||
go func() {
|
||||
r.goAttach(func() {
|
||||
log.Info().Msg("auto start, waiting expected workers joined")
|
||||
var ticker = time.NewTicker(1 * time.Second)
|
||||
var tickerMaxWait = time.NewTicker(time.Duration(r.expectWorkersMaxWait) * time.Second)
|
||||
for {
|
||||
select {
|
||||
case <-r.closeChan:
|
||||
return
|
||||
case <-ticker.C:
|
||||
c := r.server.getClientsLength()
|
||||
log.Info().Msg(fmt.Sprintf("expected worker number: %v, current worker count: %v", r.expectWorkers, c))
|
||||
if c >= r.expectWorkers {
|
||||
err = r.start()
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("failed to run")
|
||||
os.Exit(1)
|
||||
}
|
||||
}()
|
||||
break FOR
|
||||
return
|
||||
}
|
||||
case <-tickerMaxWait.C:
|
||||
log.Warn().Msg("reached max wait time, quiting")
|
||||
r.onQuiting()
|
||||
os.Exit(1)
|
||||
}
|
||||
case <-tickerMaxWait.C:
|
||||
log.Warn().Msg("reached max wait time, quiting")
|
||||
r.onQuiting()
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// listen and deal message from worker
|
||||
r.goAttach(r.clientListener)
|
||||
|
||||
// listen and record heartbeat from worker
|
||||
r.heartbeatWorker()
|
||||
<-r.closeChan
|
||||
}
|
||||
|
||||
@@ -1018,17 +1155,48 @@ func (r *masterRunner) start() error {
|
||||
return errors.New("current workers: 0")
|
||||
}
|
||||
|
||||
log.Info().Msg("send spawn data to worker")
|
||||
r.updateState(StateSpawning)
|
||||
// fetching testcase
|
||||
testcase, err := r.fetchTestCase()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
profile := r.profile.dispatch(int64(numWorkers))
|
||||
|
||||
r.server.sendChannel() <- newMessageToWorker("spawn", ProfileToBytes(profile), nil, testcase)
|
||||
log.Warn().Interface("profile", profile).Msg("send spawn data to worker successful")
|
||||
workerProfile := &Profile{}
|
||||
if err := copier.Copy(workerProfile, r.profile); err != nil {
|
||||
log.Error().Err(err).Msg("copy workerProfile failed")
|
||||
return err
|
||||
}
|
||||
cur := 0
|
||||
ints := builtin.SplitInteger(int(r.profile.SpawnCount), numWorkers)
|
||||
log.Info().Msg("send spawn data to worker")
|
||||
r.updateState(StateSpawning)
|
||||
r.server.clients.Range(func(key, value interface{}) bool {
|
||||
if workerInfo, ok := value.(*WorkerNode); ok {
|
||||
if workerInfo.getState() == StateQuitting || workerInfo.getState() == StateMissing {
|
||||
return true
|
||||
}
|
||||
if workerProfile.SpawnCount > 0 {
|
||||
workerProfile.SpawnCount = int64(ints[cur])
|
||||
}
|
||||
if workerProfile.SpawnRate > 0 {
|
||||
workerProfile.SpawnRate = workerProfile.SpawnRate / float64(numWorkers)
|
||||
}
|
||||
if workerProfile.MaxRPS > 0 {
|
||||
workerProfile.MaxRPS = workerProfile.MaxRPS / int64(numWorkers)
|
||||
}
|
||||
workerInfo.getStream() <- &messager.StreamResponse{
|
||||
Type: "spawn",
|
||||
Profile: ProfileToBytes(workerProfile),
|
||||
Data: map[string]int64{},
|
||||
NodeID: workerInfo.ID,
|
||||
Tasks: testcase,
|
||||
}
|
||||
cur++
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
log.Warn().Interface("profile", r.profile).Msg("send spawn data to worker successful")
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1037,9 +1205,49 @@ func (r *masterRunner) rebalance() error {
|
||||
if numWorkers == 0 {
|
||||
return errors.New("current workers: 0")
|
||||
}
|
||||
profile := r.profile.dispatch(int64(numWorkers))
|
||||
workerProfile := &Profile{}
|
||||
if err := copier.Copy(workerProfile, r.profile); err != nil {
|
||||
log.Error().Err(err).Msg("copy workerProfile failed")
|
||||
return err
|
||||
}
|
||||
cur := 0
|
||||
ints := builtin.SplitInteger(int(r.profile.SpawnCount), numWorkers)
|
||||
log.Info().Msg("send spawn data to worker")
|
||||
r.server.clients.Range(func(key, value interface{}) bool {
|
||||
if workerInfo, ok := value.(*WorkerNode); ok {
|
||||
if workerInfo.getState() == StateQuitting || workerInfo.getState() == StateMissing {
|
||||
return true
|
||||
}
|
||||
if workerProfile.SpawnCount > 0 {
|
||||
workerProfile.SpawnCount = int64(ints[cur])
|
||||
}
|
||||
if workerProfile.SpawnRate > 0 {
|
||||
workerProfile.SpawnRate = workerProfile.SpawnRate / float64(numWorkers)
|
||||
}
|
||||
if workerProfile.MaxRPS > 0 {
|
||||
workerProfile.MaxRPS = workerProfile.MaxRPS / int64(numWorkers)
|
||||
}
|
||||
if workerInfo.getState() == StateInit {
|
||||
workerInfo.getStream() <- &messager.StreamResponse{
|
||||
Type: "spawn",
|
||||
Profile: ProfileToBytes(workerProfile),
|
||||
Data: map[string]int64{},
|
||||
NodeID: workerInfo.ID,
|
||||
Tasks: r.tcb,
|
||||
}
|
||||
} else {
|
||||
workerInfo.getStream() <- &messager.StreamResponse{
|
||||
Type: "rebalance",
|
||||
Profile: ProfileToBytes(workerProfile),
|
||||
Data: map[string]int64{},
|
||||
NodeID: workerInfo.ID,
|
||||
}
|
||||
}
|
||||
cur++
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
r.server.sendChannel() <- newMessageToWorker("rebalance", ProfileToBytes(profile), nil, nil)
|
||||
log.Warn().Msg("send rebalance data to worker successful")
|
||||
return nil
|
||||
}
|
||||
@@ -1054,6 +1262,7 @@ func (r *masterRunner) fetchTestCase() ([]byte, error) {
|
||||
case <-ticker.C:
|
||||
return nil, errors.New("parse testcases timeout")
|
||||
case tcb := <-r.testCaseBytes:
|
||||
r.tcb = tcb
|
||||
return tcb, nil
|
||||
}
|
||||
}
|
||||
@@ -1061,8 +1270,7 @@ func (r *masterRunner) fetchTestCase() ([]byte, error) {
|
||||
func (r *masterRunner) stop() error {
|
||||
if r.isStarted() {
|
||||
r.updateState(StateStopping)
|
||||
r.server.sendChannel() <- &genericMessage{Type: "stop", Data: map[string]int64{}}
|
||||
r.updateState(StateStopped)
|
||||
r.server.sendBroadcasts(&genericMessage{Type: "stop", Data: map[string]int64{}})
|
||||
return nil
|
||||
} else {
|
||||
return errors.New("already stopped")
|
||||
@@ -1071,24 +1279,22 @@ func (r *masterRunner) stop() error {
|
||||
|
||||
func (r *masterRunner) onQuiting() {
|
||||
if r.getState() != StateQuitting {
|
||||
r.server.sendChannel() <- &genericMessage{
|
||||
r.server.sendBroadcasts(&genericMessage{
|
||||
Type: "quit",
|
||||
}
|
||||
})
|
||||
}
|
||||
r.updateState(StateQuitting)
|
||||
}
|
||||
|
||||
func (r *masterRunner) close() {
|
||||
r.onQuiting()
|
||||
r.server.wg.Wait()
|
||||
close(r.closeChan)
|
||||
r.server.close()
|
||||
}
|
||||
|
||||
func (r *masterRunner) reportStats() {
|
||||
currentTime := time.Now()
|
||||
println()
|
||||
println("===================== HttpRunner Master for Distributed Load Testing ===================== ")
|
||||
println("========================= HttpRunner Master for Distributed Load Testing ========================= ")
|
||||
println(fmt.Sprintf("Current time: %s, State: %v, Current Available Workers: %v, Target Users: %v",
|
||||
currentTime.Format("2006/01/02 15:04:05"), getStateName(r.getState()), r.server.getClientsLength(), r.getSpawnCount()))
|
||||
table := tablewriter.NewWriter(os.Stdout)
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/boomer/grpc/messager"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -113,6 +114,32 @@ func TestLoopCount(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestStopNotify(t *testing.T) {
|
||||
r := &localRunner{
|
||||
runner: runner{
|
||||
stopChan: make(chan bool),
|
||||
doneChan: make(chan bool),
|
||||
},
|
||||
}
|
||||
go func() {
|
||||
<-r.stopChan
|
||||
close(r.doneChan)
|
||||
}()
|
||||
|
||||
notifier := r.DoneNotify()
|
||||
select {
|
||||
case <-notifier:
|
||||
t.Fatalf("received unexpected stop notification")
|
||||
default:
|
||||
}
|
||||
r.Stop()
|
||||
select {
|
||||
case <-notifier:
|
||||
default:
|
||||
t.Fatalf("cannot receive stop notification")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSpawnWorkers(t *testing.T) {
|
||||
taskA := &Task{
|
||||
Weight: 10,
|
||||
@@ -239,7 +266,8 @@ func TestSpawnAndStop(t *testing.T) {
|
||||
if msg.Type != "spawning_complete" {
|
||||
t.Error("Runner should send spawning_complete message when spawning completed, got", msg.Type)
|
||||
}
|
||||
runner.stop()
|
||||
go runner.stop()
|
||||
close(runner.doneChan)
|
||||
|
||||
runner.onQuiting()
|
||||
msg = <-runner.client.sendChannel()
|
||||
@@ -260,10 +288,11 @@ func TestStop(t *testing.T) {
|
||||
runner.reset()
|
||||
runner.updateState(StateSpawning)
|
||||
|
||||
runner.stop()
|
||||
|
||||
go runner.stop()
|
||||
close(runner.doneChan)
|
||||
time.Sleep(1 * time.Second)
|
||||
if runner.getState() != StateStopped {
|
||||
t.Error("Expected runner state to be 5, was", runner.getState())
|
||||
t.Error("Expected runner state to be 5, was", getStateName(runner.getState()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +334,8 @@ func TestOnQuitMessage(t *testing.T) {
|
||||
runner.reset()
|
||||
runner.closeChan = make(chan bool)
|
||||
runner.client.shutdownChan = make(chan bool)
|
||||
runner.onMessage(newGenericMessage("quit", nil, runner.nodeID))
|
||||
go runner.onMessage(newGenericMessage("quit", nil, runner.nodeID))
|
||||
close(runner.doneChan)
|
||||
<-runner.closeChan
|
||||
if runner.getState() != StateQuitting {
|
||||
t.Error("Runner's state should be StateQuitting")
|
||||
@@ -359,7 +389,7 @@ func TestOnMessage(t *testing.T) {
|
||||
t.Error("Runner should send spawning_complete message when spawn completed, got", msg.Type)
|
||||
}
|
||||
if runner.getState() != StateRunning {
|
||||
t.Error("State of runner is not running after spawn, got", runner.getState())
|
||||
t.Error("State of runner is not running after spawn, got", getStateName(runner.getState()))
|
||||
}
|
||||
|
||||
// increase goroutines while running
|
||||
@@ -368,7 +398,7 @@ func TestOnMessage(t *testing.T) {
|
||||
|
||||
time.Sleep(2 * time.Second)
|
||||
if runner.getState() != StateRunning {
|
||||
t.Error("State of runner is not running after spawn, got", runner.getState())
|
||||
t.Error("State of runner is not running after spawn, got", getStateName(runner.getState()))
|
||||
}
|
||||
if runner.controller.getCurrentClientsNum() != 15 {
|
||||
t.Error("Number of goroutines mismatches, expected: 15, current count:", runner.controller.getCurrentClientsNum())
|
||||
@@ -377,7 +407,7 @@ func TestOnMessage(t *testing.T) {
|
||||
// stop all the workers
|
||||
runner.onMessage(newGenericMessage("stop", nil, runner.nodeID))
|
||||
if runner.getState() != StateStopped {
|
||||
t.Error("State of runner is not stopped, got", runner.getState())
|
||||
t.Error("State of runner is not stopped, got", getStateName(runner.getState()))
|
||||
}
|
||||
msg = <-runner.client.sendChannel()
|
||||
if msg.Type != "client_stopped" {
|
||||
@@ -401,7 +431,7 @@ func TestOnMessage(t *testing.T) {
|
||||
t.Error("Number of goroutines mismatches, expected: 10, current count:", runner.controller.getCurrentClientsNum())
|
||||
}
|
||||
if runner.getState() != StateRunning {
|
||||
t.Error("State of runner is not running after spawn, got", runner.getState())
|
||||
t.Error("State of runner is not running after spawn, got", getStateName(runner.getState()))
|
||||
}
|
||||
msg = <-runner.client.sendChannel()
|
||||
if msg.Type != "spawning_complete" {
|
||||
@@ -411,7 +441,7 @@ func TestOnMessage(t *testing.T) {
|
||||
// stop all the workers
|
||||
runner.onMessage(newGenericMessage("stop", nil, runner.nodeID))
|
||||
if runner.getState() != StateStopped {
|
||||
t.Error("State of runner is not stopped, got", runner.getState())
|
||||
t.Error("State of runner is not stopped, got", getStateName(runner.getState()))
|
||||
}
|
||||
msg = <-runner.client.sendChannel()
|
||||
if msg.Type != "client_stopped" {
|
||||
@@ -430,8 +460,8 @@ func TestClientListener(t *testing.T) {
|
||||
runner.setSpawnCount(10)
|
||||
runner.setSpawnRate(10)
|
||||
go runner.clientListener()
|
||||
runner.server.clients.Store("testID1", &WorkerNode{ID: "testID1", Heartbeat: 3})
|
||||
runner.server.clients.Store("testID2", &WorkerNode{ID: "testID2", Heartbeat: 3})
|
||||
runner.server.clients.Store("testID1", &WorkerNode{ID: "testID1", Heartbeat: 3, stream: make(chan *messager.StreamResponse, 10)})
|
||||
runner.server.clients.Store("testID2", &WorkerNode{ID: "testID2", Heartbeat: 3, stream: make(chan *messager.StreamResponse, 10)})
|
||||
runner.server.recvChannel() <- &genericMessage{
|
||||
Type: typeClientReady,
|
||||
NodeID: "testID1",
|
||||
@@ -470,7 +500,7 @@ func TestClientListener(t *testing.T) {
|
||||
}
|
||||
time.Sleep(time.Second)
|
||||
if runner.getState() != StateStopped {
|
||||
t.Error("State of master runner is not stopped, got", runner.getState())
|
||||
t.Error("State of master runner is not stopped, got", getStateName(runner.getState()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -480,8 +510,8 @@ func TestHeartbeatWorker(t *testing.T) {
|
||||
runner.updateState(StateInit)
|
||||
runner.setSpawnCount(10)
|
||||
runner.setSpawnRate(10)
|
||||
runner.server.clients.Store("testID1", &WorkerNode{ID: "testID1", Heartbeat: 1, State: StateInit})
|
||||
runner.server.clients.Store("testID2", &WorkerNode{ID: "testID2", Heartbeat: 1, State: StateInit})
|
||||
runner.server.clients.Store("testID1", &WorkerNode{ID: "testID1", Heartbeat: 1, State: StateInit, stream: make(chan *messager.StreamResponse, 10)})
|
||||
runner.server.clients.Store("testID2", &WorkerNode{ID: "testID2", Heartbeat: 1, State: StateInit, stream: make(chan *messager.StreamResponse, 10)})
|
||||
go runner.clientListener()
|
||||
go runner.heartbeatWorker()
|
||||
time.Sleep(3 * time.Second)
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
package boomer
|
||||
+277
-229
@@ -3,7 +3,6 @@ package boomer
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -17,106 +16,11 @@ import (
|
||||
"google.golang.org/grpc/reflection"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/data"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/grpc/messager"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/boomer/data"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/boomer/grpc/messager"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
var (
|
||||
errMissingMetadata = status.Errorf(codes.InvalidArgument, "missing metadata")
|
||||
errInvalidToken = status.Errorf(codes.Unauthenticated, "invalid token")
|
||||
)
|
||||
|
||||
// valid validates the authorization.
|
||||
func valid(authorization []string) bool {
|
||||
if len(authorization) < 1 {
|
||||
return false
|
||||
}
|
||||
token := strings.TrimPrefix(authorization[0], "Bearer ")
|
||||
// Perform the token validation here. For the sake of this example, the code
|
||||
// here forgoes any of the usual OAuth2 token validation and instead checks
|
||||
// for a token matching an arbitrary string.
|
||||
return token == "httprunner-secret-token"
|
||||
}
|
||||
|
||||
func serverUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
|
||||
// authentication (token verification)
|
||||
md, ok := metadata.FromIncomingContext(ctx)
|
||||
if !ok {
|
||||
return nil, errMissingMetadata
|
||||
}
|
||||
if !valid(md["authorization"]) {
|
||||
return nil, errInvalidToken
|
||||
}
|
||||
m, err := handler(ctx, req)
|
||||
if err != nil {
|
||||
logger("RPC failed with error %v", err)
|
||||
}
|
||||
return m, err
|
||||
}
|
||||
|
||||
// serverWrappedStream wraps around the embedded grpc.ServerStream, and intercepts the RecvMsg and
|
||||
// SendMsg method call.
|
||||
type serverWrappedStream struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (w *serverWrappedStream) RecvMsg(m interface{}) error {
|
||||
logger("Receive a message (Type: %T) at %s", m, time.Now().Format(time.RFC3339))
|
||||
return w.ServerStream.RecvMsg(m)
|
||||
}
|
||||
|
||||
func (w *serverWrappedStream) SendMsg(m interface{}) error {
|
||||
logger("Send a message (Type: %T) at %v", m, time.Now().Format(time.RFC3339))
|
||||
return w.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func newServerWrappedStream(s grpc.ServerStream) grpc.ServerStream {
|
||||
return &serverWrappedStream{s}
|
||||
}
|
||||
|
||||
func serverStreamInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
|
||||
// authentication (token verification)
|
||||
md, ok := metadata.FromIncomingContext(ss.Context())
|
||||
if !ok {
|
||||
return errMissingMetadata
|
||||
}
|
||||
if !valid(md["authorization"]) {
|
||||
return errInvalidToken
|
||||
}
|
||||
|
||||
err := handler(srv, newServerWrappedStream(ss))
|
||||
if err != nil {
|
||||
logger("RPC failed with error %v", err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *grpcServer) BidirectionalStreamingMessage(srv messager.Message_BidirectionalStreamingMessageServer) error {
|
||||
s.wg.Add(1)
|
||||
defer s.wg.Done()
|
||||
req, err := srv.Recv()
|
||||
switch err {
|
||||
case nil:
|
||||
break
|
||||
case io.EOF:
|
||||
return nil
|
||||
default:
|
||||
if err.Error() == status.Error(codes.Canceled, context.Canceled.Error()).Error() {
|
||||
return nil
|
||||
}
|
||||
log.Error().Err(err).Msg("failed to get stream from client")
|
||||
return err
|
||||
}
|
||||
wn := &WorkerNode{messenger: srv, ID: req.NodeID, Heartbeat: 3}
|
||||
s.clients.Store(req.NodeID, wn)
|
||||
log.Warn().Str("worker id", req.NodeID).Msg("worker joined")
|
||||
<-s.disconnectedChannel()
|
||||
s.clients.Delete(req.NodeID)
|
||||
log.Warn().Str("worker id", req.NodeID).Msg("worker quited")
|
||||
return nil
|
||||
}
|
||||
|
||||
type WorkerNode struct {
|
||||
ID string `json:"id"`
|
||||
State int32 `json:"state"`
|
||||
@@ -125,8 +29,14 @@ type WorkerNode struct {
|
||||
CPUUsage float64 `json:"cpu_usage"`
|
||||
CPUWarningEmitted bool `json:"cpu_warning_emitted"`
|
||||
MemoryUsage float64 `json:"memory_usage"`
|
||||
messenger messager.Message_BidirectionalStreamingMessageServer
|
||||
stream chan *messager.StreamResponse
|
||||
mutex sync.RWMutex
|
||||
disconnectedChan chan bool
|
||||
}
|
||||
|
||||
func newWorkerNode(id string) *WorkerNode {
|
||||
stream := make(chan *messager.StreamResponse, 100)
|
||||
return &WorkerNode{State: StateInit, ID: id, Heartbeat: 3, stream: stream, disconnectedChan: make(chan bool)}
|
||||
}
|
||||
|
||||
func (w *WorkerNode) getState() int32 {
|
||||
@@ -189,6 +99,18 @@ func (w *WorkerNode) getMemoryUsage() float64 {
|
||||
return w.MemoryUsage
|
||||
}
|
||||
|
||||
func (w *WorkerNode) setStream(stream chan *messager.StreamResponse) {
|
||||
w.mutex.RLock()
|
||||
defer w.mutex.RUnlock()
|
||||
w.stream = stream
|
||||
}
|
||||
|
||||
func (w *WorkerNode) getStream() chan *messager.StreamResponse {
|
||||
w.mutex.RLock()
|
||||
defer w.mutex.RUnlock()
|
||||
return w.stream
|
||||
}
|
||||
|
||||
func (w *WorkerNode) getWorkerInfo() WorkerNode {
|
||||
w.mutex.RLock()
|
||||
defer w.mutex.RUnlock()
|
||||
@@ -208,25 +130,95 @@ type grpcServer struct {
|
||||
masterHost string
|
||||
masterPort int
|
||||
server *grpc.Server
|
||||
secure bool
|
||||
clients *sync.Map
|
||||
|
||||
fromWorker chan *genericMessage
|
||||
toWorker chan *genericMessage
|
||||
disconnectedToWorker chan bool
|
||||
shutdownChan chan bool
|
||||
wg sync.WaitGroup
|
||||
fromWorker chan *genericMessage
|
||||
disconnectedChan chan bool
|
||||
shutdownChan chan bool
|
||||
wg *sync.WaitGroup
|
||||
}
|
||||
|
||||
var (
|
||||
errMissingMetadata = status.Errorf(codes.InvalidArgument, "missing metadata")
|
||||
errInvalidToken = status.Errorf(codes.Unauthenticated, "invalid token")
|
||||
)
|
||||
|
||||
func logger(format string, a ...interface{}) {
|
||||
log.Info().Msg(fmt.Sprintf(format, a...))
|
||||
}
|
||||
|
||||
// valid validates the authorization.
|
||||
func valid(authorization []string) bool {
|
||||
if len(authorization) < 1 {
|
||||
return false
|
||||
}
|
||||
token := strings.TrimPrefix(authorization[0], "Bearer ")
|
||||
return token == "httprunner-secret-token"
|
||||
}
|
||||
|
||||
func serverUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
|
||||
// authentication (token verification)
|
||||
md, ok := metadata.FromIncomingContext(ctx)
|
||||
if !ok {
|
||||
return nil, errMissingMetadata
|
||||
}
|
||||
if !valid(md["authorization"]) {
|
||||
return nil, errInvalidToken
|
||||
}
|
||||
m, err := handler(ctx, req)
|
||||
if err != nil {
|
||||
logger("RPC failed with error %v", err)
|
||||
}
|
||||
return m, err
|
||||
}
|
||||
|
||||
// serverWrappedStream wraps around the embedded grpc.ServerStream, and intercepts the RecvMsg and
|
||||
// SendMsg method call.
|
||||
type serverWrappedStream struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (w *serverWrappedStream) RecvMsg(m interface{}) error {
|
||||
logger("Receive a message (Type: %T) at %s", m, time.Now().Format(time.RFC3339))
|
||||
return w.ServerStream.RecvMsg(m)
|
||||
}
|
||||
|
||||
func (w *serverWrappedStream) SendMsg(m interface{}) error {
|
||||
logger("Send a message (Type: %T) at %v", m, time.Now().Format(time.RFC3339))
|
||||
return w.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func newServerWrappedStream(s grpc.ServerStream) grpc.ServerStream {
|
||||
return &serverWrappedStream{s}
|
||||
}
|
||||
|
||||
func serverStreamInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
|
||||
// authentication (token verification)
|
||||
md, ok := metadata.FromIncomingContext(ss.Context())
|
||||
if !ok {
|
||||
return errMissingMetadata
|
||||
}
|
||||
if !valid(md["authorization"]) {
|
||||
return errInvalidToken
|
||||
}
|
||||
|
||||
err := handler(srv, newServerWrappedStream(ss))
|
||||
if err != nil {
|
||||
logger("RPC failed with error %v", err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func newServer(masterHost string, masterPort int) (server *grpcServer) {
|
||||
log.Info().Msg("Boomer is built with grpc support.")
|
||||
server = &grpcServer{
|
||||
masterHost: masterHost,
|
||||
masterPort: masterPort,
|
||||
clients: &sync.Map{},
|
||||
fromWorker: make(chan *genericMessage, 100),
|
||||
toWorker: make(chan *genericMessage, 100),
|
||||
disconnectedToWorker: make(chan bool),
|
||||
shutdownChan: make(chan bool),
|
||||
masterHost: masterHost,
|
||||
masterPort: masterPort,
|
||||
clients: &sync.Map{},
|
||||
fromWorker: make(chan *genericMessage, 100),
|
||||
disconnectedChan: make(chan bool),
|
||||
shutdownChan: make(chan bool),
|
||||
}
|
||||
return server
|
||||
}
|
||||
@@ -250,25 +242,179 @@ func (s *grpcServer) start() (err error) {
|
||||
return
|
||||
}
|
||||
// create gRPC server
|
||||
serv := grpc.NewServer(opts...)
|
||||
s.server = grpc.NewServer(opts...)
|
||||
// register message server
|
||||
messager.RegisterMessageServer(serv, s)
|
||||
reflection.Register(serv)
|
||||
messager.RegisterMessageServer(s.server, s)
|
||||
reflection.Register(s.server)
|
||||
// start grpc server
|
||||
go func() {
|
||||
err = serv.Serve(lis)
|
||||
err = s.server.Serve(lis)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("failed to serve")
|
||||
return
|
||||
}
|
||||
}()
|
||||
|
||||
go s.recv()
|
||||
go s.send()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *grpcServer) Register(_ context.Context, req *messager.RegisterRequest) (*messager.RegisterResponse, error) {
|
||||
// store worker information
|
||||
wn := newWorkerNode(req.NodeID)
|
||||
s.clients.Store(req.NodeID, wn)
|
||||
log.Warn().Str("worker id", req.NodeID).Msg("worker joined")
|
||||
return &messager.RegisterResponse{Code: "0", Message: "register successfully"}, nil
|
||||
}
|
||||
|
||||
func (s *grpcServer) SignOut(_ context.Context, req *messager.SignOutRequest) (*messager.SignOutResponse, error) {
|
||||
// delete worker information
|
||||
s.clients.Delete(req.NodeID)
|
||||
log.Warn().Str("worker id", req.NodeID).Msg("worker quited")
|
||||
return &messager.SignOutResponse{Code: "0", Message: "sign out successfully"}, nil
|
||||
}
|
||||
|
||||
func (s *grpcServer) valid(token string) (isValid bool) {
|
||||
s.clients.Range(func(key, value interface{}) bool {
|
||||
if workerInfo, ok := value.(*WorkerNode); ok {
|
||||
if workerInfo.ID == token {
|
||||
isValid = true
|
||||
}
|
||||
}
|
||||
return true
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *grpcServer) BidirectionalStreamingMessage(srv messager.Message_BidirectionalStreamingMessageServer) error {
|
||||
token, ok := extractToken(srv.Context())
|
||||
if !ok {
|
||||
return status.Error(codes.Unauthenticated, "missing token header")
|
||||
}
|
||||
|
||||
ok = s.valid(token)
|
||||
if !ok {
|
||||
return status.Error(codes.Unauthenticated, "invalid token")
|
||||
}
|
||||
|
||||
go s.sendMsg(srv, token)
|
||||
FOR:
|
||||
for {
|
||||
msg, err := srv.Recv()
|
||||
if st, ok := status.FromError(err); ok {
|
||||
switch st.Code() {
|
||||
case codes.OK:
|
||||
s.fromWorker <- newGenericMessage(msg.Type, msg.Data, msg.NodeID)
|
||||
log.Info().
|
||||
Str("nodeID", msg.NodeID).
|
||||
Str("type", msg.Type).
|
||||
Interface("data", msg.Data).
|
||||
Msg("receive data from worker")
|
||||
case codes.Unavailable, codes.Canceled, codes.DeadlineExceeded:
|
||||
s.fromWorker <- newQuitMessage(token)
|
||||
break FOR
|
||||
default:
|
||||
log.Error().Err(err).Msg("failed to get stream from client")
|
||||
break FOR
|
||||
}
|
||||
}
|
||||
}
|
||||
// disconnected to worker
|
||||
select {
|
||||
case <-srv.Context().Done():
|
||||
return srv.Context().Err()
|
||||
case <-s.disconnectedChan:
|
||||
}
|
||||
log.Warn().Str("worker id", token).Msg("worker quited")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *grpcServer) sendMsg(srv messager.Message_BidirectionalStreamingMessageServer, id string) {
|
||||
stream := s.getWorkersByID(id).getStream()
|
||||
for {
|
||||
select {
|
||||
case <-srv.Context().Done():
|
||||
return
|
||||
case res := <-stream:
|
||||
if s, ok := status.FromError(srv.Send(res)); ok {
|
||||
switch s.Code() {
|
||||
case codes.OK:
|
||||
log.Info().
|
||||
Str("nodeID", res.NodeID).
|
||||
Str("type", res.Type).
|
||||
Interface("data", res.Data).
|
||||
Interface("profile", res.Profile).
|
||||
Msg("send data to worker")
|
||||
case codes.Unavailable, codes.Canceled, codes.DeadlineExceeded:
|
||||
log.Warn().Msg(fmt.Sprintf("client (%s) terminated connection", id))
|
||||
return
|
||||
default:
|
||||
log.Warn().Msg(fmt.Sprintf("failed to send to client (%s): %v", id, s.Err()))
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *grpcServer) sendBroadcasts(msg *genericMessage) {
|
||||
s.clients.Range(func(key, value interface{}) bool {
|
||||
if workerInfo, ok := value.(*WorkerNode); ok {
|
||||
if workerInfo.getState() == StateQuitting || workerInfo.getState() == StateMissing {
|
||||
return true
|
||||
}
|
||||
workerInfo.getStream() <- &messager.StreamResponse{
|
||||
Type: msg.Type,
|
||||
Profile: msg.Profile,
|
||||
Data: msg.Data,
|
||||
NodeID: workerInfo.ID,
|
||||
Tasks: msg.Tasks,
|
||||
}
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
func (s *grpcServer) stopServer(ctx context.Context) {
|
||||
ch := make(chan struct{})
|
||||
go func() {
|
||||
defer close(ch)
|
||||
// close listeners to stop accepting new connections,
|
||||
// will block on any existing transports
|
||||
s.server.GracefulStop()
|
||||
}()
|
||||
|
||||
// wait until all pending RPCs are finished
|
||||
select {
|
||||
case <-ch:
|
||||
case <-ctx.Done():
|
||||
// took too long, manually close open transports
|
||||
// e.g. watch streams
|
||||
s.server.Stop()
|
||||
|
||||
// concurrent GracefulStop should be interrupted
|
||||
<-ch
|
||||
}
|
||||
}
|
||||
|
||||
func (s *grpcServer) close() {
|
||||
// close client requests with request timeout
|
||||
timeout := 2 * time.Second
|
||||
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
||||
s.stopServer(ctx)
|
||||
cancel()
|
||||
}
|
||||
|
||||
func (s *grpcServer) recvChannel() chan *genericMessage {
|
||||
return s.fromWorker
|
||||
}
|
||||
|
||||
func (s *grpcServer) shutdownChannel() chan bool {
|
||||
return s.shutdownChan
|
||||
}
|
||||
|
||||
func (s *grpcServer) disconnectedChannel() chan bool {
|
||||
return s.disconnectedChan
|
||||
}
|
||||
|
||||
func (s *grpcServer) getWorkersByState(state int32) (wns []*WorkerNode) {
|
||||
s.clients.Range(func(key, value interface{}) bool {
|
||||
if workerInfo, ok := value.(*WorkerNode); ok {
|
||||
@@ -281,6 +427,18 @@ func (s *grpcServer) getWorkersByState(state int32) (wns []*WorkerNode) {
|
||||
return wns
|
||||
}
|
||||
|
||||
func (s *grpcServer) getWorkersByID(id string) (wn *WorkerNode) {
|
||||
s.clients.Range(func(key, value interface{}) bool {
|
||||
if workerInfo, ok := value.(*WorkerNode); ok {
|
||||
if workerInfo.ID == id {
|
||||
wn = workerInfo
|
||||
}
|
||||
}
|
||||
return true
|
||||
})
|
||||
return wn
|
||||
}
|
||||
|
||||
func (s *grpcServer) getWorkersLengthByState(state int32) (l int) {
|
||||
s.clients.Range(func(key, value interface{}) bool {
|
||||
if workerInfo, ok := value.(*WorkerNode); ok {
|
||||
@@ -318,113 +476,3 @@ func (s *grpcServer) getClientsLength() (l int) {
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *grpcServer) close() {
|
||||
close(s.shutdownChan)
|
||||
}
|
||||
|
||||
func (s *grpcServer) recvChannel() chan *genericMessage {
|
||||
return s.fromWorker
|
||||
}
|
||||
|
||||
func (s *grpcServer) shutdownChannel() chan bool {
|
||||
return s.shutdownChan
|
||||
}
|
||||
|
||||
func (s *grpcServer) recv() {
|
||||
for {
|
||||
select {
|
||||
case <-s.shutdownChan:
|
||||
return
|
||||
default:
|
||||
s.clients.Range(func(key, value interface{}) bool {
|
||||
if workerInfo, ok := value.(*WorkerNode); ok {
|
||||
if workerInfo.getState() == StateQuitting || workerInfo.getState() == StateMissing {
|
||||
return true
|
||||
}
|
||||
msg, err := workerInfo.messenger.Recv()
|
||||
switch err {
|
||||
case nil:
|
||||
if msg == nil {
|
||||
return true
|
||||
}
|
||||
s.fromWorker <- newGenericMessage(msg.Type, msg.Data, msg.NodeID)
|
||||
log.Info().
|
||||
Str("nodeID", msg.NodeID).
|
||||
Str("type", msg.Type).
|
||||
Interface("data", msg.Data).
|
||||
Msg("receive data from worker")
|
||||
case io.EOF:
|
||||
s.fromWorker <- newQuitMessage(workerInfo.ID)
|
||||
default:
|
||||
if err.Error() == status.Error(codes.Canceled, context.Canceled.Error()).Error() {
|
||||
s.fromWorker <- newQuitMessage(workerInfo.ID)
|
||||
return true
|
||||
}
|
||||
log.Error().Err(err).Msg("failed to get stream from client")
|
||||
}
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *grpcServer) sendChannel() chan *genericMessage {
|
||||
return s.toWorker
|
||||
}
|
||||
|
||||
func (s *grpcServer) send() {
|
||||
for {
|
||||
select {
|
||||
case <-s.shutdownChan:
|
||||
return
|
||||
case msg := <-s.toWorker:
|
||||
s.sendMessage(msg)
|
||||
|
||||
// We may send genericMessage to Worker.
|
||||
if msg.Type == "quit" {
|
||||
close(s.disconnectedToWorker)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *grpcServer) sendMessage(msg *genericMessage) {
|
||||
s.clients.Range(func(key, value interface{}) bool {
|
||||
if workerInfo, ok := value.(*WorkerNode); ok {
|
||||
if workerInfo.getState() == StateQuitting || workerInfo.getState() == StateMissing {
|
||||
return true
|
||||
}
|
||||
err := workerInfo.messenger.Send(
|
||||
&messager.StreamResponse{
|
||||
Type: msg.Type,
|
||||
Profile: msg.Profile,
|
||||
Data: msg.Data,
|
||||
NodeID: workerInfo.ID,
|
||||
Tasks: msg.Tasks},
|
||||
)
|
||||
switch err {
|
||||
case nil:
|
||||
break
|
||||
case io.EOF:
|
||||
fallthrough
|
||||
default:
|
||||
s.fromWorker <- newQuitMessage(workerInfo.ID)
|
||||
log.Error().Err(err).Msg("failed to send message")
|
||||
return true
|
||||
}
|
||||
log.Info().
|
||||
Str("nodeID", workerInfo.ID).
|
||||
Str("type", msg.Type).
|
||||
Interface("data", msg.Data).
|
||||
Int32("state", workerInfo.getState()).
|
||||
Msg("send data to worker")
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
func (s *grpcServer) disconnectedChannel() chan bool {
|
||||
return s.disconnectedToWorker
|
||||
}
|
||||
|
||||
@@ -94,12 +94,12 @@ func GetCurrentCPUUsage() float64 {
|
||||
currentPid := os.Getpid()
|
||||
p, err := process.NewProcess(int32(currentPid))
|
||||
if err != nil {
|
||||
log.Printf("Fail to get CPU percent, %v\n", err)
|
||||
log.Error().Err(err).Msg(fmt.Sprintf("failed to get CPU percent\n"))
|
||||
return 0.0
|
||||
}
|
||||
percent, err := p.CPUPercent()
|
||||
if err != nil {
|
||||
log.Printf("Fail to get CPU percent, %v\n", err)
|
||||
log.Error().Err(err).Msg(fmt.Sprintf("failed to get CPU percent\n"))
|
||||
return 0.0
|
||||
}
|
||||
return percent / float64(runtime.NumCPU())
|
||||
|
||||
Reference in New Issue
Block a user