Update Generated Proto Code (#351)

update generated code (definitions, client implementation & server interface)
and add documentation how to generate
This commit is contained in:
6543 2021-09-29 02:10:09 +02:00 committed by GitHub
parent 17b8867b96
commit 7f3a6eb17f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 1953 additions and 983 deletions

View file

@ -143,7 +143,7 @@ func loop(c *cli.Context) error {
MinTime: c.Duration("keepalive-min-time"),
}),
)
droneServer := woodpeckerGrpcServer.NewDroneServer(
woodpeckerServer := woodpeckerGrpcServer.NewWoodpeckerServer(
remote_,
server.Config.Services.Queue,
server.Config.Services.Logs,
@ -151,7 +151,7 @@ func loop(c *cli.Context) error {
store_,
server.Config.Server.Host,
)
proto.RegisterDroneServer(grpcServer, droneServer)
proto.RegisterWoodpeckerServer(grpcServer, woodpeckerServer)
err = grpcServer.Serve(lis)
if err != nil {

View file

@ -14,20 +14,17 @@ import (
"google.golang.org/grpc/status"
)
// generate protobuffs
// protoc --go_out=plugins=grpc,import_path=proto:. *.proto
var backoff = time.Second
type client struct {
client proto.DroneClient
client proto.WoodpeckerClient
conn *grpc.ClientConn
}
// NewGrpcClient returns a new grpc Client.
func NewGrpcClient(conn *grpc.ClientConn) Peer {
client := new(client)
client.client = proto.NewDroneClient(conn)
client.client = proto.NewWoodpeckerClient(conn)
client.conn = conn
return client
}

View file

@ -1,958 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: drone.proto
/*
Package proto is a generated protocol buffer package.
It is generated from these files:
drone.proto
It has these top-level messages:
File
State
Line
Filter
Pipeline
HealthCheckRequest
HealthCheckResponse
NextRequest
NextReply
InitRequest
WaitRequest
DoneRequest
ExtendRequest
UploadRequest
UpdateRequest
LogRequest
Empty
*/
package proto
import proto1 "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import (
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto1.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 _ = proto1.ProtoPackageIsVersion2 // please upgrade the proto package
type HealthCheckResponse_ServingStatus int32
const (
HealthCheckResponse_UNKNOWN HealthCheckResponse_ServingStatus = 0
HealthCheckResponse_SERVING HealthCheckResponse_ServingStatus = 1
HealthCheckResponse_NOT_SERVING HealthCheckResponse_ServingStatus = 2
)
var HealthCheckResponse_ServingStatus_name = map[int32]string{
0: "UNKNOWN",
1: "SERVING",
2: "NOT_SERVING",
}
var HealthCheckResponse_ServingStatus_value = map[string]int32{
"UNKNOWN": 0,
"SERVING": 1,
"NOT_SERVING": 2,
}
func (x HealthCheckResponse_ServingStatus) String() string {
return proto1.EnumName(HealthCheckResponse_ServingStatus_name, int32(x))
}
func (HealthCheckResponse_ServingStatus) EnumDescriptor() ([]byte, []int) {
return fileDescriptor0, []int{6, 0}
}
type File struct {
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
Proc string `protobuf:"bytes,2,opt,name=proc" json:"proc,omitempty"`
Mime string `protobuf:"bytes,3,opt,name=mime" json:"mime,omitempty"`
Time int64 `protobuf:"varint,4,opt,name=time" json:"time,omitempty"`
Size int32 `protobuf:"varint,5,opt,name=size" json:"size,omitempty"`
Data []byte `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"`
Meta map[string]string `protobuf:"bytes,7,rep,name=meta" json:"meta,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
}
func (m *File) Reset() { *m = File{} }
func (m *File) String() string { return proto1.CompactTextString(m) }
func (*File) ProtoMessage() {}
func (*File) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *File) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *File) GetProc() string {
if m != nil {
return m.Proc
}
return ""
}
func (m *File) GetMime() string {
if m != nil {
return m.Mime
}
return ""
}
func (m *File) GetTime() int64 {
if m != nil {
return m.Time
}
return 0
}
func (m *File) GetSize() int32 {
if m != nil {
return m.Size
}
return 0
}
func (m *File) GetData() []byte {
if m != nil {
return m.Data
}
return nil
}
func (m *File) GetMeta() map[string]string {
if m != nil {
return m.Meta
}
return nil
}
type State struct {
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
Exited bool `protobuf:"varint,2,opt,name=exited" json:"exited,omitempty"`
ExitCode int32 `protobuf:"varint,3,opt,name=exit_code,json=exitCode" json:"exit_code,omitempty"`
Started int64 `protobuf:"varint,4,opt,name=started" json:"started,omitempty"`
Finished int64 `protobuf:"varint,5,opt,name=finished" json:"finished,omitempty"`
Error string `protobuf:"bytes,6,opt,name=error" json:"error,omitempty"`
}
func (m *State) Reset() { *m = State{} }
func (m *State) String() string { return proto1.CompactTextString(m) }
func (*State) ProtoMessage() {}
func (*State) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func (m *State) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *State) GetExited() bool {
if m != nil {
return m.Exited
}
return false
}
func (m *State) GetExitCode() int32 {
if m != nil {
return m.ExitCode
}
return 0
}
func (m *State) GetStarted() int64 {
if m != nil {
return m.Started
}
return 0
}
func (m *State) GetFinished() int64 {
if m != nil {
return m.Finished
}
return 0
}
func (m *State) GetError() string {
if m != nil {
return m.Error
}
return ""
}
type Line struct {
Proc string `protobuf:"bytes,1,opt,name=proc" json:"proc,omitempty"`
Time int64 `protobuf:"varint,2,opt,name=time" json:"time,omitempty"`
Pos int32 `protobuf:"varint,3,opt,name=pos" json:"pos,omitempty"`
Out string `protobuf:"bytes,4,opt,name=out" json:"out,omitempty"`
}
func (m *Line) Reset() { *m = Line{} }
func (m *Line) String() string { return proto1.CompactTextString(m) }
func (*Line) ProtoMessage() {}
func (*Line) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
func (m *Line) GetProc() string {
if m != nil {
return m.Proc
}
return ""
}
func (m *Line) GetTime() int64 {
if m != nil {
return m.Time
}
return 0
}
func (m *Line) GetPos() int32 {
if m != nil {
return m.Pos
}
return 0
}
func (m *Line) GetOut() string {
if m != nil {
return m.Out
}
return ""
}
type Filter struct {
Labels map[string]string `protobuf:"bytes,1,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
Expr string `protobuf:"bytes,2,opt,name=expr" json:"expr,omitempty"`
}
func (m *Filter) Reset() { *m = Filter{} }
func (m *Filter) String() string { return proto1.CompactTextString(m) }
func (*Filter) ProtoMessage() {}
func (*Filter) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
func (m *Filter) GetLabels() map[string]string {
if m != nil {
return m.Labels
}
return nil
}
func (m *Filter) GetExpr() string {
if m != nil {
return m.Expr
}
return ""
}
type Pipeline struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
Timeout int64 `protobuf:"varint,2,opt,name=timeout" json:"timeout,omitempty"`
Payload []byte `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"`
}
func (m *Pipeline) Reset() { *m = Pipeline{} }
func (m *Pipeline) String() string { return proto1.CompactTextString(m) }
func (*Pipeline) ProtoMessage() {}
func (*Pipeline) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
func (m *Pipeline) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *Pipeline) GetTimeout() int64 {
if m != nil {
return m.Timeout
}
return 0
}
func (m *Pipeline) GetPayload() []byte {
if m != nil {
return m.Payload
}
return nil
}
type HealthCheckRequest struct {
Service string `protobuf:"bytes,1,opt,name=service" json:"service,omitempty"`
}
func (m *HealthCheckRequest) Reset() { *m = HealthCheckRequest{} }
func (m *HealthCheckRequest) String() string { return proto1.CompactTextString(m) }
func (*HealthCheckRequest) ProtoMessage() {}
func (*HealthCheckRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
func (m *HealthCheckRequest) GetService() string {
if m != nil {
return m.Service
}
return ""
}
type HealthCheckResponse struct {
Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,enum=proto.HealthCheckResponse_ServingStatus" json:"status,omitempty"`
}
func (m *HealthCheckResponse) Reset() { *m = HealthCheckResponse{} }
func (m *HealthCheckResponse) String() string { return proto1.CompactTextString(m) }
func (*HealthCheckResponse) ProtoMessage() {}
func (*HealthCheckResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
func (m *HealthCheckResponse) GetStatus() HealthCheckResponse_ServingStatus {
if m != nil {
return m.Status
}
return HealthCheckResponse_UNKNOWN
}
type NextRequest struct {
Filter *Filter `protobuf:"bytes,1,opt,name=filter" json:"filter,omitempty"`
}
func (m *NextRequest) Reset() { *m = NextRequest{} }
func (m *NextRequest) String() string { return proto1.CompactTextString(m) }
func (*NextRequest) ProtoMessage() {}
func (*NextRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
func (m *NextRequest) GetFilter() *Filter {
if m != nil {
return m.Filter
}
return nil
}
type NextReply struct {
Pipeline *Pipeline `protobuf:"bytes,1,opt,name=pipeline" json:"pipeline,omitempty"`
}
func (m *NextReply) Reset() { *m = NextReply{} }
func (m *NextReply) String() string { return proto1.CompactTextString(m) }
func (*NextReply) ProtoMessage() {}
func (*NextReply) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
func (m *NextReply) GetPipeline() *Pipeline {
if m != nil {
return m.Pipeline
}
return nil
}
type InitRequest struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
State *State `protobuf:"bytes,2,opt,name=state" json:"state,omitempty"`
}
func (m *InitRequest) Reset() { *m = InitRequest{} }
func (m *InitRequest) String() string { return proto1.CompactTextString(m) }
func (*InitRequest) ProtoMessage() {}
func (*InitRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
func (m *InitRequest) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *InitRequest) GetState() *State {
if m != nil {
return m.State
}
return nil
}
type WaitRequest struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
}
func (m *WaitRequest) Reset() { *m = WaitRequest{} }
func (m *WaitRequest) String() string { return proto1.CompactTextString(m) }
func (*WaitRequest) ProtoMessage() {}
func (*WaitRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
func (m *WaitRequest) GetId() string {
if m != nil {
return m.Id
}
return ""
}
type DoneRequest struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
State *State `protobuf:"bytes,2,opt,name=state" json:"state,omitempty"`
}
func (m *DoneRequest) Reset() { *m = DoneRequest{} }
func (m *DoneRequest) String() string { return proto1.CompactTextString(m) }
func (*DoneRequest) ProtoMessage() {}
func (*DoneRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }
func (m *DoneRequest) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *DoneRequest) GetState() *State {
if m != nil {
return m.State
}
return nil
}
type ExtendRequest struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
}
func (m *ExtendRequest) Reset() { *m = ExtendRequest{} }
func (m *ExtendRequest) String() string { return proto1.CompactTextString(m) }
func (*ExtendRequest) ProtoMessage() {}
func (*ExtendRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} }
func (m *ExtendRequest) GetId() string {
if m != nil {
return m.Id
}
return ""
}
type UploadRequest struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
File *File `protobuf:"bytes,2,opt,name=file" json:"file,omitempty"`
}
func (m *UploadRequest) Reset() { *m = UploadRequest{} }
func (m *UploadRequest) String() string { return proto1.CompactTextString(m) }
func (*UploadRequest) ProtoMessage() {}
func (*UploadRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} }
func (m *UploadRequest) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *UploadRequest) GetFile() *File {
if m != nil {
return m.File
}
return nil
}
type UpdateRequest struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
State *State `protobuf:"bytes,2,opt,name=state" json:"state,omitempty"`
}
func (m *UpdateRequest) Reset() { *m = UpdateRequest{} }
func (m *UpdateRequest) String() string { return proto1.CompactTextString(m) }
func (*UpdateRequest) ProtoMessage() {}
func (*UpdateRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} }
func (m *UpdateRequest) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *UpdateRequest) GetState() *State {
if m != nil {
return m.State
}
return nil
}
type LogRequest struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
Line *Line `protobuf:"bytes,2,opt,name=line" json:"line,omitempty"`
}
func (m *LogRequest) Reset() { *m = LogRequest{} }
func (m *LogRequest) String() string { return proto1.CompactTextString(m) }
func (*LogRequest) ProtoMessage() {}
func (*LogRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} }
func (m *LogRequest) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *LogRequest) GetLine() *Line {
if m != nil {
return m.Line
}
return nil
}
type Empty struct {
}
func (m *Empty) Reset() { *m = Empty{} }
func (m *Empty) String() string { return proto1.CompactTextString(m) }
func (*Empty) ProtoMessage() {}
func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} }
func init() {
proto1.RegisterType((*File)(nil), "proto.File")
proto1.RegisterType((*State)(nil), "proto.State")
proto1.RegisterType((*Line)(nil), "proto.Line")
proto1.RegisterType((*Filter)(nil), "proto.Filter")
proto1.RegisterType((*Pipeline)(nil), "proto.Pipeline")
proto1.RegisterType((*HealthCheckRequest)(nil), "proto.HealthCheckRequest")
proto1.RegisterType((*HealthCheckResponse)(nil), "proto.HealthCheckResponse")
proto1.RegisterType((*NextRequest)(nil), "proto.NextRequest")
proto1.RegisterType((*NextReply)(nil), "proto.NextReply")
proto1.RegisterType((*InitRequest)(nil), "proto.InitRequest")
proto1.RegisterType((*WaitRequest)(nil), "proto.WaitRequest")
proto1.RegisterType((*DoneRequest)(nil), "proto.DoneRequest")
proto1.RegisterType((*ExtendRequest)(nil), "proto.ExtendRequest")
proto1.RegisterType((*UploadRequest)(nil), "proto.UploadRequest")
proto1.RegisterType((*UpdateRequest)(nil), "proto.UpdateRequest")
proto1.RegisterType((*LogRequest)(nil), "proto.LogRequest")
proto1.RegisterType((*Empty)(nil), "proto.Empty")
proto1.RegisterEnum("proto.HealthCheckResponse_ServingStatus", HealthCheckResponse_ServingStatus_name, HealthCheckResponse_ServingStatus_value)
}
// 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 Drone service
type DroneClient interface {
Next(ctx context.Context, in *NextRequest, opts ...grpc.CallOption) (*NextReply, error)
Init(ctx context.Context, in *InitRequest, opts ...grpc.CallOption) (*Empty, error)
Wait(ctx context.Context, in *WaitRequest, opts ...grpc.CallOption) (*Empty, error)
Done(ctx context.Context, in *DoneRequest, opts ...grpc.CallOption) (*Empty, error)
Extend(ctx context.Context, in *ExtendRequest, opts ...grpc.CallOption) (*Empty, error)
Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*Empty, error)
Upload(ctx context.Context, in *UploadRequest, opts ...grpc.CallOption) (*Empty, error)
Log(ctx context.Context, in *LogRequest, opts ...grpc.CallOption) (*Empty, error)
}
type droneClient struct {
cc *grpc.ClientConn
}
func NewDroneClient(cc *grpc.ClientConn) DroneClient {
return &droneClient{cc}
}
func (c *droneClient) Next(ctx context.Context, in *NextRequest, opts ...grpc.CallOption) (*NextReply, error) {
out := new(NextReply)
err := grpc.Invoke(ctx, "/proto.Drone/Next", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *droneClient) Init(ctx context.Context, in *InitRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := grpc.Invoke(ctx, "/proto.Drone/Init", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *droneClient) Wait(ctx context.Context, in *WaitRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := grpc.Invoke(ctx, "/proto.Drone/Wait", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *droneClient) Done(ctx context.Context, in *DoneRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := grpc.Invoke(ctx, "/proto.Drone/Done", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *droneClient) Extend(ctx context.Context, in *ExtendRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := grpc.Invoke(ctx, "/proto.Drone/Extend", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *droneClient) Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := grpc.Invoke(ctx, "/proto.Drone/Update", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *droneClient) Upload(ctx context.Context, in *UploadRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := grpc.Invoke(ctx, "/proto.Drone/Upload", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *droneClient) Log(ctx context.Context, in *LogRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := grpc.Invoke(ctx, "/proto.Drone/Log", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Drone service
type DroneServer interface {
Next(context.Context, *NextRequest) (*NextReply, error)
Init(context.Context, *InitRequest) (*Empty, error)
Wait(context.Context, *WaitRequest) (*Empty, error)
Done(context.Context, *DoneRequest) (*Empty, error)
Extend(context.Context, *ExtendRequest) (*Empty, error)
Update(context.Context, *UpdateRequest) (*Empty, error)
Upload(context.Context, *UploadRequest) (*Empty, error)
Log(context.Context, *LogRequest) (*Empty, error)
}
func RegisterDroneServer(s *grpc.Server, srv DroneServer) {
s.RegisterService(&_Drone_serviceDesc, srv)
}
func _Drone_Next_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(NextRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DroneServer).Next(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Drone/Next",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DroneServer).Next(ctx, req.(*NextRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Drone_Init_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(InitRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DroneServer).Init(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Drone/Init",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DroneServer).Init(ctx, req.(*InitRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Drone_Wait_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(WaitRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DroneServer).Wait(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Drone/Wait",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DroneServer).Wait(ctx, req.(*WaitRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Drone_Done_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DoneRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DroneServer).Done(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Drone/Done",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DroneServer).Done(ctx, req.(*DoneRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Drone_Extend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ExtendRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DroneServer).Extend(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Drone/Extend",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DroneServer).Extend(ctx, req.(*ExtendRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Drone_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DroneServer).Update(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Drone/Update",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DroneServer).Update(ctx, req.(*UpdateRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Drone_Upload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UploadRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DroneServer).Upload(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Drone/Upload",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DroneServer).Upload(ctx, req.(*UploadRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Drone_Log_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LogRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DroneServer).Log(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Drone/Log",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DroneServer).Log(ctx, req.(*LogRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Drone_serviceDesc = grpc.ServiceDesc{
ServiceName: "proto.Drone",
HandlerType: (*DroneServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Next",
Handler: _Drone_Next_Handler,
},
{
MethodName: "Init",
Handler: _Drone_Init_Handler,
},
{
MethodName: "Wait",
Handler: _Drone_Wait_Handler,
},
{
MethodName: "Done",
Handler: _Drone_Done_Handler,
},
{
MethodName: "Extend",
Handler: _Drone_Extend_Handler,
},
{
MethodName: "Update",
Handler: _Drone_Update_Handler,
},
{
MethodName: "Upload",
Handler: _Drone_Upload_Handler,
},
{
MethodName: "Log",
Handler: _Drone_Log_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "drone.proto",
}
// Client API for Health service
type HealthClient interface {
Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error)
}
type healthClient struct {
cc *grpc.ClientConn
}
func NewHealthClient(cc *grpc.ClientConn) HealthClient {
return &healthClient{cc}
}
func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) {
out := new(HealthCheckResponse)
err := grpc.Invoke(ctx, "/proto.Health/Check", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Health service
type HealthServer interface {
Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error)
}
func RegisterHealthServer(s *grpc.Server, srv HealthServer) {
s.RegisterService(&_Health_serviceDesc, srv)
}
func _Health_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(HealthCheckRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(HealthServer).Check(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Health/Check",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(HealthServer).Check(ctx, req.(*HealthCheckRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Health_serviceDesc = grpc.ServiceDesc{
ServiceName: "proto.Health",
HandlerType: (*HealthServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Check",
Handler: _Health_Check_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "drone.proto",
}
func init() { proto1.RegisterFile("drone.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 780 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x5f, 0x4f, 0xd3, 0x50,
0x14, 0xa7, 0x5b, 0xdb, 0x6d, 0xa7, 0x0c, 0xe6, 0x15, 0x4d, 0x99, 0x31, 0x2c, 0x4d, 0x4c, 0xa6,
0x26, 0x4d, 0x9c, 0x26, 0x22, 0x89, 0x06, 0x03, 0x43, 0x88, 0x73, 0x98, 0x3b, 0x91, 0x47, 0x52,
0xd6, 0x0b, 0x34, 0x74, 0x6d, 0x6d, 0xef, 0xc8, 0xe6, 0x47, 0xf0, 0xd5, 0x57, 0x3f, 0x9d, 0xdf,
0xc1, 0x77, 0x73, 0xee, 0x6d, 0x4b, 0x07, 0x9b, 0x89, 0xe1, 0xa9, 0xe7, 0xcf, 0xef, 0xdc, 0x73,
0xce, 0xef, 0xd7, 0x7b, 0xc1, 0x70, 0xe3, 0x30, 0x60, 0x76, 0x14, 0x87, 0x3c, 0x24, 0x9a, 0xf8,
0x58, 0xbf, 0x15, 0x50, 0xf7, 0x3c, 0x9f, 0x11, 0x02, 0x6a, 0xe0, 0x8c, 0x98, 0xa9, 0xb4, 0x94,
0x76, 0x8d, 0x0a, 0x1b, 0x63, 0x51, 0x1c, 0x0e, 0xcd, 0x92, 0x8c, 0xa1, 0x8d, 0xb1, 0x91, 0x37,
0x62, 0x66, 0x59, 0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, 0x64, 0xd1, 0x43, 0x62, 0x51,
0xb7, 0x1c, 0x5b, 0x10, 0x71, 0x1e, 0x16, 0x45, 0xcc, 0xb1, 0x05, 0x45, 0x6f, 0x61, 0x6d, 0xd0,
0xa5, 0x5a, 0x64, 0x2d, 0xcb, 0x14, 0xc5, 0x9b, 0x87, 0x97, 0xd4, 0xe7, 0xf8, 0x19, 0x25, 0xe6,
0xe3, 0x51, 0xec, 0x02, 0xbe, 0xa0, 0xfd, 0x2d, 0x7c, 0x1b, 0xca, 0xbd, 0xf0, 0x9c, 0xdc, 0xcb,
0x08, 0xcf, 0x15, 0xba, 0x89, 0xec, 0xec, 0x83, 0x2e, 0x6f, 0x39, 0x79, 0x07, 0x9a, 0xb8, 0xe9,
0x64, 0x7d, 0xde, 0xed, 0x97, 0xd5, 0xcd, 0xc5, 0x0f, 0xc3, 0xa9, 0x2e, 0x52, 0x2f, 0xff, 0x06,
0x00, 0x00, 0xff, 0xff, 0x59, 0x78, 0xda, 0x5d, 0x5e, 0x07, 0x00, 0x00,
}

View file

@ -0,0 +1,22 @@
// Copyright 2021 Woodpecker 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 proto
//go:generate protoc --go_out=paths=source_relative:. woodpecker.proto
//go:generate protoc --go-grpc_out=paths=source_relative:. woodpecker.proto
// get needed binary's:
// go install google.golang.org/protobuf/cmd/protoc-gen-go
// go install google.golang.org/grpc/cmd/protoc-gen-go-grpc

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,6 @@
syntax = "proto3";
option go_package = "github.com/woodpecker-ci/woodpecker/pipeline/rpc/proto";
package proto;
message File {
@ -52,7 +53,7 @@ message HealthCheckResponse {
ServingStatus status = 1;
}
service Drone {
service Woodpecker {
rpc Next (NextRequest) returns (NextReply) {}
rpc Init (InitRequest) returns (Empty) {}
rpc Wait (WaitRequest) returns (Empty) {}

View file

@ -0,0 +1,439 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package proto
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
// WoodpeckerClient is the client API for Woodpecker 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 WoodpeckerClient interface {
Next(ctx context.Context, in *NextRequest, opts ...grpc.CallOption) (*NextReply, error)
Init(ctx context.Context, in *InitRequest, opts ...grpc.CallOption) (*Empty, error)
Wait(ctx context.Context, in *WaitRequest, opts ...grpc.CallOption) (*Empty, error)
Done(ctx context.Context, in *DoneRequest, opts ...grpc.CallOption) (*Empty, error)
Extend(ctx context.Context, in *ExtendRequest, opts ...grpc.CallOption) (*Empty, error)
Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*Empty, error)
Upload(ctx context.Context, in *UploadRequest, opts ...grpc.CallOption) (*Empty, error)
Log(ctx context.Context, in *LogRequest, opts ...grpc.CallOption) (*Empty, error)
}
type woodpeckerClient struct {
cc grpc.ClientConnInterface
}
func NewWoodpeckerClient(cc grpc.ClientConnInterface) WoodpeckerClient {
return &woodpeckerClient{cc}
}
func (c *woodpeckerClient) Next(ctx context.Context, in *NextRequest, opts ...grpc.CallOption) (*NextReply, error) {
out := new(NextReply)
err := c.cc.Invoke(ctx, "/proto.Woodpecker/Next", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *woodpeckerClient) Init(ctx context.Context, in *InitRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/proto.Woodpecker/Init", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *woodpeckerClient) Wait(ctx context.Context, in *WaitRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/proto.Woodpecker/Wait", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *woodpeckerClient) Done(ctx context.Context, in *DoneRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/proto.Woodpecker/Done", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *woodpeckerClient) Extend(ctx context.Context, in *ExtendRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/proto.Woodpecker/Extend", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *woodpeckerClient) Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/proto.Woodpecker/Update", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *woodpeckerClient) Upload(ctx context.Context, in *UploadRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/proto.Woodpecker/Upload", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *woodpeckerClient) Log(ctx context.Context, in *LogRequest, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/proto.Woodpecker/Log", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// WoodpeckerServer is the server API for Woodpecker service.
// All implementations must embed UnimplementedWoodpeckerServer
// for forward compatibility
type WoodpeckerServer interface {
Next(context.Context, *NextRequest) (*NextReply, error)
Init(context.Context, *InitRequest) (*Empty, error)
Wait(context.Context, *WaitRequest) (*Empty, error)
Done(context.Context, *DoneRequest) (*Empty, error)
Extend(context.Context, *ExtendRequest) (*Empty, error)
Update(context.Context, *UpdateRequest) (*Empty, error)
Upload(context.Context, *UploadRequest) (*Empty, error)
Log(context.Context, *LogRequest) (*Empty, error)
mustEmbedUnimplementedWoodpeckerServer()
}
// UnimplementedWoodpeckerServer must be embedded to have forward compatible implementations.
type UnimplementedWoodpeckerServer struct {
}
func (UnimplementedWoodpeckerServer) Next(context.Context, *NextRequest) (*NextReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Next not implemented")
}
func (UnimplementedWoodpeckerServer) Init(context.Context, *InitRequest) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Init not implemented")
}
func (UnimplementedWoodpeckerServer) Wait(context.Context, *WaitRequest) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Wait not implemented")
}
func (UnimplementedWoodpeckerServer) Done(context.Context, *DoneRequest) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Done not implemented")
}
func (UnimplementedWoodpeckerServer) Extend(context.Context, *ExtendRequest) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Extend not implemented")
}
func (UnimplementedWoodpeckerServer) Update(context.Context, *UpdateRequest) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Update not implemented")
}
func (UnimplementedWoodpeckerServer) Upload(context.Context, *UploadRequest) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Upload not implemented")
}
func (UnimplementedWoodpeckerServer) Log(context.Context, *LogRequest) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Log not implemented")
}
func (UnimplementedWoodpeckerServer) mustEmbedUnimplementedWoodpeckerServer() {}
// UnsafeWoodpeckerServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to WoodpeckerServer will
// result in compilation errors.
type UnsafeWoodpeckerServer interface {
mustEmbedUnimplementedWoodpeckerServer()
}
func RegisterWoodpeckerServer(s grpc.ServiceRegistrar, srv WoodpeckerServer) {
s.RegisterService(&Woodpecker_ServiceDesc, srv)
}
func _Woodpecker_Next_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(NextRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WoodpeckerServer).Next(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Woodpecker/Next",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WoodpeckerServer).Next(ctx, req.(*NextRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Woodpecker_Init_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(InitRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WoodpeckerServer).Init(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Woodpecker/Init",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WoodpeckerServer).Init(ctx, req.(*InitRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Woodpecker_Wait_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(WaitRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WoodpeckerServer).Wait(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Woodpecker/Wait",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WoodpeckerServer).Wait(ctx, req.(*WaitRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Woodpecker_Done_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DoneRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WoodpeckerServer).Done(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Woodpecker/Done",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WoodpeckerServer).Done(ctx, req.(*DoneRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Woodpecker_Extend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ExtendRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WoodpeckerServer).Extend(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Woodpecker/Extend",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WoodpeckerServer).Extend(ctx, req.(*ExtendRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Woodpecker_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WoodpeckerServer).Update(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Woodpecker/Update",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WoodpeckerServer).Update(ctx, req.(*UpdateRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Woodpecker_Upload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UploadRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WoodpeckerServer).Upload(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Woodpecker/Upload",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WoodpeckerServer).Upload(ctx, req.(*UploadRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Woodpecker_Log_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LogRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WoodpeckerServer).Log(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Woodpecker/Log",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WoodpeckerServer).Log(ctx, req.(*LogRequest))
}
return interceptor(ctx, in, info, handler)
}
// Woodpecker_ServiceDesc is the grpc.ServiceDesc for Woodpecker service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Woodpecker_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.Woodpecker",
HandlerType: (*WoodpeckerServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Next",
Handler: _Woodpecker_Next_Handler,
},
{
MethodName: "Init",
Handler: _Woodpecker_Init_Handler,
},
{
MethodName: "Wait",
Handler: _Woodpecker_Wait_Handler,
},
{
MethodName: "Done",
Handler: _Woodpecker_Done_Handler,
},
{
MethodName: "Extend",
Handler: _Woodpecker_Extend_Handler,
},
{
MethodName: "Update",
Handler: _Woodpecker_Update_Handler,
},
{
MethodName: "Upload",
Handler: _Woodpecker_Upload_Handler,
},
{
MethodName: "Log",
Handler: _Woodpecker_Log_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "woodpecker.proto",
}
// HealthClient is the client API for Health 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 HealthClient interface {
Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error)
}
type healthClient struct {
cc grpc.ClientConnInterface
}
func NewHealthClient(cc grpc.ClientConnInterface) HealthClient {
return &healthClient{cc}
}
func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) {
out := new(HealthCheckResponse)
err := c.cc.Invoke(ctx, "/proto.Health/Check", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// HealthServer is the server API for Health service.
// All implementations must embed UnimplementedHealthServer
// for forward compatibility
type HealthServer interface {
Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error)
mustEmbedUnimplementedHealthServer()
}
// UnimplementedHealthServer must be embedded to have forward compatible implementations.
type UnimplementedHealthServer struct {
}
func (UnimplementedHealthServer) Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Check not implemented")
}
func (UnimplementedHealthServer) mustEmbedUnimplementedHealthServer() {}
// UnsafeHealthServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to HealthServer will
// result in compilation errors.
type UnsafeHealthServer interface {
mustEmbedUnimplementedHealthServer()
}
func RegisterHealthServer(s grpc.ServiceRegistrar, srv HealthServer) {
s.RegisterService(&Health_ServiceDesc, srv)
}
func _Health_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(HealthCheckRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(HealthServer).Check(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.Health/Check",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(HealthServer).Check(ctx, req.(*HealthCheckRequest))
}
return interceptor(ctx, in, info, handler)
}
// Health_ServiceDesc is the grpc.ServiceDesc for Health service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Health_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.Health",
HandlerType: (*HealthServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Check",
Handler: _Health_Check_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "woodpecker.proto",
}

View file

@ -478,12 +478,13 @@ func createFilterFunc(filter rpc.Filter) (queue.Filter, error) {
//
//
// DroneServer is a grpc server implementation.
type DroneServer struct {
// WoodpeckerServer is a grpc server implementation.
type WoodpeckerServer struct {
proto.UnimplementedWoodpeckerServer
peer RPC
}
func NewDroneServer(remote remote.Remote, queue queue.Queue, logger logging.Log, pubsub pubsub.Publisher, store store.Store, host string) *DroneServer {
func NewWoodpeckerServer(remote remote.Remote, queue queue.Queue, logger logging.Log, pubsub pubsub.Publisher, store store.Store, host string) *WoodpeckerServer {
buildTime := promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: "drone",
Name: "build_time",
@ -504,10 +505,10 @@ func NewDroneServer(remote remote.Remote, queue queue.Queue, logger logging.Log,
buildTime: buildTime,
buildCount: buildCount,
}
return &DroneServer{peer: peer}
return &WoodpeckerServer{peer: peer}
}
func (s *DroneServer) Next(c oldcontext.Context, req *proto.NextRequest) (*proto.NextReply, error) {
func (s *WoodpeckerServer) Next(c oldcontext.Context, req *proto.NextRequest) (*proto.NextReply, error) {
filter := rpc.Filter{
Labels: req.GetFilter().GetLabels(),
Expr: req.GetFilter().GetExpr(),
@ -530,7 +531,7 @@ func (s *DroneServer) Next(c oldcontext.Context, req *proto.NextRequest) (*proto
return res, err
}
func (s *DroneServer) Init(c oldcontext.Context, req *proto.InitRequest) (*proto.Empty, error) {
func (s *WoodpeckerServer) Init(c oldcontext.Context, req *proto.InitRequest) (*proto.Empty, error) {
state := rpc.State{
Error: req.GetState().GetError(),
ExitCode: int(req.GetState().GetExitCode()),
@ -544,7 +545,7 @@ func (s *DroneServer) Init(c oldcontext.Context, req *proto.InitRequest) (*proto
return res, err
}
func (s *DroneServer) Update(c oldcontext.Context, req *proto.UpdateRequest) (*proto.Empty, error) {
func (s *WoodpeckerServer) Update(c oldcontext.Context, req *proto.UpdateRequest) (*proto.Empty, error) {
state := rpc.State{
Error: req.GetState().GetError(),
ExitCode: int(req.GetState().GetExitCode()),
@ -558,7 +559,7 @@ func (s *DroneServer) Update(c oldcontext.Context, req *proto.UpdateRequest) (*p
return res, err
}
func (s *DroneServer) Upload(c oldcontext.Context, req *proto.UploadRequest) (*proto.Empty, error) {
func (s *WoodpeckerServer) Upload(c oldcontext.Context, req *proto.UploadRequest) (*proto.Empty, error) {
file := &rpc.File{
Data: req.GetFile().GetData(),
Mime: req.GetFile().GetMime(),
@ -574,7 +575,7 @@ func (s *DroneServer) Upload(c oldcontext.Context, req *proto.UploadRequest) (*p
return res, err
}
func (s *DroneServer) Done(c oldcontext.Context, req *proto.DoneRequest) (*proto.Empty, error) {
func (s *WoodpeckerServer) Done(c oldcontext.Context, req *proto.DoneRequest) (*proto.Empty, error) {
state := rpc.State{
Error: req.GetState().GetError(),
ExitCode: int(req.GetState().GetExitCode()),
@ -588,19 +589,19 @@ func (s *DroneServer) Done(c oldcontext.Context, req *proto.DoneRequest) (*proto
return res, err
}
func (s *DroneServer) Wait(c oldcontext.Context, req *proto.WaitRequest) (*proto.Empty, error) {
func (s *WoodpeckerServer) Wait(c oldcontext.Context, req *proto.WaitRequest) (*proto.Empty, error) {
res := new(proto.Empty)
err := s.peer.Wait(c, req.GetId())
return res, err
}
func (s *DroneServer) Extend(c oldcontext.Context, req *proto.ExtendRequest) (*proto.Empty, error) {
func (s *WoodpeckerServer) Extend(c oldcontext.Context, req *proto.ExtendRequest) (*proto.Empty, error) {
res := new(proto.Empty)
err := s.peer.Extend(c, req.GetId())
return res, err
}
func (s *DroneServer) Log(c oldcontext.Context, req *proto.LogRequest) (*proto.Empty, error) {
func (s *WoodpeckerServer) Log(c oldcontext.Context, req *proto.LogRequest) (*proto.Empty, error) {
line := &rpc.Line{
Out: req.GetLine().GetOut(),
Pos: int(req.GetLine().GetPos()),