Documentation
¶
Index ¶
- type ErrorDefinition
- type FileCreator
- func (creator *FileCreator) AddErrorToRetryOn(definition *ErrorDefinition)
- func (creator *FileCreator) AddLine(sectionID string, errorHandlers []*LineErrorHandler, items ...string)
- func (creator *FileCreator) RunCommandOnceWithFile(cmd string, args ...string) (bool, error)
- func (creator *FileCreator) RunCommandWithFile(cmd string, args ...string) error
- func (creator *FileCreator) ToString() string
- type Line
- type LineErrorHandler
- type LineErrorHandlerMethod
- type Section
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorDefinition ¶
type ErrorDefinition struct {
// contains filtered or unexported fields
}
ErrorDefinition defines an error by a regular expression and its error code.
func NewErrorDefinition ¶
func NewErrorDefinition(pattern string) *ErrorDefinition
type FileCreator ¶
type FileCreator struct {
// contains filtered or unexported fields
}
FileCreator is a tool for: - building a buffer file - running a command with the file - handling errors in the file
func NewFileCreator ¶
func NewFileCreator(ioShim *common.IOShim, maxTryCount int, lineFailurePatterns ...string) *FileCreator
func (*FileCreator) AddErrorToRetryOn ¶
func (creator *FileCreator) AddErrorToRetryOn(definition *ErrorDefinition)
func (*FileCreator) AddLine ¶
func (creator *FileCreator) AddLine(sectionID string, errorHandlers []*LineErrorHandler, items ...string)
func (*FileCreator) RunCommandOnceWithFile ¶
func (creator *FileCreator) RunCommandOnceWithFile(cmd string, args ...string) (bool, error)
RunCommandOnceWithFile runs the command with the file once and increments the try count. It returns whether the file was altered and any error. For automatic retrying and proper logging, use RunCommandWithFile. This method can be used for external testing of file creator contents after each run.
func (*FileCreator) RunCommandWithFile ¶
func (creator *FileCreator) RunCommandWithFile(cmd string, args ...string) error
func (*FileCreator) ToString ¶
func (creator *FileCreator) ToString() string
ToString combines the lines in the FileCreator and ends with a new line.
type Line ¶
type Line struct {
// contains filtered or unexported fields
}
Line defines the content, section, and error handlers for a line
type LineErrorHandler ¶
type LineErrorHandler struct { Definition *ErrorDefinition Method LineErrorHandlerMethod Reason string Callback func() }
LineErrorHandler defines an error and how to handle it
type LineErrorHandlerMethod ¶
type LineErrorHandlerMethod string
LineErrorHandlerMethod defines behavior when an error occurs
const ( SkipLine LineErrorHandlerMethod = "skip" AbortSection LineErrorHandlerMethod = "abort" )
possible LineErrorHandlerMethod