rpc

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package rpc is a generated protocol buffer package.

It is generated from these files:

rpc.proto

It has these top-level messages:

AppArchive
Version
UpOptions
UpRequest
UpSummary
UpMessage

Index

Constants

View Source
const MaxRecvMsgSize = 1024 * 1024 * 20

MaxSendMsgSize sets the max message size in bytes the server can send. gRPC uses a default of 4MB.

Variables

View Source
var UpSummary_StatusCode_name = map[int32]string{
	0: "UNKNOWN",
	1: "LOGGING",
	2: "STARTED",
	3: "ONGOING",
	4: "SUCCESS",
	5: "FAILURE",
}
View Source
var UpSummary_StatusCode_value = map[string]int32{
	"UNKNOWN": 0,
	"LOGGING": 1,
	"STARTED": 2,
	"ONGOING": 3,
	"SUCCESS": 4,
	"FAILURE": 5,
}

Functions

func RegisterDraftServer

func RegisterDraftServer(s *grpc.Server, srv DraftServer)

Types

type AppArchive

type AppArchive struct {
	Name    string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
	Content []byte `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"`
}

AppArchive represents the archived application included in a `draft up`.

func (*AppArchive) Descriptor

func (*AppArchive) Descriptor() ([]byte, []int)

func (*AppArchive) GetContent

func (m *AppArchive) GetContent() []byte

func (*AppArchive) GetName

func (m *AppArchive) GetName() string

func (*AppArchive) ProtoMessage

func (*AppArchive) ProtoMessage()

func (*AppArchive) Reset

func (m *AppArchive) Reset()

func (*AppArchive) String

func (m *AppArchive) String() string

type Client

type Client interface {
	Version(context.Context) (*version.Version, error)
	UpBuild(context.Context, *UpRequest, chan<- *UpSummary) error
	UpStream(context.Context, <-chan *UpRequest, chan<- *UpSummary) error
}

Client handles rpc to the Server.

func NewClient

func NewClient(opts ...ClientOpt) Client

NewClient returns a Client configured with the provided ClientOpts.

type ClientOpt

type ClientOpt func(*clientOpts)

ClientOpt is an optional configuration for a client.

func WithServerAddr

func WithServerAddr(addr string) ClientOpt

WithServerAddr sets the draft server address the client should dial when invoking an rpc.

func WithServerHost

func WithServerHost(host string) ClientOpt

WithServerHost sets the draft server host the client should use when invoking an rpc.

type DraftClient

type DraftClient interface {
	// GetVersion returns the current version of the server.
	GetVersion(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*Version, error)
	// UpBuild returns a stream of the UpSummary within
	// for a given draft upload.
	//
	// Results are streamed rather than returned at once so
	// each stage of a draft up may be distinguished by the
	// client as a distinct message.
	UpBuild(ctx context.Context, in *UpMessage, opts ...grpc.CallOption) (Draft_UpBuildClient, error)
	// A Bidirectional streaming RPC.
	//
	// Accepts a stream of UpMessages each representing a separate
	// draft up. This is the api invoked by the draft client when
	// doing a draft up with watch enabled.
	UpStream(ctx context.Context, opts ...grpc.CallOption) (Draft_UpStreamClient, error)
}

func NewDraftClient

func NewDraftClient(cc *grpc.ClientConn) DraftClient

type DraftServer

type DraftServer interface {
	// GetVersion returns the current version of the server.
	GetVersion(context.Context, *google_protobuf.Empty) (*Version, error)
	// UpBuild returns a stream of the UpSummary within
	// for a given draft upload.
	//
	// Results are streamed rather than returned at once so
	// each stage of a draft up may be distinguished by the
	// client as a distinct message.
	UpBuild(*UpMessage, Draft_UpBuildServer) error
	// A Bidirectional streaming RPC.
	//
	// Accepts a stream of UpMessages each representing a separate
	// draft up. This is the api invoked by the draft client when
	// doing a draft up with watch enabled.
	UpStream(Draft_UpStreamServer) error
}

type Draft_UpBuildClient

type Draft_UpBuildClient interface {
	Recv() (*UpMessage, error)
	grpc.ClientStream
}

type Draft_UpBuildServer

type Draft_UpBuildServer interface {
	Send(*UpMessage) error
	grpc.ServerStream
}

type Draft_UpStreamClient

type Draft_UpStreamClient interface {
	Send(*UpMessage) error
	Recv() (*UpMessage, error)
	grpc.ClientStream
}

type Draft_UpStreamServer

type Draft_UpStreamServer interface {
	Send(*UpMessage) error
	Recv() (*UpMessage, error)
	grpc.ServerStream
}

type Handler

type Handler interface {
	UpHandler
}

Handler is the api surface to the rpc package. When calling Server.Server, requests are dispatched specific embedded interfaces within Handler.

type RecvStream

type RecvStream interface {
	Done() <-chan struct{}
	Recv() *UpSummary
	Err() error
	Stop()
}

RecvStream is returned by a Client for streaming summaries in response to a draft up. Stop should be called on return to notify the stream to close.

type Server

type Server interface {
	Serve(net.Listener, Handler) error
	Stop() bool
}

Server handles rpc made by the client.

func NewServer

func NewServer(opts ...ServerOpt) Server

NewServer returns a Server configured with the provided ServerOpts.

type ServerOpt

type ServerOpt func(*serverOpts)

ServerOpt is an optional configuration for a server.

type UpHandler

type UpHandler interface {
	Up(context.Context, *UpRequest) <-chan *UpSummary
}

Up is the mechanism by which to accept draft up requests initiated by the draft client dispatched by the rpc.Server.

type UpMessage

type UpMessage struct {
	// Types that are valid to be assigned to Message:
	//	*UpMessage_UpRequest
	//	*UpMessage_UpSummary
	Message isUpMessage_Message `protobuf_oneof:"Message"`
}

UpMessage is the discriminated union of draft up messages exchanged between the client and server.

func (*UpMessage) Descriptor

func (*UpMessage) Descriptor() ([]byte, []int)

func (*UpMessage) GetMessage

func (m *UpMessage) GetMessage() isUpMessage_Message

func (*UpMessage) GetUpRequest

func (m *UpMessage) GetUpRequest() *UpRequest

func (*UpMessage) GetUpSummary

func (m *UpMessage) GetUpSummary() *UpSummary

func (*UpMessage) ProtoMessage

func (*UpMessage) ProtoMessage()

func (*UpMessage) Reset

func (m *UpMessage) Reset()

func (*UpMessage) String

func (m *UpMessage) String() string

func (*UpMessage) XXX_OneofFuncs

func (*UpMessage) 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{})

XXX_OneofFuncs is for the internal use of the proto package.

type UpMessage_UpRequest

type UpMessage_UpRequest struct {
	UpRequest *UpRequest `protobuf:"bytes,1,opt,name=up_request,json=upRequest,oneof"`
}

type UpMessage_UpSummary

type UpMessage_UpSummary struct {
	UpSummary *UpSummary `protobuf:"bytes,2,opt,name=up_summary,json=upSummary,oneof"`
}

type UpOptions

type UpOptions struct {
	ReleaseWait bool `protobuf:"varint,1,opt,name=release_wait,json=releaseWait" json:"release_wait,omitempty"`
}

UpOptions are configurable settings to use when issuing a `draft up`.

func (*UpOptions) Descriptor

func (*UpOptions) Descriptor() ([]byte, []int)

func (*UpOptions) GetReleaseWait

func (m *UpOptions) GetReleaseWait() bool

func (*UpOptions) ProtoMessage

func (*UpOptions) ProtoMessage()

func (*UpOptions) Reset

func (m *UpOptions) Reset()

func (*UpOptions) String

func (m *UpOptions) String() string

type UpRequest

type UpRequest struct {
	AppName    string             `protobuf:"bytes,1,opt,name=app_name,json=appName" json:"app_name,omitempty"`
	Namespace  string             `protobuf:"bytes,2,opt,name=namespace" json:"namespace,omitempty"`
	Options    *UpOptions         `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"`
	Chart      *hapi_chart3.Chart `protobuf:"bytes,4,opt,name=chart" json:"chart,omitempty"`
	Values     *hapi_chart.Config `protobuf:"bytes,5,opt,name=values" json:"values,omitempty"`
	AppArchive *AppArchive        `protobuf:"bytes,6,opt,name=app_archive,json=appArchive" json:"app_archive,omitempty"`
}

UpRequest indicates the message sent by a draft client and received by a draft server to carry out a draft up command.

func (*UpRequest) Descriptor

func (*UpRequest) Descriptor() ([]byte, []int)

func (*UpRequest) GetAppArchive

func (m *UpRequest) GetAppArchive() *AppArchive

func (*UpRequest) GetAppName

func (m *UpRequest) GetAppName() string

func (*UpRequest) GetChart

func (m *UpRequest) GetChart() *hapi_chart3.Chart

func (*UpRequest) GetNamespace

func (m *UpRequest) GetNamespace() string

func (*UpRequest) GetOptions

func (m *UpRequest) GetOptions() *UpOptions

func (*UpRequest) GetValues

func (m *UpRequest) GetValues() *hapi_chart.Config

func (*UpRequest) ProtoMessage

func (*UpRequest) ProtoMessage()

func (*UpRequest) Reset

func (m *UpRequest) Reset()

func (*UpRequest) String

func (m *UpRequest) String() string

type UpSummary

type UpSummary struct {
	// stage_desc describes the particular stage this summary
	// represents, e.g. "Build Docker Image." This is meant
	// to be a canonical summary of the stage's intent.
	StageDesc string `protobuf:"bytes,1,opt,name=stage_desc,json=stageDesc" json:"stage_desc,omitempty"`
	// status_text indicates a string description of the progress
	// or completion of draft up.
	StatusText string `protobuf:"bytes,2,opt,name=status_text,json=statusText" json:"status_text,omitempty"`
	// status_code indicates the status of the progress or
	// completion of a draft up.
	StatusCode UpSummary_StatusCode `protobuf:"varint,3,opt,name=status_code,json=statusCode,enum=rpc.UpSummary_StatusCode" json:"status_code,omitempty"`
	// build_id is the build identifier associated with this draft up build.
	BuildId string `protobuf:"bytes,4,opt,name=build_id,json=buildId" json:"build_id,omitempty"`
}

UpSummary is the message returned when executing a draft up.

func (*UpSummary) Descriptor

func (*UpSummary) Descriptor() ([]byte, []int)

func (*UpSummary) GetBuildId added in v0.7.0

func (m *UpSummary) GetBuildId() string

func (*UpSummary) GetStageDesc

func (m *UpSummary) GetStageDesc() string

func (*UpSummary) GetStatusCode

func (m *UpSummary) GetStatusCode() UpSummary_StatusCode

func (*UpSummary) GetStatusText

func (m *UpSummary) GetStatusText() string

func (*UpSummary) ProtoMessage

func (*UpSummary) ProtoMessage()

func (*UpSummary) Reset

func (m *UpSummary) Reset()

func (*UpSummary) String

func (m *UpSummary) String() string

type UpSummary_StatusCode

type UpSummary_StatusCode int32

StatusCode is the enumeration of the possible status codes returned for a draft up. TODO: Flush this out.

const (
	UpSummary_UNKNOWN UpSummary_StatusCode = 0
	UpSummary_LOGGING UpSummary_StatusCode = 1
	UpSummary_STARTED UpSummary_StatusCode = 2
	UpSummary_ONGOING UpSummary_StatusCode = 3
	UpSummary_SUCCESS UpSummary_StatusCode = 4
	UpSummary_FAILURE UpSummary_StatusCode = 5
)

func (UpSummary_StatusCode) EnumDescriptor

func (UpSummary_StatusCode) EnumDescriptor() ([]byte, []int)

func (UpSummary_StatusCode) String

func (x UpSummary_StatusCode) String() string

type Version

type Version struct {
	SemVer       string `protobuf:"bytes,1,opt,name=sem_ver,json=semVer" json:"sem_ver,omitempty"`
	GitCommit    string `protobuf:"bytes,2,opt,name=git_commit,json=gitCommit" json:"git_commit,omitempty"`
	GitTreeState string `protobuf:"bytes,3,opt,name=git_tree_state,json=gitTreeState" json:"git_tree_state,omitempty"`
}

Version represents the wire description of a server's version.

func (*Version) Descriptor

func (*Version) Descriptor() ([]byte, []int)

func (*Version) GetGitCommit

func (m *Version) GetGitCommit() string

func (*Version) GetGitTreeState

func (m *Version) GetGitTreeState() string

func (*Version) GetSemVer

func (m *Version) GetSemVer() string

func (*Version) ProtoMessage

func (*Version) ProtoMessage()

func (*Version) Reset

func (m *Version) Reset()

func (*Version) String

func (m *Version) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL