deployjob

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRetryable = errors.New("retryable")

ErrRetryable crashes the state machine to preserve state invariant

Functions

This section is empty.

Types

type ApplyResult

type ApplyResult func() (any, error)

type CancelJobRequest

type CancelJobRequest struct {
	Ns      string `json:"namespace"`
	JobId   string `json:"job_id"`
	Service string `json:"service"`

	Reason string `json:"reason"`

	IsBelieve bool      `json:"is_believe"`
	URL       string    `json:"url"`
	CreatedAt time.Time `json:"created_at"`
}

type CancelJobResponse

type CancelJobResponse entity.DeploymentJob

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context) *Client

func (*Client) CancelJob

func (c *Client) CancelJob(ctx context.Context, request entity.CancelJobRequest) (CancelJobResponse, error)

func (*Client) ConfirmRestartService

func (c *Client) ConfirmRestartService(ctx context.Context, request RestartConfirmation) (HostRestartConfirmationResponse, error)

func (*Client) FeedHostConfigurationUpdate

func (c *Client) FeedHostConfigurationUpdate(ctx context.Context, request ConfigurationUpdateRequest) (ConfigurationUpdateResponse, error)

func (*Client) FeedHostRestartServiceUpdate

func (c *Client) FeedHostRestartServiceUpdate(ctx context.Context, request HostRestartServiceUpdateRequest) (HostRestartServiceUpdateResponse, error)

func (*Client) SubmitJob

type Command

type Command string
const (
	TableDeploymentJob     = "deploy_job__deployment_job"
	TableDeploymentSuccess = "deploy_job__deployment_success"

	CommandUserSubmitJob Command = "deployd.user.submit-job"
	CommandUserCancelJob Command = "deployd.user.cancel-job"

	// Host update
	CommandHostConfigurationUpdate Command = "deployd.host.configuration-update"

	// After configured, we wait before immediately continuing
	CommandRestartConfirmation Command = "deployd.restart-confirmation"

	// Update de
	CommandHostRestartServiceUpdate Command = "deployd.host.restart-service-update"
)

type CommandWrapper

type CommandWrapper struct {
	Name  Command `json:"name"`
	Value []byte  `json:"value"`
}

type CommonResponse

type CommonResponse struct {
	TriggerHost string               `json:"trigger_host"`
	Job         entity.DeploymentJob `json:"job"`
	Failed      bool                 `json:"failed,omitempty"`
	FailReason  *string              `json:"fail_reason,omitempty"`
}

type ConfigurationUpdateRequest

type ConfigurationUpdateRequest struct {
	Ns      string `json:"namespace"`
	JobId   string `json:"job_id"`
	Service string `json:"service"`

	HostName     string                         `json:"host_name"`
	Status       entity.HostConfigurationStatus `json:"status"`
	ErrorMessage *string                        `json:"error_message,omitempty"`

	URL       string    `json:"url"`
	UpdatedAt time.Time `json:"updated_at"`
}

type ConfigurationUpdateResponse

type ConfigurationUpdateResponse CommonResponse

type EventAllHostConfigured

type EventAllHostConfigured ConfigurationUpdateResponse

type EventAllServiceRestarted

type EventAllServiceRestarted HostRestartServiceUpdateResponse

type EventDeploymentJobCancelled

type EventDeploymentJobCancelled struct {
	Job entity.DeploymentJob
}

type EventDeploymentJobCreated

type EventDeploymentJobCreated SubmitJobResponse

type EventDeploymentJobFailed

type EventDeploymentJobFailed CommonResponse

type EventDeploymentJobSuccess

type EventDeploymentJobSuccess CommonResponse

type EventHostConfigurationUpdate

type EventHostConfigurationUpdate ConfigurationUpdateResponse

type EventHostConfigured

type EventHostConfigured ConfigurationUpdateResponse

type EventRestartConfirmed

type EventRestartConfirmed HostRestartConfirmationResponse

Lets go deploy

type EventServiceRestartUpdate

type EventServiceRestartUpdate HostRestartServiceUpdateResponse

type HostRestartConfirmationResponse

type HostRestartConfirmationResponse struct {
	Step        int                  `json:"current_step"`
	TargetHost  string               `json:"target_host"`
	Job         entity.DeploymentJob `json:"job"`
	TriggerHost string               `json:"trigger_host"`
	Message     string               `json:"message"`
}

type HostRestartServiceUpdateRequest

type HostRestartServiceUpdateRequest struct {
	Ns      string `json:"namespace"`
	JobId   string `json:"job_id"`
	Service string `json:"service"`

	HostName     string                          `json:"host_name"`
	Status       entity.HostRestartServiceStatus `json:"status"`
	ErrorMessage *string                         `json:"message,omitempty"`

	Order *int `json:"order"`

	URL       string    `json:"url"`
	UpdatedAt time.Time `json:"updated_at"`
}

type HostRestartServiceUpdateResponse

type HostRestartServiceUpdateResponse struct {
	CommonResponse
	Step int `json:"current_step"`
}

type RaftApp added in v0.0.2

type RaftApp struct {
	// contains filtered or unexported fields
}

RaftApp / coordinator

An example to do raft application's composition (aka. inheritance). It extends the existing "ContentApp" implementation with our business logic. If you have multiple, you can use actual composition instead, and then make sure the Raft App lifecycle is executed for each instance

func New

func New(topic notifier.Topic, dbJob *badger.DB) *RaftApp

func (*RaftApp) GetJobLatestUsecase added in v0.0.2

func (m *RaftApp) GetJobLatestUsecase() *mycontent_base.Handler[*entity.DeploymentJob]

func (*RaftApp) GetJobStore added in v0.0.2

func (m *RaftApp) GetJobStore() *mycontent_base.Handler[*entity.DeploymentJob]

func (*RaftApp) GetSuccessfulJobStore added in v0.0.2

func (m *RaftApp) GetSuccessfulJobStore() *mycontent_base.Handler[*entity.DeploymentJobByService]

func (*RaftApp) OnUpdateV2 added in v0.0.2

func (m *RaftApp) OnUpdateV2(ctx context.Context, entry raft.EntryV2) (any, error)

type RestartConfirmation

type RestartConfirmation struct {
	Ns      string `json:"namespace"`
	JobId   string `json:"job_id"`
	Service string `json:"service"`

	Host    string `json:"host"`
	Message string `json:"message"`

	Agent string `json:"agent"` // who confirm it

	URL       string    `json:"url"`
	CreatedAt time.Time `json:"created_at"`
}

type SubmitJobResponse

type SubmitJobResponse struct {
	SubmitJobStatus SubmitJobStatus      `json:"submit_job_status,omitempty"` // Ephemeral field, only populated after job reply
	Job             entity.DeploymentJob `json:"job"`
}

type SubmitJobStatus

type SubmitJobStatus string
const (
	SubmitJobStatusNeedRetry SubmitJobStatus = "NEED_RETRY"
	SubmitJobStatusSuccess   SubmitJobStatus = "SUCCESS"
)

Jump to

Keyboard shortcuts

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