Documentation ¶
Overview ¶
Package state defines the model for a Run state.
Index ¶
- type RunState
- func (rs *RunState) CheckTree(ctx context.Context, tc tree.Client) (bool, error)
- func (rs *RunState) CloneSubmission()
- func (rs *RunState) DeepCopy() *RunState
- func (rs *RunState) EnqueueLongOp(op *run.OngoingLongOps_Op) string
- func (rs *RunState) LogInfo(ctx context.Context, label, message string)
- func (rs *RunState) LogInfoAt(at time.Time, label, message string)
- func (rs *RunState) LogInfof(ctx context.Context, label, format string, args ...any)
- func (rs *RunState) LogInfofAt(at time.Time, label, format string, args ...any)
- func (rs *RunState) RemoveCompletedLongOp(opID string)
- func (rs *RunState) RequestLongOpCancellation(opID string)
- func (rs *RunState) ShallowCopy() *RunState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RunState ¶
type RunState struct { run.Run LogEntries []*run.LogEntry // NewLongOpIDs which should be scheduled transactionally with the state // transition. NewLongOpIDs []string // SubmissionScheduled is true if a submission will be attempted after state // transition completes. SubmissionScheduled bool }
RunState represents the current state of a Run.
func (*RunState) CheckTree ¶
CheckTree returns whether Tree is open for this Run.
Returns true if no Tree or Options.SkipTreeChecks is configured for this Run. Updates the latest result to `rs.Submission`. In case fetching the status results in error for the first time, it records the time in the appropriate field in Submission. Records a new LogEntry.
func (*RunState) CloneSubmission ¶
func (rs *RunState) CloneSubmission()
CloneSubmission clones the `Submission` property.
Initializes the property if this is nil.
func (*RunState) DeepCopy ¶
DeepCopy returns a deep copy of this RunState.
This is an expensive operation. It should only be called in tests.
func (*RunState) EnqueueLongOp ¶
func (rs *RunState) EnqueueLongOp(op *run.OngoingLongOps_Op) string
EnqueueLongOp adds a new long op to the Run state and returns its ID.
The actual long operation will be scheduled transactioncally with the Run mutation.
func (*RunState) LogInfo ¶
LogInfo adds a generic LogEntry visible in debug UI as is.
Don't use for adding a complicated info formatted into the message string, use a specialized LogEntry type instead.
func (*RunState) LogInfof ¶
LogInfof is like LogInfo but formats the message according to format specifier.
func (*RunState) LogInfofAt ¶
LogInfofAt is like LogInfoAt but formats the message according to format specifier.
func (*RunState) RemoveCompletedLongOp ¶
RemoveCompletedLongOp removes long op from the ongoing ones.
func (*RunState) RequestLongOpCancellation ¶
RequestLongOpCancellation records soft request to cancel a long running op.
This request is asynchronous but it's stored in the Run state.
func (*RunState) ShallowCopy ¶
ShallowCopy returns a shallow copy of this RunState.