Documentation
¶
Overview ¶
Package control provides atomic flag registries and helpers for job state and security flags.
Package control defines the stages of log entry processing.
Package control - job state machine baseada em bitflags para uso interno no pipeline do logger / manager.
Index ¶
- Constants
- type FlagReg32
- func (r *FlagReg32[T]) All(mask T) bool
- func (r *FlagReg32[T]) Any(mask T) bool
- func (r *FlagReg32[T]) Clear(mask T)
- func (r *FlagReg32[T]) CompareAndSwap(old, new T) bool
- func (r *FlagReg32[T]) Has(mask T) bool
- func (r *FlagReg32[T]) Load() T
- func (r *FlagReg32[T]) Set(mask T)
- func (r *FlagReg32[T]) Store(val T)
- type FlagReg32A
- type JobFlag
- type JobState
- type ManagerControl
- type ManagerState
- func (r *ManagerState) All(mask ctl.JobFlag) bool
- func (r *ManagerState) Any(mask ctl.JobFlag) bool
- func (r *ManagerState) Clear(mask ctl.JobFlag)
- func (r *ManagerState) Load() ctl.JobFlag
- func (r *ManagerState) Set(mask ctl.JobFlag)
- func (r *ManagerState) SetIf(clearMask, setMask ctl.JobFlag) bool
- func (r *ManagerState) Store(val ctl.JobFlag)
- type SecFlag
- type StageReg32
Constants ¶
const ( StepValidate ctl.JobFlag = 1 << iota StepPreHooks StepFormat StepPostHooks StepWrite StepDone StepFailed )
const (
StepTerminal = StepDone | StepFailed
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FlagReg32 ¶
type FlagReg32[T ~uint32] struct { // contains filtered or unexported fields }
FlagReg32 é um registrador genérico baseado em uint32 com operações atômicas para trabalhar com bitflags (T deve ser ~uint32).
func NewFlagReg32 ¶
NewFlagReg32 cria um registrador novo, com valor inicial 0.
func (*FlagReg32[T]) Clear ¶
func (r *FlagReg32[T]) Clear(mask T)
Clear faz AND-NOT bitwise com a máscara, de forma atômica.
func (*FlagReg32[T]) CompareAndSwap ¶
CompareAndSwap executa um CAS no valor inteiro do registrador.
type FlagReg32A ¶
Alias de compatibilidade: se em algum lugar você usou FlagReg32A/ NewFlagReg32A, continua funcionando sem quebrar nada.
func NewFlagReg32A ¶
func NewFlagReg32A[T ~uint32]() *FlagReg32A[T]
type JobState ¶
type JobState struct {
// contains filtered or unexported fields
}
JobState encapsula a evolução do job via bitflags, usando FlagReg32[JobFlag].
func NewJobState ¶
func NewJobState() *JobState
NewJobState cria um JobState novo, iniciando em zero (sem flags).
func (*JobState) Complete ¶
Complete: marca Completed e limpa Running/Retrying/CancelRequested. Se já terminal, retorna ErrTerminal.
func (*JobState) IsTerminal ¶
IsTerminal retorna true se o job já atingiu um estado terminal (Completed, Failed ou TimedOut).
func (*JobState) RequestCancel ¶
func (s *JobState) RequestCancel()
RequestCancel seta o flag de cancelamento solicitado.
type ManagerControl ¶
type ManagerControl struct {
Stage ManagerState
State ManagerState
}
func NewManagerControl ¶
func NewManagerControl() *ManagerControl
type ManagerState ¶
type ManagerState struct {
// contains filtered or unexported fields
}
func (*ManagerState) Clear ¶
func (r *ManagerState) Clear(mask ctl.JobFlag)
func (*ManagerState) Load ¶
func (r *ManagerState) Load() ctl.JobFlag
func (*ManagerState) Set ¶
func (r *ManagerState) Set(mask ctl.JobFlag)
func (*ManagerState) Store ¶
func (r *ManagerState) Store(val ctl.JobFlag)
type SecFlag ¶
type SecFlag uint32
SecFlag representa opções de segurança aplicáveis a uma rota, handler, etc.
func FromLegacyMap ¶
FromLegacyMap converte mapa legado (ex: de config JSON) para flags. Mantém compat com chaves antigas: "validateAndSanitize", "validateAndSanitizeBody".
type StageReg32 ¶
type StageReg32 struct {
// contains filtered or unexported fields
}
func NewStageReg32 ¶
func NewStageReg32() *StageReg32