Documentation
¶
Index ¶
- Constants
- func DecodeSubmission(value string) (storage.CommitSubmission, error)
- func EncodeSubmission(submission storage.CommitSubmission) (string, error)
- type AddPiecesStatusChecker
- type AdvanceInput
- type AdvanceResult
- type AdvanceState
- type Advancer
- func (a *Advancer) Advance(ctx context.Context, input AdvanceInput) (AdvanceResult, error)
- func (a *Advancer) AdvanceUnavailable(ctx context.Context, copyRow model.StorageUploadCopy, ...) (AdvanceResult, error)
- func (a *Advancer) ReleaseTerminalReservation(ctx context.Context, copyRow model.StorageUploadCopy, ...) (AdvanceResult, error)
- type AttemptInput
- type AttemptResult
- type AttentionCode
- type AttentionInput
- type AttentionRecord
- type CopyIdentity
- type EvidenceInput
- type ManualReleaseInput
- type ReleaseInput
- type ReleaseReason
- type ReservationReleaseInput
- type ReservationState
- type ReserveInput
- type ReserveResult
- type ResetInput
- type Store
Constants ¶
View Source
const ( DefaultRequestTimeout = 15 * time.Second DefaultAttentionAfter = 15 * time.Minute )
View Source
const MaxActiveAttemptsPerDataSet = 4
Variables ¶
This section is empty.
Functions ¶
func DecodeSubmission ¶
func DecodeSubmission(value string) (storage.CommitSubmission, error)
func EncodeSubmission ¶
func EncodeSubmission(submission storage.CommitSubmission) (string, error)
Types ¶
type AddPiecesStatusChecker ¶
type AddPiecesStatusChecker interface {
GetAddPiecesStatus(context.Context, synapse.AddPiecesStatusInput) (synapse.PDPStatusResult, error)
}
type AdvanceInput ¶
type AdvanceInput struct {
Copy model.StorageUploadCopy
Binding model.StorageDataSet
Target synapse.DataSetTarget
Pieces []storage.PieceInput
RequireEligibleCopy bool
OwnerTerminal bool
}
type AdvanceResult ¶
type AdvanceResult struct {
State AdvanceState
ReleaseReason ReleaseReason
AttemptID string
Confirmation *storage.CommitResult
AttentionCode AttentionCode
Continue bool
// Cause carries the provider error behind a release so the caller can record
// why the data set failed instead of a generic sentinel. It is set only on
// ReleaseDataSetUnavailable and is nil everywhere else.
Cause error
// AttentionHeld carries the reservation's flagged-attempt count so the caller
// can say why capacity is unavailable. It is set only on
// AdvanceWaitingCapacity and is zero everywhere else.
AttentionHeld int
}
type AdvanceState ¶
type AdvanceState string
const ( AdvanceWaitingCapacity AdvanceState = "waiting_capacity" AdvanceSubmitted AdvanceState = "submitted" AdvancePending AdvanceState = "pending" AdvanceReleased AdvanceState = "released" AdvanceConfirmed AdvanceState = "confirmed" AdvanceRejected AdvanceState = "rejected" AdvanceNeedsAttention AdvanceState = "needs_attention" )
type Advancer ¶
type Advancer struct {
Store Store
StatusChecker AddPiecesStatusChecker
RequestTimeout time.Duration
AttentionAfter time.Duration
Now func() time.Time
}
func (*Advancer) Advance ¶
func (a *Advancer) Advance(ctx context.Context, input AdvanceInput) (AdvanceResult, error)
func (*Advancer) AdvanceUnavailable ¶
func (a *Advancer) AdvanceUnavailable( ctx context.Context, copyRow model.StorageUploadCopy, binding model.StorageDataSet, ) (AdvanceResult, error)
AdvanceUnavailable records an attempted commit whose provider context could not be reconstructed. It never submits or confirms provider work.
func (*Advancer) ReleaseTerminalReservation ¶
func (a *Advancer) ReleaseTerminalReservation( ctx context.Context, copyRow model.StorageUploadCopy, binding model.StorageDataSet, ) (AdvanceResult, error)
ReleaseTerminalReservation releases an unattempted reservation whose owner is terminal without requiring a provider context.
type AttemptInput ¶
type AttemptInput struct {
Copy CopyIdentity
AttemptID string
ExtraDataHex string
Now time.Time
}
type AttemptResult ¶
type AttemptResult struct {
Entered bool
Copy model.StorageUploadCopy
}
type AttentionCode ¶
type AttentionCode string
AttentionCode identifies a durable commit that needs operator review.
const ( AttentionAttemptOnlyAmbiguous AttentionCode = "attempt_only_ambiguous" AttentionUnattributedPiece AttentionCode = "unattributed_piece" AttentionInvalidSubmission AttentionCode = "invalid_submission" AttentionSubmissionMismatch AttentionCode = "submission_mismatch" AttentionConfirmationTimeout AttentionCode = "confirmation_timeout" )
func ParseAttentionCode ¶
func ParseAttentionCode(value string) (AttentionCode, error)
func (AttentionCode) Valid ¶
func (c AttentionCode) Valid() bool
type AttentionInput ¶
type AttentionInput struct {
Copy CopyIdentity
AttemptID string
Code AttentionCode
Now time.Time
}
type AttentionRecord ¶
type CopyIdentity ¶
type EvidenceInput ¶
type ManualReleaseInput ¶
type ReleaseInput ¶
type ReleaseReason ¶
type ReleaseReason string
const ( ReleaseBeforeSubmitCanceled ReleaseReason = "before_submit_canceled" ReleaseOwnerTerminal ReleaseReason = "owner_terminal" )
type ReservationReleaseInput ¶
type ReservationReleaseInput struct {
Copy CopyIdentity
ClearReadyAt bool
ClearExtraData bool
Now time.Time
}
type ReservationState ¶
type ReservationState string
const ( ReservationAcquired ReservationState = "acquired" ReservationWaiting ReservationState = "waiting" )
type ReserveInput ¶
type ReserveInput struct {
Copy CopyIdentity
AttemptID string
Now time.Time
}
type ReserveResult ¶
type ReserveResult struct {
State ReservationState
Copy model.StorageUploadCopy
// AttentionHeld counts the data set's active attempts already flagged for
// operator attention. It is set only when capacity turned the reservation
// away, so a waiting result with zero here is queued behind work that is
// still moving.
AttentionHeld int
}
type ResetInput ¶
type ResetInput struct {
Copy CopyIdentity
AttemptID string
LastError string
Now time.Time
}
type Store ¶
type Store interface {
ReserveCommitAttempt(context.Context, ReserveInput) (ReserveResult, error)
MarkCommitAttempted(context.Context, AttemptInput) (AttemptResult, error)
RecordCommitTransaction(context.Context, EvidenceInput) error
RecordCommitSubmission(context.Context, EvidenceInput) error
MarkCommitAttention(context.Context, AttentionInput) error
ResetCommitAttempt(context.Context, ResetInput) error
ReleaseCommitAttempt(context.Context, ReleaseInput) error
ReleaseCommitReservation(context.Context, ReservationReleaseInput) error
}
Click to show internal directories.
Click to hide internal directories.