iproto

package
v0.0.0-...-2fa33bc Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 8 Imported by: ? 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

Overview

Package iproto defines API payloads, internal RPC messages, and task configuration schemas.

Index

Constants

View Source
const (
	XTaskName  = "X-Task-Name"
	XTaskState = "X-Task-STATE"
)

Variables

This section is empty.

Functions

func DAGDependencies

func DAGDependencies(routing *SStepRouting) xdag.DependencySpec

DAGDependencies converts a step DAG definition to xdag dependencies.

Types

type ApprovalCallbackConfig

type ApprovalCallbackConfig struct {
	URL      string `json:"url"`
	Approved string `json:"approved"`
	Rejected string `json:"rejected"`
}

ApprovalCallbackConfig defines where and how approval decisions are reported.

type ApprovalConfig

type ApprovalConfig struct {
	Request struct {
		URL     string                    `json:"url"`
		Method  string                    `json:"method"`
		Headers map[string]ApprovalScalar `json:"headers"`
		Query   map[string]ApprovalScalar `json:"query"`
	} `json:"request"`
	Callback ApprovalCallbackConfig `json:"callback"`
}

ApprovalConfig defines the content of an approval step.

type ApprovalCreate

type ApprovalCreate struct {
	ApprovalRequest
	Callback ApprovalCallbackConfig `json:"callback"`
}

ApprovalCreate is the body sent to the external approval platform. Besides the invocation identity it tells the platform where and how to report the decision: POST/PUT Callback.URL with an ApprovalDecision carrying the same identity and one of the two statuses.

type ApprovalDecision

type ApprovalDecision struct {
	ApprovalRequest
	Status string `json:"status"`
}

func DecodeApproval

func DecodeApproval(data []byte) (ApprovalDecision, error)

type ApprovalRequest

type ApprovalRequest struct {
	ID       string `json:"id"`
	TaskName string `json:"task_name"`
	StepName string `json:"step_name"`
}

ApprovalRequest identifies one invocation, not just a task or step name.

type ApprovalScalar

type ApprovalScalar string

ApprovalScalar is a header or query value encoded as text on the wire. Keep numeric literals as text to avoid rounding identifiers larger than an IEEE-754 integer.

func (*ApprovalScalar) UnmarshalJSON

func (s *ApprovalScalar) UnmarshalJSON(raw []byte) error

type MkdirConfig

type MkdirConfig struct {
	Path string `json:"path"`
}

MkdirConfig defines the content of a mkdir step.

type Replay

type Replay struct {
	Date string `json:"date"`
	ID   string `json:"id"`
	Size int64  `json:"size"` // compressed bytes
}

type ReplayList

type ReplayList struct {
	Items   []Replay `json:"items"`
	Total   int64    `json:"total"`
	HasMore bool     `json:"hasMore"`
}

type SEnv

type SEnv struct {
	Name   string `json:"name" yaml:"name" validate:"required"`
	Value  string `json:"value" yaml:"value"`
	Secret bool   `json:"secret,omitzero" yaml:"secret,omitempty"`
}

type SEnvs

type SEnvs []*SEnv

type SFileListRes

type SFileListRes struct {
	Total int       `json:"total" yaml:"total"`
	Files SFilesRes `json:"files" yaml:"files"`
}

type SFileRes

type SFileRes struct {
	Name    string `json:"name" yaml:"name"`
	Path    string `json:"path" yaml:"path"`
	Size    int64  `json:"size" yaml:"size"`
	Mode    string `json:"mode" yaml:"mode"`
	ModTime int64  `json:"modTime" yaml:"modTime"`
	IsDir   bool   `json:"isDir" yaml:"isDir"`
}

type SFilesRes

type SFilesRes []*SFileRes

type SHealthyz

type SHealthyz struct {
	Server string `json:"server" yaml:"server"`
	Client string `json:"client" yaml:"client"`
	State  string `json:"state" yaml:"state"`
}

type SPageReq

type SPageReq struct {
	Page   int64  `json:"page" form:"page" query:"page" yaml:"page"`
	Size   int64  `json:"size" form:"size" query:"size" yaml:"size"`
	Prefix string `json:"prefix" form:"prefix" query:"prefix" yaml:"prefix"`
}

type SPageRes

type SPageRes struct {
	Current int64 `json:"current" yaml:"current"`
	Size    int64 `json:"size" yaml:"size"`
	Total   int64 `json:"total" yaml:"total"`
}

type SRetryPolicy

type SRetryPolicy struct {
	Interval    time.Duration `json:"interval" yaml:"interval" description:"间隔时间" swaggertype:"integer" format:"int64"`
	MaxInterval time.Duration `json:"maxInterval" yaml:"maxInterval" description:"最大间隔时间" swaggertype:"integer" format:"int64"`
	MaxAttempts int64         `json:"maxAttempts" yaml:"maxAttempts" description:"最大尝试次数"`
	Multiplier  float64       `json:"multiplier" yaml:"multiplier" description:"乘数"`
	Jitter      float64       `json:"jitter,omitempty" yaml:"jitter,omitempty" minimum:"0" maximum:"1" description:"重试退避抖动"`
}

type SStepEdge

type SStepEdge struct {
	Step    string `json:"step" yaml:"step"`
	Trigger string `json:"trigger,omitempty" yaml:"trigger,omitempty"`
}

type SStepLogRes

type SStepLogRes struct {
	Timestamp int64  `json:"timestamp" yaml:"timestamp"`
	Line      int64  `json:"line" yaml:"line"`
	Content   string `json:"content" yaml:"content"`
}

type SStepLogsRes

type SStepLogsRes []*SStepLogRes

type SStepOptions

type SStepOptions []byte

SStepOptions holds executor-specific settings as raw JSON. The selected executor validates the keys and values it accepts. For example, xexec accepts shell, and container accepts image, shell, and mounts.

func (SStepOptions) MarshalJSON

func (o SStepOptions) MarshalJSON() ([]byte, error)

MarshalJSON returns the stored JSON, or null if no options are set.

func (SStepOptions) Object

func (o SStepOptions) Object() (gjson.Result, error)

Object returns the options as a JSON object. No options at all is the same as an empty object, so a step that configures nothing needs no special case.

func (*SStepOptions) UnmarshalJSON

func (o *SStepOptions) UnmarshalJSON(data []byte) error

UnmarshalJSON keeps the raw JSON, so the step stores what the client sent rather than a re-encoded copy.

type SStepReq

type SStepReq struct {
	Name        string        `json:"name,omitempty" yaml:"name,omitempty"`
	Desc        string        `json:"desc,omitempty" yaml:"desc,omitempty"`
	Timeout     time.Duration `json:"timeout,omitzero" yaml:"timeout,omitempty" swaggertype:"integer" format:"int64"`
	Routing     *SStepRouting `json:"routing,omitempty" yaml:"routing,omitempty"`
	Env         SEnvs         `json:"env,omitempty" yaml:"env,omitempty"`
	Kind        string        `json:"kind,omitempty" yaml:"kind,omitempty" validate:"required"`
	Options     SStepOptions  `` /* 183-byte string literal not displayed */
	Content     string        `json:"content,omitempty" yaml:"content,omitempty" validate:"required"`
	RetryPolicy *SRetryPolicy `json:"retryPolicy,omitempty" yaml:"retryPolicy,omitempty"`
}

type SStepRes

type SStepRes struct {
	Name        string        `json:"name" yaml:"name"`
	State       string        `json:"state" yaml:"state"`
	Code        int64         `json:"code" yaml:"code"`
	Desc        string        `json:"desc,omitempty" yaml:"desc,omitempty"`
	Timeout     time.Duration `json:"timeout,omitzero" yaml:"timeout,omitempty" swaggertype:"integer" format:"int64"`
	Routing     *SStepRouting `json:"routing,omitempty" yaml:"routing,omitempty"`
	Message     string        `json:"message" yaml:"message"`
	Env         SEnvs         `json:"env,omitempty" yaml:"env,omitempty"`
	Kind        string        `json:"kind,omitempty" yaml:"kind,omitempty"`
	Options     SStepOptions  `` /* 183-byte string literal not displayed */
	Content     string        `json:"content,omitempty" yaml:"content,omitempty"`
	RetryPolicy *SRetryPolicy `json:"retryPolicy,omitempty" yaml:"retryPolicy,omitempty"`
	Time        *STimeRes     `json:"time,omitempty" yaml:"time,omitempty"`
}

type SStepRouting

type SStepRouting struct {
	Edges []SStepEdge `json:"edges,omitempty" yaml:"edges,omitempty"`
	Join  string      `json:"join,omitempty" yaml:"join,omitempty" enums:"all,any"`
	Emit  []string    `json:"emit,omitempty" yaml:"emit,omitempty"`
}

SStepRouting configures labeled edges, their join policy, and labels emitted on success.

type SStepsReq

type SStepsReq []*SStepReq

type SStepsRes

type SStepsRes []*SStepRes

type SSystemConfig

type SSystemConfig struct {
	PoolSize          int           `json:"pool_size"`
	CPUCores          *int          `json:"cpu_cores"`
	CPUUsagePercent   *float64      `json:"cpu_usage_percent"`
	MemoryTotalBytes  *uint64       `json:"memory_total_bytes"`
	MemoryUsedPercent *float64      `json:"memory_used_percent"`
	Disks             []SSystemDisk `json:"disks"`
}

SSystemConfig reports the currently applied worker pool size and local system metrics.

type SSystemDisk

type SSystemDisk struct {
	Device      string   `json:"device"`
	Mountpoint  string   `json:"mountpoint"`
	FSType      string   `json:"fs_type"`
	TotalBytes  *uint64  `json:"total_bytes"`
	UsedBytes   *uint64  `json:"used_bytes"`
	UsedPercent *float64 `json:"used_percent"`
}

type STaskCreateRes

type STaskCreateRes struct {
	Name  string `json:"name" yaml:"name"`
	Count int64  `json:"count,omitempty" yaml:"count,omitempty"`
}

type STaskListDetailRes

type STaskListDetailRes struct {
	Page  *SPageRes `json:"page" yaml:"page"`
	Tasks STasksRes `json:"tasks" yaml:"tasks"`
}

type STaskReq

type STaskReq struct {
	Workdir string        `json:"workdir,omitempty" yaml:"workdir,omitempty"`
	Timeout time.Duration `json:"timeout,omitzero" yaml:"timeout,omitempty" swaggertype:"integer" format:"int64"`
	Cleanup bool          `json:"cleanup,omitempty" yaml:"cleanup,omitempty"`
	Env     SEnvs         `json:"env,omitempty" yaml:"env,omitempty"`
	Step    SStepsReq     `json:"step,omitempty" yaml:"step,omitempty" validate:"required"`
}

type STaskRes

type STaskRes struct {
	Name    string        `json:"name,omitempty" yaml:"name,omitempty"`
	Workdir string        `json:"workdir,omitempty" yaml:"workdir,omitempty"`
	State   string        `json:"state" yaml:"state"`
	Count   int64         `json:"count,omitempty" yaml:"count,omitempty"`
	Timeout time.Duration `json:"timeout,omitzero" yaml:"timeout,omitempty" swaggertype:"integer" format:"int64"`
	Cleanup bool          `json:"cleanup" yaml:"cleanup"`
	Message string        `json:"message" yaml:"message"`
	Env     SEnvs         `json:"env,omitempty" yaml:"env,omitempty"`
	Time    *STimeRes     `json:"time,omitempty" yaml:"time,omitempty"`
}

type STasksRes

type STasksRes []*STaskRes

type STimeRes

type STimeRes struct {
	Start string `json:"start,omitempty" yaml:"start,omitempty"`
	End   string `json:"end,omitempty" yaml:"end,omitempty"`
}

type SVersion

type SVersion struct {
	BuildTime string        `json:"buildTime" yaml:"buildTime"`
	Version   string        `json:"version" yaml:"version"`
	Git       *SVersionGit  `json:"git" yaml:"git"`
	Go        *SVersionGO   `json:"go" yaml:"go"`
	User      *SVersionUser `json:"user" yaml:"user"`
}

type SVersionGO

type SVersionGO struct {
	Arch    string `json:"arch" yaml:"arch"`
	OS      string `json:"os" yaml:"os"`
	Version string `json:"version" yaml:"version"`
}

type SVersionGit

type SVersionGit struct {
	Branch string `json:"branch" yaml:"branch"`
	Commit string `json:"commit" yaml:"commit"`
	URL    string `json:"url" yaml:"url"`
}

type SVersionUser

type SVersionUser struct {
	Email string `json:"email" yaml:"email"`
	Name  string `json:"name" yaml:"name"`
}

type TaskControl

type TaskControl struct {
	Name     string
	ID       uuid.UUID
	Step     string
	Action   string
	Duration string
}

TaskControl targets a specific run, not a replacement task with the same name.

type TaskSubmission

type TaskSubmission struct {
	Name string
	ID   uuid.UUID
}

TaskSubmission identifies the persisted run to enqueue for execution.

type TouchConfig

type TouchConfig struct {
	Path      string `json:"path"`
	Overwrite bool   `json:"overwrite"`
	Content   string `json:"content"`
}

TouchConfig defines the content of a touch step.

type WebShellSession

type WebShellSession struct {
	ID         string    `json:"id"`
	Connected  time.Time `json:"connectedAt"`
	RemoteAddr string    `json:"remoteAddr,omitempty"`
}

type WorkerPoolMessage

type WorkerPoolMessage struct {
	Size int `json:"size"`
}

func (WorkerPoolMessage) Validate

func (m WorkerPoolMessage) Validate() error

type WorkerPoolSizeQuery

type WorkerPoolSizeQuery struct{}

WorkerPoolSizeQuery requests the currently applied pool size.

Jump to

Keyboard shortcuts

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