Documentation
¶
Overview ¶
Package lockedcallbacks provides locking per-key.
Index ¶
- Variables
- type Mstate
- type StatesMap
- func (m *StatesMap) BuildAllowFlagsCallbackFunc(safeTmplUUID string, wrapperFunc func(any, func(string) string) any) func(data any) any
- func (m *StatesMap) BuildTextTemplateRemediationFunc(safeTmplUUID string, wrapperFunc func(any, func(string) string) any) func(any) any
- func (m *StatesMap) SetAndExecuteWithCallback(tmpl *template.Template, safeTmplUUID string, cb func(string) string, ...) error
- func (m *StatesMap) SetAndExecuteWithShCallback(tmpl *template.Template, safeTmplUUID string, cb func(string) string, ...) error
Constants ¶
This section is empty.
Variables ¶
var ErrStateKeyNotFound error = errors.New("Unlock requested for an unknown state")
ErrStateKeyNotFound indicates the requested key was not found in the map of states
Functions ¶
This section is empty.
Types ¶
type Mstate ¶
type Mstate struct {
Callback func(string) string // points to the callback to protect
AllowFlagsCallback func(string) string // points to the allowflags callback to protect
// contains filtered or unexported fields
}
Mstate is used to represent entries of StatesMap each entry (Mstate) holds a callback. A mutex is protecting changes to the callback The key and statesmap attributes are used to provide self-cleaning of the entries once a state does not need to be maintained.
type StatesMap ¶
type StatesMap struct {
States map[any]*Mstate // contains states for each template
// contains filtered or unexported fields
}
StatesMap wraps a map of Mstate. Each key locks separately.
func (*StatesMap) BuildAllowFlagsCallbackFunc ¶
func (m *StatesMap) BuildAllowFlagsCallbackFunc(safeTmplUUID string, wrapperFunc func(any, func(string) string) any) func(data any) any
BuildAllowFlagsCallbackFunc creates a virtual method calling the template's allowFlags callback.
func (*StatesMap) BuildTextTemplateRemediationFunc ¶
func (m *StatesMap) BuildTextTemplateRemediationFunc(safeTmplUUID string, wrapperFunc func(any, func(string) string) any) func(any) any
BuildTextTemplateRemediationFunc creates a virtual method calling the template's callback.
func (*StatesMap) SetAndExecuteWithCallback ¶
func (m *StatesMap) SetAndExecuteWithCallback(tmpl *template.Template, safeTmplUUID string, cb func(string) string, result io.Writer, data any) error
SetAndExecuteWithCallback hides implementation details of the StatesMap by taking a template and a callback to set the proper callback and execute the template.
func (*StatesMap) SetAndExecuteWithShCallback ¶
func (m *StatesMap) SetAndExecuteWithShCallback(tmpl *template.Template, safeTmplUUID string, cb func(string) string, allowFlagsCb func(string) string, result io.Writer, data any) error
SetAndExecuteWithShCallback hides implementation details of the StatesMap by taking a template and both callbacks to set the proper callback and execute the template.