gateio

package
v0.10.257 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package gateio maps provider/ledger state into the pure gate kernel.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcquireFunc

type AcquireFunc func(string) (Lock, error)

AcquireFunc acquires one non-blocking run lock.

type Lock

type Lock interface {
	Release() error
}

Lock is a held run lock.

type Options

type Options struct {
	Store                   Store
	Provider                outbox.LiveProvider
	Limiter                 outbox.Limiter
	Layout                  statepaths.Layout
	Acquire                 AcquireFunc
	Now                     func() time.Time
	StaleHeartbeatThreshold time.Duration
	Warnings                io.Writer
	ApprovalOverride        approvaloverride.Classifier
}

Options contains gate IO dependencies.

type Request

type Request struct {
	PRRef                           gitprovider.PRRef
	PR                              gitprovider.PR
	PRKey                           string
	Profile                         string
	PostingIdentity                 gitprovider.Identity
	PostingIdentityKey              string
	ResolveThreadPermissionAdvisory bool
	FreshRunID                      string
	Flags                           gate.Flags
	ArtifactPath                    string
}

Request identifies one gate evaluation.

type Result

type Result struct {
	Status       Status
	Decision     gate.Decision
	Run          ledger.Run
	Lock         Lock
	OutboxResult outbox.Result
	Warnings     []string
}

Result is the outcome of one gate IO evaluation.

func AbortIfBaseMoved

func AbortIfBaseMoved(ctx context.Context, opts Options, req Request, run ledger.Run) (Result, error)

AbortIfBaseMoved aborts run when the PR base ref no longer matches run.BaseSHA.

func Evaluate

func Evaluate(ctx context.Context, opts Options, req Request) (Result, error)

Evaluate acquires live gate state, calls the pure kernel, and executes non-repair decisions.

type Status

type Status string

Status identifies how gate IO resolved the request.

const (
	StatusContinue           Status = "continue"
	StatusEarlyExit          Status = "early_exit"
	StatusDryRunFresh        Status = "dry_run_fresh"
	StatusRepairExecuted     Status = "repair_executed"
	StatusRetryPostsExecuted Status = "retry_posts_executed"
	StatusApprovalOverride   Status = "approval_override_executed"
	StatusError              Status = "error"
	StatusBaseMovedAbort     Status = "base_moved_abort"
)

Result status values.

type Store

type Store interface {
	ListRunsForHeadScope(context.Context, ledger.ListRunsForHeadScopeParams) ([]ledger.Run, error)
	GetRun(context.Context, string) (ledger.Run, error)
	ListPlannedActions(context.Context, string) ([]ledger.PlannedAction, error)
	AllocateRun(context.Context, ledger.AllocateRunParams) (ledger.Run, error)
	InsertPlannedAction(context.Context, ledger.PlannedAction) error
	UpdatePlannedAction(context.Context, ledger.PlannedAction) error
	DeleteRun(context.Context, string) error
	CompleteRun(context.Context, string, ledger.Outcome, time.Time) error
}

Store is the ledger behavior required by gate IO.

Jump to

Keyboard shortcuts

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