Help us shape the future of Go! Take the 2026 Go Developer Survey

runtimeoperation

package
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("runtime operation not found")

Functions

This section is empty.

Types

type Executor

type Executor interface {
	Execute(context.Context, Request) (Result, error)
}

type ExecutorFunc

type ExecutorFunc func(context.Context, Request) (Result, error)

func (ExecutorFunc) Execute

func (f ExecutorFunc) Execute(ctx context.Context, request Request) (Result, error)

type Manager

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

func New

func New(dir string, executors map[string]Executor) (*Manager, error)

func (*Manager) FindResource

func (m *Manager) FindResource(resourceID string) (Request, error)

func (*Manager) Get

func (m *Manager) Get(id string) (Operation, error)

func (*Manager) Resume

func (m *Manager) Resume(ctx context.Context) error

func (*Manager) Submit

func (m *Manager) Submit(ctx context.Context, request Request) (Operation, bool, error)

type Operation

type Operation struct {
	ID        string    `json:"id"`
	Request   Request   `json:"request"`
	State     State     `json:"state"`
	Result    Result    `json:"result,omitempty"`
	Error     string    `json:"error,omitempty"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type Request

type Request struct {
	Application    string         `json:"application"`
	CallerService  string         `json:"caller_service,omitempty"`
	Capability     string         `json:"capability"`
	Operation      string         `json:"operation"`
	ResourceName   string         `json:"resource_name"`
	IdempotencyKey string         `json:"idempotency_key"`
	Parameters     map[string]any `json:"parameters,omitempty"`
}

type Result

type Result struct {
	ResourceID string         `json:"resource_id,omitempty"`
	Binding    map[string]any `json:"binding,omitempty"`
}

type State

type State string
const (
	StatePending   State = "pending"
	StateRunning   State = "running"
	StateSucceeded State = "succeeded"
	StateFailed    State = "failed"
)

Jump to

Keyboard shortcuts

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