Documentation
¶
Overview ¶
Package state stores local-only skeeper operational state.
Index ¶
- type Bypass
- type Store
- func (s *Store) Abort(ctx context.Context, id string) error
- func (s *Store) Begin(ctx context.Context, tx Transaction) error
- func (s *Store) Bypass(ctx context.Context) (Bypass, bool, error)
- func (s *Store) ClearBypass(ctx context.Context) error
- func (s *Store) Complete(ctx context.Context, id string) error
- func (s *Store) Current(ctx context.Context) (Transaction, bool, error)
- func (s *Store) MarkPhase(ctx context.Context, id string, phase TransactionPhase) error
- func (s *Store) RecordBypass(ctx context.Context, bypass Bypass) error
- type Transaction
- type TransactionPhase
- type TransactionStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bypass ¶ added in v0.2.0
type Bypass struct {
Time time.Time `json:"time"`
Env string `json:"env"`
MainSHA string `json:"main_sha"`
Reason string `json:"reason"`
}
Bypass records an audited strict-hook bypass.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store manages local transaction and bypass journals under .git/skeeper.
func (*Store) Begin ¶ added in v0.2.0
func (s *Store) Begin(ctx context.Context, tx Transaction) error
Begin stores a new active transaction and rejects concurrent transactions.
func (*Store) ClearBypass ¶ added in v0.2.0
ClearBypass removes the bypass journal.
type Transaction ¶ added in v0.2.0
type Transaction struct {
ID string `json:"id"`
Kind string `json:"kind"`
Phase TransactionPhase `json:"phase"`
Root string `json:"root"`
Targets []string `json:"targets,omitempty"`
Namespaces []string `json:"namespaces,omitempty"`
MainIndexMutated bool `json:"main_index_mutated"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Transaction records a resumable multi-step operation.
type TransactionPhase ¶ added in v0.2.0
type TransactionPhase string
TransactionPhase identifies a durable mutating operation phase.
const ( // TransactionPhasePlanned records a plan before side effects. TransactionPhasePlanned TransactionPhase = "planned" // TransactionPhaseSidecarPushed records that sidecar content is durable remotely. TransactionPhaseSidecarPushed TransactionPhase = "sidecar_pushed" // TransactionPhaseMainIndexMutated records that the main Git index was mutated. TransactionPhaseMainIndexMutated TransactionPhase = "main_index_mutated" // TransactionPhaseLockStaged records that skeeper.lock was written and staged. TransactionPhaseLockStaged TransactionPhase = "lock_staged" )
func (TransactionPhase) Valid ¶ added in v0.2.0
func (p TransactionPhase) Valid() bool
Valid reports whether phase is part of the transaction state machine.
type TransactionStore ¶ added in v0.2.0
type TransactionStore interface {
Begin(ctx context.Context, tx Transaction) error
Current(ctx context.Context) (Transaction, bool, error)
MarkPhase(ctx context.Context, id string, phase TransactionPhase) error
Complete(ctx context.Context, id string) error
Abort(ctx context.Context, id string) error
}
TransactionStore persists active transaction state.
Click to show internal directories.
Click to hide internal directories.