Documentation
¶
Index ¶
- type ConnectResponse
- type Connector
- type Dialer
- type LocalProvisioners
- type Metrics
- type Options
- type Server
- func (p *Server) Close() error
- func (p *Server) CommitQuota(ctx context.Context, in *proto.CommitQuotaRequest) (*proto.CommitQuotaResponse, error)
- func (p *Server) CompleteJob(ctx context.Context, in *proto.CompletedJob) error
- func (p *Server) FailJob(ctx context.Context, in *proto.FailedJob) error
- func (p *Server) Shutdown(ctx context.Context, cancelActiveJob bool) error
- func (p *Server) UpdateJob(ctx context.Context, in *proto.UpdateJobRequest) (*proto.UpdateJobResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectResponse ¶ added in v2.2.0
type ConnectResponse struct { Job *proto.AcquiredJob Client sdkproto.DRPCProvisionerClient Error error }
ConnectResponse is the response returned asynchronously from Connector.Connect containing either the Provisioner Client or an Error. The Job is also returned unaltered to disambiguate responses if the respCh is shared among multiple jobs
type Connector ¶ added in v2.2.0
type Connector interface { // Connect to the correct provisioner for the given job. The response is // delivered asynchronously over the respCh. If the provided context expires, // the Connector may stop waiting for the provisioner and return an error // response. Connect(ctx context.Context, job *proto.AcquiredJob, respCh chan<- ConnectResponse) }
Connector allows the provisioner daemon to Connect to a provisioner for the given job.
type Dialer ¶
type Dialer func(ctx context.Context) (proto.DRPCProvisionerDaemonClient, error)
Dialer represents the function to create a daemon client connection.
type LocalProvisioners ¶ added in v2.2.0
type LocalProvisioners map[string]sdkproto.DRPCProvisionerClient
LocalProvisioners is a Connector that stores a static set of in-process provisioners.
func (LocalProvisioners) Connect ¶ added in v2.2.0
func (l LocalProvisioners) Connect(_ context.Context, job *proto.AcquiredJob, respCh chan<- ConnectResponse)
type Metrics ¶
func NewMetrics ¶
func NewMetrics(reg prometheus.Registerer) Metrics
type Options ¶
type Options struct { Logger slog.Logger TracerProvider trace.TracerProvider Metrics *Metrics ExternalProvisioner bool ForceCancelInterval time.Duration UpdateInterval time.Duration LogBufferInterval time.Duration Connector Connector InitConnectionCh chan struct{} // only to be used in tests }
Options provides customizations to the behavior of a provisioner daemon.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) CommitQuota ¶
func (p *Server) CommitQuota(ctx context.Context, in *proto.CommitQuotaRequest) (*proto.CommitQuotaResponse, error)
func (*Server) CompleteJob ¶
func (*Server) Shutdown ¶
Shutdown gracefully exists with the option to cancel the active job. If false, it will wait for the job to complete.
func (*Server) UpdateJob ¶
func (p *Server) UpdateJob(ctx context.Context, in *proto.UpdateJobRequest) (*proto.UpdateJobResponse, error)