grpc

package
v2.3.5 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const APIKeyLabel = "api_key"

APIKeyLabel is the request metadata label used for the API key

Variables

View Source
var DefaultCacheOpts = &furanrpc.BuildCacheOpts{
	Type:    furanrpc.BuildCacheOpts_DISABLED,
	MaxMode: false,
}

DefaultCacheOpts is the cache options that will be used if not overridden in Options

View Source
var DefaultJobHandoffTimeout = 5 * time.Minute

DefaultJobHandoffTimeout is the default maximum amount of time we will wait for job handoff to occur once the build job is running

Functions

This section is empty.

Types

type MaxResourceLimits

type MaxResourceLimits struct {
	MaxCPUReq resource.Quantity
	MaxMemReq resource.Quantity
	MaxCPULim resource.Quantity
	MaxMemLim resource.Quantity
}

MaxResourceLimits contains the maximum allowable quantities for build resource requests/limits if supplied in build API requests. If unset, the zero value for any field will result in no allowed build resource overrides for that field in requests. Since build resource requests/limits are optional, this means that only the defaults would be used.

type MonitorStreamAdapter

type MonitorStreamAdapter struct {
	grpc.ServerStream
	sync.RWMutex
	// contains filtered or unexported fields
}

MonitorStreamAdapter allows the Monitor streaming RPC to be consumed by non-gRPC clients

func NewMonitorStreamAdapter

func NewMonitorStreamAdapter(ctx context.Context, bufmsgs uint) *MonitorStreamAdapter

NewMonitorStreamAdapter returns a MonitorStreamAdapter

func (*MonitorStreamAdapter) Context

func (msa *MonitorStreamAdapter) Context() context.Context

func (*MonitorStreamAdapter) RecvMsg

func (msa *MonitorStreamAdapter) RecvMsg(m interface{}) error

RecvMsg blocks and listens for *furanrpc.BuildEvent messages and if one is received, assigns it to m and returns a nil error

func (*MonitorStreamAdapter) Send

func (*MonitorStreamAdapter) SendMsg

func (msa *MonitorStreamAdapter) SendMsg(m interface{}) error

SendMsg sends m (which must be a *furanrpc.BuildEvent) to listeners

type Options

type Options struct {
	Tracing config.APMConfig
	// TLSCertificate is the TLS certificate used to secure the gRPC transport.
	TLSCertificate tls.Certificate
	// CredentialDecryptionKey is the secretbox key used to decrypt the build github credential
	CredentialDecryptionKey [32]byte
	Cache                   *furanrpc.BuildCacheOpts
	LogFunc                 func(msg string, args ...interface{})
	JobHandoffTimeout       time.Duration
	MaxResources            MaxResourceLimits
}

type Server

type Server struct {
	DL datalayer.DataLayer
	BM models.BuildManager
	// CFFactory is a function that returns a CodeFetcher. Token should be considered optional.
	CFFactory func(token string) models.CodeFetcher
	Opts      *Options
	// contains filtered or unexported fields
}

Server represents an object that responds to gRPC calls

func (*Server) CancelBuild

func (gr *Server) CancelBuild(ctx context.Context, req *furanrpc.BuildCancelRequest) (_ *furanrpc.BuildCancelResponse, err error)

CancelBuild requests cancellation for a currently-running build

func (*Server) GetBuildEvents

func (*Server) GetBuildStatus

func (gr *Server) GetBuildStatus(ctx context.Context, req *furanrpc.BuildStatusRequest) (_ *furanrpc.BuildStatusResponse, err error)

GetBuildStatus returns the current status for a build

func (*Server) ListBuilds

func (*Server) Listen

func (gr *Server) Listen(addr string) error

Listen starts the RPC listener on addr (host:port) and blocks until the server is signalled to stop. Always returns a non-nil error.

func (*Server) MonitorBuild

MonitorBuild streams events from a specified build until completion

func (*Server) Shutdown

func (gr *Server) Shutdown()

Shutdown gracefully stops the server

func (*Server) StartBuild

StartBuild creates a new asynchronous build job

Jump to

Keyboard shortcuts

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