vendor: update all dependencies
This commit is contained in:
+172
@@ -0,0 +1,172 @@
|
||||
// Copyright 2017 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// 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 loadtest
|
||||
|
||||
// Performance benchmarks for pubsub.
|
||||
// Run with
|
||||
// go test -bench . -cpu 1
|
||||
|
||||
import (
|
||||
"log"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/api/option"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"cloud.google.com/go/internal/testutil"
|
||||
"cloud.google.com/go/pubsub"
|
||||
"google.golang.org/api/transport"
|
||||
pb "google.golang.org/genproto/googleapis/pubsub/v1"
|
||||
)
|
||||
|
||||
// These constants are designed to match the "throughput" test in
|
||||
// https://github.com/GoogleCloudPlatform/pubsub/blob/master/load-test-framework/run.py
|
||||
// and
|
||||
// https://github.com/GoogleCloudPlatform/pubsub/blob/master/load-test-framework/src/main/java/com/google/pubsub/clients/experimental/CPSPublisherTask.java
|
||||
|
||||
const (
|
||||
nMessages = 1e5
|
||||
messageSize = 10000 // size of msg data in bytes
|
||||
batchSize = 10
|
||||
batchDuration = 50 * time.Millisecond
|
||||
serverDelay = 200 * time.Millisecond
|
||||
maxOutstandingPublishes = 1600 // max_outstanding_messages in run.py
|
||||
)
|
||||
|
||||
func BenchmarkPublishThroughput(b *testing.B) {
|
||||
b.SetBytes(nMessages * messageSize)
|
||||
client := perfClient(serverDelay, 1, b)
|
||||
|
||||
lts := &PubServer{ID: "xxx"}
|
||||
lts.init(client, "t", messageSize, batchSize, batchDuration)
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
runOnce(lts)
|
||||
}
|
||||
}
|
||||
|
||||
func runOnce(lts *PubServer) {
|
||||
nRequests := int64(nMessages / batchSize)
|
||||
var nPublished int64
|
||||
var wg sync.WaitGroup
|
||||
// The Java loadtest framework is rate-limited to 1 billion Execute calls a
|
||||
// second (each Execute call corresponding to a publishBatch call here),
|
||||
// but we can ignore this because of the following.
|
||||
// The framework runs 10,000 threads, each calling Execute in a loop, but
|
||||
// we can ignore this too.
|
||||
// The framework caps the number of outstanding calls to Execute at
|
||||
// maxOutstandingPublishes. That is what we simulate here.
|
||||
for i := 0; i < maxOutstandingPublishes; i++ {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for atomic.AddInt64(&nRequests, -1) >= 0 {
|
||||
latencies, err := lts.publishBatch()
|
||||
if err != nil {
|
||||
log.Fatalf("publishBatch: %v", err)
|
||||
}
|
||||
atomic.AddInt64(&nPublished, int64(len(latencies)))
|
||||
}
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
sent := atomic.LoadInt64(&nPublished)
|
||||
if sent != nMessages {
|
||||
log.Fatalf("sent %d messages, expected %d", sent, int(nMessages))
|
||||
}
|
||||
}
|
||||
|
||||
func perfClient(pubDelay time.Duration, nConns int, f interface {
|
||||
Fatal(...interface{})
|
||||
}) *pubsub.Client {
|
||||
ctx := context.Background()
|
||||
srv, err := newPerfServer(pubDelay)
|
||||
if err != nil {
|
||||
f.Fatal(err)
|
||||
}
|
||||
conn, err := transport.DialGRPCInsecure(ctx,
|
||||
option.WithEndpoint(srv.Addr),
|
||||
option.WithGRPCConnectionPool(nConns))
|
||||
if err != nil {
|
||||
f.Fatal(err)
|
||||
}
|
||||
client, err := pubsub.NewClient(ctx, "projectID", option.WithGRPCConn(conn))
|
||||
if err != nil {
|
||||
f.Fatal(err)
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
type perfServer struct {
|
||||
pb.PublisherServer
|
||||
pb.SubscriberServer
|
||||
|
||||
Addr string
|
||||
pubDelay time.Duration
|
||||
|
||||
mu sync.Mutex
|
||||
activePubs int
|
||||
maxActivePubs int
|
||||
}
|
||||
|
||||
func newPerfServer(pubDelay time.Duration) (*perfServer, error) {
|
||||
srv, err := testutil.NewServer(grpc.MaxMsgSize(pubsub.MaxPublishRequestBytes))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
perf := &perfServer{Addr: srv.Addr, pubDelay: pubDelay}
|
||||
pb.RegisterPublisherServer(srv.Gsrv, perf)
|
||||
pb.RegisterSubscriberServer(srv.Gsrv, perf)
|
||||
srv.Start()
|
||||
return perf, nil
|
||||
}
|
||||
|
||||
var doLog = false
|
||||
|
||||
func (p *perfServer) incActivePubs(n int) (int, bool) {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
p.activePubs += n
|
||||
newMax := false
|
||||
if p.activePubs > p.maxActivePubs {
|
||||
p.maxActivePubs = p.activePubs
|
||||
newMax = true
|
||||
}
|
||||
return p.activePubs, newMax
|
||||
}
|
||||
|
||||
func (p *perfServer) Publish(ctx context.Context, req *pb.PublishRequest) (*pb.PublishResponse, error) {
|
||||
a, newMax := p.incActivePubs(1)
|
||||
defer p.incActivePubs(-1)
|
||||
if newMax && doLog {
|
||||
log.Printf("max %d active publish calls", a)
|
||||
}
|
||||
if doLog {
|
||||
log.Printf("%p -> Publish %d", p, len(req.Messages))
|
||||
}
|
||||
res := &pb.PublishResponse{MessageIds: make([]string, len(req.Messages))}
|
||||
for i := range res.MessageIds {
|
||||
res.MessageIds[i] = "x"
|
||||
}
|
||||
time.Sleep(p.pubDelay)
|
||||
if doLog {
|
||||
log.Printf("%p <- Publish %d", p, len(req.Messages))
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
// Copyright 2017 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// 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 main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"strconv"
|
||||
|
||||
"math/rand"
|
||||
|
||||
"cloud.google.com/go/pubsub/loadtest"
|
||||
pb "cloud.google.com/go/pubsub/loadtest/pb"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func main() {
|
||||
port := flag.Uint("worker_port", 6000, "port to bind worker to")
|
||||
role := flag.String("r", "", "role: pub/sub")
|
||||
flag.Parse()
|
||||
|
||||
var lts pb.LoadtestWorkerServer
|
||||
switch *role {
|
||||
case "pub":
|
||||
lts = &loadtest.PubServer{ID: strconv.Itoa(rand.Int())}
|
||||
case "sub":
|
||||
lts = &loadtest.SubServer{}
|
||||
default:
|
||||
log.Fatalf("unknown role: %q", *role)
|
||||
}
|
||||
|
||||
serv := grpc.NewServer()
|
||||
pb.RegisterLoadtestWorkerServer(serv, lts)
|
||||
|
||||
lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port))
|
||||
if err != nil {
|
||||
log.Fatalf("failed to listen: %v", err)
|
||||
}
|
||||
serv.Serve(lis)
|
||||
}
|
||||
+213
@@ -0,0 +1,213 @@
|
||||
// Copyright 2017 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// 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 loadtest implements load testing for pubsub,
|
||||
// following the interface defined in https://github.com/GoogleCloudPlatform/pubsub/tree/master/load-test-framework/ .
|
||||
//
|
||||
// This package is experimental.
|
||||
package loadtest
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/time/rate"
|
||||
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
|
||||
"cloud.google.com/go/pubsub"
|
||||
pb "cloud.google.com/go/pubsub/loadtest/pb"
|
||||
)
|
||||
|
||||
type pubServerConfig struct {
|
||||
topic *pubsub.Topic
|
||||
msgData []byte
|
||||
batchSize int32
|
||||
}
|
||||
|
||||
type PubServer struct {
|
||||
ID string
|
||||
|
||||
cfg atomic.Value
|
||||
seqNum int32
|
||||
}
|
||||
|
||||
func (l *PubServer) Start(ctx context.Context, req *pb.StartRequest) (*pb.StartResponse, error) {
|
||||
log.Println("received start")
|
||||
c, err := pubsub.NewClient(ctx, req.Project)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dur, err := ptypes.Duration(req.PublishBatchDuration)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
l.init(c, req.Topic, req.MessageSize, req.PublishBatchSize, dur)
|
||||
log.Println("started")
|
||||
return &pb.StartResponse{}, nil
|
||||
}
|
||||
|
||||
func (l *PubServer) init(c *pubsub.Client, topicName string, msgSize, batchSize int32, batchDur time.Duration) {
|
||||
topic := c.Topic(topicName)
|
||||
topic.PublishSettings = pubsub.PublishSettings{
|
||||
DelayThreshold: batchDur,
|
||||
CountThreshold: 950,
|
||||
ByteThreshold: 9500000,
|
||||
}
|
||||
|
||||
l.cfg.Store(pubServerConfig{
|
||||
topic: topic,
|
||||
msgData: bytes.Repeat([]byte{'A'}, int(msgSize)),
|
||||
batchSize: batchSize,
|
||||
})
|
||||
}
|
||||
|
||||
func (l *PubServer) Execute(ctx context.Context, _ *pb.ExecuteRequest) (*pb.ExecuteResponse, error) {
|
||||
latencies, err := l.publishBatch()
|
||||
if err != nil {
|
||||
log.Printf("error: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
return &pb.ExecuteResponse{Latencies: latencies}, nil
|
||||
}
|
||||
|
||||
func (l *PubServer) publishBatch() ([]int64, error) {
|
||||
var cfg pubServerConfig
|
||||
if c, ok := l.cfg.Load().(pubServerConfig); ok {
|
||||
cfg = c
|
||||
} else {
|
||||
return nil, errors.New("config not loaded")
|
||||
}
|
||||
|
||||
start := time.Now()
|
||||
latencies := make([]int64, cfg.batchSize)
|
||||
startStr := strconv.FormatInt(start.UnixNano()/1e6, 10)
|
||||
seqNum := atomic.AddInt32(&l.seqNum, cfg.batchSize) - cfg.batchSize
|
||||
|
||||
rs := make([]*pubsub.PublishResult, cfg.batchSize)
|
||||
for i := int32(0); i < cfg.batchSize; i++ {
|
||||
rs[i] = cfg.topic.Publish(context.TODO(), &pubsub.Message{
|
||||
Data: cfg.msgData,
|
||||
Attributes: map[string]string{
|
||||
"sendTime": startStr,
|
||||
"clientId": l.ID,
|
||||
"sequenceNumber": strconv.Itoa(int(seqNum + i)),
|
||||
},
|
||||
})
|
||||
}
|
||||
for i, r := range rs {
|
||||
_, err := r.Get(context.Background())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// TODO(jba,pongad): fix latencies
|
||||
// Later values will be skewed by earlier ones, since we wait for the
|
||||
// results in order. (On the other hand, it may not matter much, since
|
||||
// messages are added to bundles in order and bundles get sent more or
|
||||
// less in order.) If we want more accurate values, we can either start
|
||||
// a goroutine for each result (similar to the original code using a
|
||||
// callback), or call reflect.Select with the Ready channels of the
|
||||
// results.
|
||||
latencies[i] = time.Since(start).Nanoseconds() / 1e6
|
||||
}
|
||||
return latencies, nil
|
||||
}
|
||||
|
||||
type SubServer struct {
|
||||
lim *rate.Limiter
|
||||
|
||||
mu sync.Mutex
|
||||
idents []*pb.MessageIdentifier
|
||||
latencies []int64
|
||||
}
|
||||
|
||||
func (s *SubServer) Start(ctx context.Context, req *pb.StartRequest) (*pb.StartResponse, error) {
|
||||
log.Println("received start")
|
||||
s.lim = rate.NewLimiter(rate.Every(time.Second), 1)
|
||||
|
||||
c, err := pubsub.NewClient(ctx, req.Project)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Load test API doesn't define any way to stop right now.
|
||||
go func() {
|
||||
sub := c.Subscription(req.GetPubsubOptions().Subscription)
|
||||
err := sub.Receive(context.Background(), s.callback)
|
||||
log.Fatal(err)
|
||||
}()
|
||||
|
||||
log.Println("started")
|
||||
return &pb.StartResponse{}, nil
|
||||
}
|
||||
|
||||
func (s *SubServer) callback(_ context.Context, m *pubsub.Message) {
|
||||
id, err := strconv.ParseInt(m.Attributes["clientId"], 10, 64)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
m.Nack()
|
||||
return
|
||||
}
|
||||
|
||||
seqNum, err := strconv.ParseInt(m.Attributes["sequenceNumber"], 10, 32)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
m.Nack()
|
||||
return
|
||||
}
|
||||
|
||||
sendTimeMillis, err := strconv.ParseInt(m.Attributes["sendTime"], 10, 64)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
m.Nack()
|
||||
return
|
||||
}
|
||||
|
||||
latency := time.Now().UnixNano()/1e6 - sendTimeMillis
|
||||
ident := &pb.MessageIdentifier{
|
||||
PublisherClientId: id,
|
||||
SequenceNumber: int32(seqNum),
|
||||
}
|
||||
|
||||
s.mu.Lock()
|
||||
s.idents = append(s.idents, ident)
|
||||
s.latencies = append(s.latencies, latency)
|
||||
s.mu.Unlock()
|
||||
m.Ack()
|
||||
}
|
||||
|
||||
func (s *SubServer) Execute(ctx context.Context, _ *pb.ExecuteRequest) (*pb.ExecuteResponse, error) {
|
||||
// Throttle so the load tester doesn't spam us and consume all our CPU.
|
||||
if err := s.lim.Wait(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
s.mu.Lock()
|
||||
idents := s.idents
|
||||
s.idents = nil
|
||||
latencies := s.latencies
|
||||
s.latencies = nil
|
||||
s.mu.Unlock()
|
||||
|
||||
return &pb.ExecuteResponse{
|
||||
Latencies: latencies,
|
||||
ReceivedMessages: idents,
|
||||
}, nil
|
||||
}
|
||||
+792
@@ -0,0 +1,792 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: loadtest.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package google_pubsub_loadtest is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
loadtest.proto
|
||||
|
||||
It has these top-level messages:
|
||||
StartRequest
|
||||
StartResponse
|
||||
PubsubOptions
|
||||
KafkaOptions
|
||||
MessageIdentifier
|
||||
CheckRequest
|
||||
CheckResponse
|
||||
ExecuteRequest
|
||||
ExecuteResponse
|
||||
*/
|
||||
package google_pubsub_loadtest
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import google_protobuf "github.com/golang/protobuf/ptypes/duration"
|
||||
import google_protobuf1 "github.com/golang/protobuf/ptypes/timestamp"
|
||||
|
||||
import (
|
||||
context "golang.org/x/net/context"
|
||||
grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type StartRequest struct {
|
||||
// The GCP project. This must be set even for Kafka, as we use it to export metrics.
|
||||
Project string `protobuf:"bytes,1,opt,name=project" json:"project,omitempty"`
|
||||
// The Pub/Sub or Kafka topic name.
|
||||
Topic string `protobuf:"bytes,2,opt,name=topic" json:"topic,omitempty"`
|
||||
// The number of requests that can be made, each second, per client.
|
||||
RequestRate int32 `protobuf:"varint,3,opt,name=request_rate,json=requestRate" json:"request_rate,omitempty"`
|
||||
// The size of each user message to publish
|
||||
MessageSize int32 `protobuf:"varint,4,opt,name=message_size,json=messageSize" json:"message_size,omitempty"`
|
||||
// The maximum outstanding requests, per client.
|
||||
MaxOutstandingRequests int32 `protobuf:"varint,5,opt,name=max_outstanding_requests,json=maxOutstandingRequests" json:"max_outstanding_requests,omitempty"`
|
||||
// The time at which the load test should start. If this is less than the current time, we start immediately.
|
||||
StartTime *google_protobuf1.Timestamp `protobuf:"bytes,6,opt,name=start_time,json=startTime" json:"start_time,omitempty"`
|
||||
// The burn-in duration, before which results should not be reported.
|
||||
BurnInDuration *google_protobuf.Duration `protobuf:"bytes,12,opt,name=burn_in_duration,json=burnInDuration" json:"burn_in_duration,omitempty"`
|
||||
// The number of user messages of size message_size to publish together.
|
||||
PublishBatchSize int32 `protobuf:"varint,11,opt,name=publish_batch_size,json=publishBatchSize" json:"publish_batch_size,omitempty"`
|
||||
// The max duration for coalescing a batch of published messages.
|
||||
PublishBatchDuration *google_protobuf.Duration `protobuf:"bytes,13,opt,name=publish_batch_duration,json=publishBatchDuration" json:"publish_batch_duration,omitempty"`
|
||||
// Types that are valid to be assigned to StopConditions:
|
||||
// *StartRequest_TestDuration
|
||||
// *StartRequest_NumberOfMessages
|
||||
StopConditions isStartRequest_StopConditions `protobuf_oneof:"stop_conditions"`
|
||||
// Types that are valid to be assigned to Options:
|
||||
// *StartRequest_PubsubOptions
|
||||
// *StartRequest_KafkaOptions
|
||||
Options isStartRequest_Options `protobuf_oneof:"options"`
|
||||
}
|
||||
|
||||
func (m *StartRequest) Reset() { *m = StartRequest{} }
|
||||
func (m *StartRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*StartRequest) ProtoMessage() {}
|
||||
func (*StartRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
type isStartRequest_StopConditions interface {
|
||||
isStartRequest_StopConditions()
|
||||
}
|
||||
type isStartRequest_Options interface {
|
||||
isStartRequest_Options()
|
||||
}
|
||||
|
||||
type StartRequest_TestDuration struct {
|
||||
TestDuration *google_protobuf.Duration `protobuf:"bytes,7,opt,name=test_duration,json=testDuration,oneof"`
|
||||
}
|
||||
type StartRequest_NumberOfMessages struct {
|
||||
NumberOfMessages int32 `protobuf:"varint,8,opt,name=number_of_messages,json=numberOfMessages,oneof"`
|
||||
}
|
||||
type StartRequest_PubsubOptions struct {
|
||||
PubsubOptions *PubsubOptions `protobuf:"bytes,9,opt,name=pubsub_options,json=pubsubOptions,oneof"`
|
||||
}
|
||||
type StartRequest_KafkaOptions struct {
|
||||
KafkaOptions *KafkaOptions `protobuf:"bytes,10,opt,name=kafka_options,json=kafkaOptions,oneof"`
|
||||
}
|
||||
|
||||
func (*StartRequest_TestDuration) isStartRequest_StopConditions() {}
|
||||
func (*StartRequest_NumberOfMessages) isStartRequest_StopConditions() {}
|
||||
func (*StartRequest_PubsubOptions) isStartRequest_Options() {}
|
||||
func (*StartRequest_KafkaOptions) isStartRequest_Options() {}
|
||||
|
||||
func (m *StartRequest) GetStopConditions() isStartRequest_StopConditions {
|
||||
if m != nil {
|
||||
return m.StopConditions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *StartRequest) GetOptions() isStartRequest_Options {
|
||||
if m != nil {
|
||||
return m.Options
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *StartRequest) GetProject() string {
|
||||
if m != nil {
|
||||
return m.Project
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *StartRequest) GetTopic() string {
|
||||
if m != nil {
|
||||
return m.Topic
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *StartRequest) GetRequestRate() int32 {
|
||||
if m != nil {
|
||||
return m.RequestRate
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *StartRequest) GetMessageSize() int32 {
|
||||
if m != nil {
|
||||
return m.MessageSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *StartRequest) GetMaxOutstandingRequests() int32 {
|
||||
if m != nil {
|
||||
return m.MaxOutstandingRequests
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *StartRequest) GetStartTime() *google_protobuf1.Timestamp {
|
||||
if m != nil {
|
||||
return m.StartTime
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *StartRequest) GetBurnInDuration() *google_protobuf.Duration {
|
||||
if m != nil {
|
||||
return m.BurnInDuration
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *StartRequest) GetPublishBatchSize() int32 {
|
||||
if m != nil {
|
||||
return m.PublishBatchSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *StartRequest) GetPublishBatchDuration() *google_protobuf.Duration {
|
||||
if m != nil {
|
||||
return m.PublishBatchDuration
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *StartRequest) GetTestDuration() *google_protobuf.Duration {
|
||||
if x, ok := m.GetStopConditions().(*StartRequest_TestDuration); ok {
|
||||
return x.TestDuration
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *StartRequest) GetNumberOfMessages() int32 {
|
||||
if x, ok := m.GetStopConditions().(*StartRequest_NumberOfMessages); ok {
|
||||
return x.NumberOfMessages
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *StartRequest) GetPubsubOptions() *PubsubOptions {
|
||||
if x, ok := m.GetOptions().(*StartRequest_PubsubOptions); ok {
|
||||
return x.PubsubOptions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *StartRequest) GetKafkaOptions() *KafkaOptions {
|
||||
if x, ok := m.GetOptions().(*StartRequest_KafkaOptions); ok {
|
||||
return x.KafkaOptions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*StartRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
|
||||
return _StartRequest_OneofMarshaler, _StartRequest_OneofUnmarshaler, _StartRequest_OneofSizer, []interface{}{
|
||||
(*StartRequest_TestDuration)(nil),
|
||||
(*StartRequest_NumberOfMessages)(nil),
|
||||
(*StartRequest_PubsubOptions)(nil),
|
||||
(*StartRequest_KafkaOptions)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _StartRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*StartRequest)
|
||||
// stop_conditions
|
||||
switch x := m.StopConditions.(type) {
|
||||
case *StartRequest_TestDuration:
|
||||
b.EncodeVarint(7<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.TestDuration); err != nil {
|
||||
return err
|
||||
}
|
||||
case *StartRequest_NumberOfMessages:
|
||||
b.EncodeVarint(8<<3 | proto.WireVarint)
|
||||
b.EncodeVarint(uint64(x.NumberOfMessages))
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("StartRequest.StopConditions has unexpected type %T", x)
|
||||
}
|
||||
// options
|
||||
switch x := m.Options.(type) {
|
||||
case *StartRequest_PubsubOptions:
|
||||
b.EncodeVarint(9<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.PubsubOptions); err != nil {
|
||||
return err
|
||||
}
|
||||
case *StartRequest_KafkaOptions:
|
||||
b.EncodeVarint(10<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.KafkaOptions); err != nil {
|
||||
return err
|
||||
}
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("StartRequest.Options has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _StartRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*StartRequest)
|
||||
switch tag {
|
||||
case 7: // stop_conditions.test_duration
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(google_protobuf.Duration)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.StopConditions = &StartRequest_TestDuration{msg}
|
||||
return true, err
|
||||
case 8: // stop_conditions.number_of_messages
|
||||
if wire != proto.WireVarint {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeVarint()
|
||||
m.StopConditions = &StartRequest_NumberOfMessages{int32(x)}
|
||||
return true, err
|
||||
case 9: // options.pubsub_options
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(PubsubOptions)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Options = &StartRequest_PubsubOptions{msg}
|
||||
return true, err
|
||||
case 10: // options.kafka_options
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(KafkaOptions)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Options = &StartRequest_KafkaOptions{msg}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _StartRequest_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*StartRequest)
|
||||
// stop_conditions
|
||||
switch x := m.StopConditions.(type) {
|
||||
case *StartRequest_TestDuration:
|
||||
s := proto.Size(x.TestDuration)
|
||||
n += proto.SizeVarint(7<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *StartRequest_NumberOfMessages:
|
||||
n += proto.SizeVarint(8<<3 | proto.WireVarint)
|
||||
n += proto.SizeVarint(uint64(x.NumberOfMessages))
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
// options
|
||||
switch x := m.Options.(type) {
|
||||
case *StartRequest_PubsubOptions:
|
||||
s := proto.Size(x.PubsubOptions)
|
||||
n += proto.SizeVarint(9<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *StartRequest_KafkaOptions:
|
||||
s := proto.Size(x.KafkaOptions)
|
||||
n += proto.SizeVarint(10<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
type StartResponse struct {
|
||||
}
|
||||
|
||||
func (m *StartResponse) Reset() { *m = StartResponse{} }
|
||||
func (m *StartResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*StartResponse) ProtoMessage() {}
|
||||
func (*StartResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
type PubsubOptions struct {
|
||||
// The Cloud Pub/Sub subscription name
|
||||
Subscription string `protobuf:"bytes,1,opt,name=subscription" json:"subscription,omitempty"`
|
||||
// The maximum number of messages to pull which each request.
|
||||
MaxMessagesPerPull int32 `protobuf:"varint,2,opt,name=max_messages_per_pull,json=maxMessagesPerPull" json:"max_messages_per_pull,omitempty"`
|
||||
}
|
||||
|
||||
func (m *PubsubOptions) Reset() { *m = PubsubOptions{} }
|
||||
func (m *PubsubOptions) String() string { return proto.CompactTextString(m) }
|
||||
func (*PubsubOptions) ProtoMessage() {}
|
||||
func (*PubsubOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
||||
|
||||
func (m *PubsubOptions) GetSubscription() string {
|
||||
if m != nil {
|
||||
return m.Subscription
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *PubsubOptions) GetMaxMessagesPerPull() int32 {
|
||||
if m != nil {
|
||||
return m.MaxMessagesPerPull
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type KafkaOptions struct {
|
||||
// The network address of the Kafka broker.
|
||||
Broker string `protobuf:"bytes,1,opt,name=broker" json:"broker,omitempty"`
|
||||
// The length of time to poll for.
|
||||
PollDuration *google_protobuf.Duration `protobuf:"bytes,2,opt,name=poll_duration,json=pollDuration" json:"poll_duration,omitempty"`
|
||||
}
|
||||
|
||||
func (m *KafkaOptions) Reset() { *m = KafkaOptions{} }
|
||||
func (m *KafkaOptions) String() string { return proto.CompactTextString(m) }
|
||||
func (*KafkaOptions) ProtoMessage() {}
|
||||
func (*KafkaOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
|
||||
|
||||
func (m *KafkaOptions) GetBroker() string {
|
||||
if m != nil {
|
||||
return m.Broker
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *KafkaOptions) GetPollDuration() *google_protobuf.Duration {
|
||||
if m != nil {
|
||||
return m.PollDuration
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type MessageIdentifier struct {
|
||||
// The unique id of the client that published the message.
|
||||
PublisherClientId int64 `protobuf:"varint,1,opt,name=publisher_client_id,json=publisherClientId" json:"publisher_client_id,omitempty"`
|
||||
// Sequence number of the published message with the given publish_client_id.
|
||||
SequenceNumber int32 `protobuf:"varint,2,opt,name=sequence_number,json=sequenceNumber" json:"sequence_number,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MessageIdentifier) Reset() { *m = MessageIdentifier{} }
|
||||
func (m *MessageIdentifier) String() string { return proto.CompactTextString(m) }
|
||||
func (*MessageIdentifier) ProtoMessage() {}
|
||||
func (*MessageIdentifier) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
|
||||
|
||||
func (m *MessageIdentifier) GetPublisherClientId() int64 {
|
||||
if m != nil {
|
||||
return m.PublisherClientId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *MessageIdentifier) GetSequenceNumber() int32 {
|
||||
if m != nil {
|
||||
return m.SequenceNumber
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type CheckRequest struct {
|
||||
// Duplicate messages that should not be reported for throughput and latency.
|
||||
Duplicates []*MessageIdentifier `protobuf:"bytes,1,rep,name=duplicates" json:"duplicates,omitempty"`
|
||||
}
|
||||
|
||||
func (m *CheckRequest) Reset() { *m = CheckRequest{} }
|
||||
func (m *CheckRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*CheckRequest) ProtoMessage() {}
|
||||
func (*CheckRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
|
||||
|
||||
func (m *CheckRequest) GetDuplicates() []*MessageIdentifier {
|
||||
if m != nil {
|
||||
return m.Duplicates
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type CheckResponse struct {
|
||||
// Histogram of latencies, each one a delta from the previous CheckResponse sent.
|
||||
BucketValues []int64 `protobuf:"varint,1,rep,packed,name=bucket_values,json=bucketValues" json:"bucket_values,omitempty"`
|
||||
// The duration from the start of the loadtest to its completion or now if is_finished is false.
|
||||
RunningDuration *google_protobuf.Duration `protobuf:"bytes,2,opt,name=running_duration,json=runningDuration" json:"running_duration,omitempty"`
|
||||
// True if the load test has finished running.
|
||||
IsFinished bool `protobuf:"varint,3,opt,name=is_finished,json=isFinished" json:"is_finished,omitempty"`
|
||||
// MessageIdentifiers of all received messages since the last Check
|
||||
ReceivedMessages []*MessageIdentifier `protobuf:"bytes,4,rep,name=received_messages,json=receivedMessages" json:"received_messages,omitempty"`
|
||||
}
|
||||
|
||||
func (m *CheckResponse) Reset() { *m = CheckResponse{} }
|
||||
func (m *CheckResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*CheckResponse) ProtoMessage() {}
|
||||
func (*CheckResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
|
||||
|
||||
func (m *CheckResponse) GetBucketValues() []int64 {
|
||||
if m != nil {
|
||||
return m.BucketValues
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CheckResponse) GetRunningDuration() *google_protobuf.Duration {
|
||||
if m != nil {
|
||||
return m.RunningDuration
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CheckResponse) GetIsFinished() bool {
|
||||
if m != nil {
|
||||
return m.IsFinished
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *CheckResponse) GetReceivedMessages() []*MessageIdentifier {
|
||||
if m != nil {
|
||||
return m.ReceivedMessages
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ExecuteRequest struct {
|
||||
}
|
||||
|
||||
func (m *ExecuteRequest) Reset() { *m = ExecuteRequest{} }
|
||||
func (m *ExecuteRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ExecuteRequest) ProtoMessage() {}
|
||||
func (*ExecuteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
|
||||
|
||||
type ExecuteResponse struct {
|
||||
// Latencies of the completed operations
|
||||
Latencies []int64 `protobuf:"varint,1,rep,packed,name=latencies" json:"latencies,omitempty"`
|
||||
// MessageIdentifiers of all received messages since the last Execute
|
||||
ReceivedMessages []*MessageIdentifier `protobuf:"bytes,2,rep,name=received_messages,json=receivedMessages" json:"received_messages,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ExecuteResponse) Reset() { *m = ExecuteResponse{} }
|
||||
func (m *ExecuteResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ExecuteResponse) ProtoMessage() {}
|
||||
func (*ExecuteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
|
||||
|
||||
func (m *ExecuteResponse) GetLatencies() []int64 {
|
||||
if m != nil {
|
||||
return m.Latencies
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ExecuteResponse) GetReceivedMessages() []*MessageIdentifier {
|
||||
if m != nil {
|
||||
return m.ReceivedMessages
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*StartRequest)(nil), "google.pubsub.loadtest.StartRequest")
|
||||
proto.RegisterType((*StartResponse)(nil), "google.pubsub.loadtest.StartResponse")
|
||||
proto.RegisterType((*PubsubOptions)(nil), "google.pubsub.loadtest.PubsubOptions")
|
||||
proto.RegisterType((*KafkaOptions)(nil), "google.pubsub.loadtest.KafkaOptions")
|
||||
proto.RegisterType((*MessageIdentifier)(nil), "google.pubsub.loadtest.MessageIdentifier")
|
||||
proto.RegisterType((*CheckRequest)(nil), "google.pubsub.loadtest.CheckRequest")
|
||||
proto.RegisterType((*CheckResponse)(nil), "google.pubsub.loadtest.CheckResponse")
|
||||
proto.RegisterType((*ExecuteRequest)(nil), "google.pubsub.loadtest.ExecuteRequest")
|
||||
proto.RegisterType((*ExecuteResponse)(nil), "google.pubsub.loadtest.ExecuteResponse")
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// Client API for Loadtest service
|
||||
|
||||
type LoadtestClient interface {
|
||||
// Starts a load test
|
||||
Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error)
|
||||
// Checks the status of a load test
|
||||
Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error)
|
||||
}
|
||||
|
||||
type loadtestClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewLoadtestClient(cc *grpc.ClientConn) LoadtestClient {
|
||||
return &loadtestClient{cc}
|
||||
}
|
||||
|
||||
func (c *loadtestClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error) {
|
||||
out := new(StartResponse)
|
||||
err := grpc.Invoke(ctx, "/google.pubsub.loadtest.Loadtest/Start", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *loadtestClient) Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error) {
|
||||
out := new(CheckResponse)
|
||||
err := grpc.Invoke(ctx, "/google.pubsub.loadtest.Loadtest/Check", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for Loadtest service
|
||||
|
||||
type LoadtestServer interface {
|
||||
// Starts a load test
|
||||
Start(context.Context, *StartRequest) (*StartResponse, error)
|
||||
// Checks the status of a load test
|
||||
Check(context.Context, *CheckRequest) (*CheckResponse, error)
|
||||
}
|
||||
|
||||
func RegisterLoadtestServer(s *grpc.Server, srv LoadtestServer) {
|
||||
s.RegisterService(&_Loadtest_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Loadtest_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(StartRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(LoadtestServer).Start(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.pubsub.loadtest.Loadtest/Start",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(LoadtestServer).Start(ctx, req.(*StartRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Loadtest_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CheckRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(LoadtestServer).Check(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.pubsub.loadtest.Loadtest/Check",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(LoadtestServer).Check(ctx, req.(*CheckRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Loadtest_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "google.pubsub.loadtest.Loadtest",
|
||||
HandlerType: (*LoadtestServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Start",
|
||||
Handler: _Loadtest_Start_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Check",
|
||||
Handler: _Loadtest_Check_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "loadtest.proto",
|
||||
}
|
||||
|
||||
// Client API for LoadtestWorker service
|
||||
|
||||
type LoadtestWorkerClient interface {
|
||||
// Starts a worker
|
||||
Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error)
|
||||
// Executes a command on the worker, returning the latencies of the operations. Since some
|
||||
// commands consist of multiple operations (i.e. pulls contain many received messages with
|
||||
// different end to end latencies) a single command can have multiple latencies returned.
|
||||
Execute(ctx context.Context, in *ExecuteRequest, opts ...grpc.CallOption) (*ExecuteResponse, error)
|
||||
}
|
||||
|
||||
type loadtestWorkerClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewLoadtestWorkerClient(cc *grpc.ClientConn) LoadtestWorkerClient {
|
||||
return &loadtestWorkerClient{cc}
|
||||
}
|
||||
|
||||
func (c *loadtestWorkerClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error) {
|
||||
out := new(StartResponse)
|
||||
err := grpc.Invoke(ctx, "/google.pubsub.loadtest.LoadtestWorker/Start", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *loadtestWorkerClient) Execute(ctx context.Context, in *ExecuteRequest, opts ...grpc.CallOption) (*ExecuteResponse, error) {
|
||||
out := new(ExecuteResponse)
|
||||
err := grpc.Invoke(ctx, "/google.pubsub.loadtest.LoadtestWorker/Execute", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for LoadtestWorker service
|
||||
|
||||
type LoadtestWorkerServer interface {
|
||||
// Starts a worker
|
||||
Start(context.Context, *StartRequest) (*StartResponse, error)
|
||||
// Executes a command on the worker, returning the latencies of the operations. Since some
|
||||
// commands consist of multiple operations (i.e. pulls contain many received messages with
|
||||
// different end to end latencies) a single command can have multiple latencies returned.
|
||||
Execute(context.Context, *ExecuteRequest) (*ExecuteResponse, error)
|
||||
}
|
||||
|
||||
func RegisterLoadtestWorkerServer(s *grpc.Server, srv LoadtestWorkerServer) {
|
||||
s.RegisterService(&_LoadtestWorker_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _LoadtestWorker_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(StartRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(LoadtestWorkerServer).Start(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.pubsub.loadtest.LoadtestWorker/Start",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(LoadtestWorkerServer).Start(ctx, req.(*StartRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _LoadtestWorker_Execute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ExecuteRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(LoadtestWorkerServer).Execute(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/google.pubsub.loadtest.LoadtestWorker/Execute",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(LoadtestWorkerServer).Execute(ctx, req.(*ExecuteRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _LoadtestWorker_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "google.pubsub.loadtest.LoadtestWorker",
|
||||
HandlerType: (*LoadtestWorkerServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Start",
|
||||
Handler: _LoadtestWorker_Start_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Execute",
|
||||
Handler: _LoadtestWorker_Execute_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "loadtest.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("loadtest.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 847 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xdd, 0x6e, 0xdc, 0x44,
|
||||
0x14, 0xae, 0x93, 0x6e, 0x92, 0x3d, 0x6b, 0xef, 0x6e, 0x86, 0x12, 0x99, 0x15, 0xd0, 0x60, 0x28,
|
||||
0x0d, 0x12, 0x72, 0x45, 0xb8, 0x81, 0x1b, 0x84, 0x92, 0x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ef,
|
||||
0xdc, 0x8e, 0xff, 0x08, 0x60, 0xef, 0x07, 0x1f, 0x80, 0xae, 0xa0, 0xe7, 0x0e, 0x09, 0xad, 0xbd,
|
||||
0xd2, 0xe5, 0x7f, 0xca, 0xe4, 0xc1, 0x06, 0x96, 0x2f, 0xec, 0x0a, 0x7a, 0x6e, 0xe6, 0xeb, 0x55,
|
||||
0x97, 0xd7, 0x6d, 0xbd, 0xea, 0xca, 0xe2, 0x1c, 0xff, 0x19, 0xc0, 0xb0, 0x4b, 0xfc, 0x27, 0x21,
|
||||
0xed, 0x99, 0xbd, 0x9d, 0xf4, 0x7f, 0x81, 0x5d, 0x3f, 0x2a, 0xf4, 0xe9, 0xba, 0x88, 0xd5, 0xf1,
|
||||
0x4e, 0x1e, 0x6e, 0xe4, 0xb5, 0xda, 0x27, 0x29, 0x7c, 0x50, 0x88, 0xfa, 0x15, 0xf6, 0xb4, 0x62,
|
||||
0x45, 0x5a, 0x88, 0xba, 0x16, 0xfc, 0x24, 0xea, 0x4a, 0xbc, 0x74, 0xfb, 0xbd, 0xe3, 0xd6, 0xfc,
|
||||
0xcb, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xc4, 0xfc, 0xdc, 0x27, 0x48, 0x08, 0x00, 0x00,
|
||||
}
|
||||
Reference in New Issue
Block a user