mirror of
https://github.com/zrepl/zrepl.git
synced 2024-12-23 23:48:55 +01:00
b2844569c8
* Remove explicity state machine code for all but replication.Replication * Introduce explicit error types that satisfy interfaces which provide sufficient information for replication.Replication to make intelligent retry + queuing decisions * Temporary() * LocalToFS() * Remove the queue and replace it with a simple array that we sort each time (yay no generics :( )
62 lines
1.4 KiB
Go
62 lines
1.4 KiB
Go
// Code generated by "enumer -type=StepState"; DO NOT EDIT.
|
|
|
|
package fsrep
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
const (
|
|
_StepStateName_0 = "StepReplicationReadyStepMarkReplicatedReady"
|
|
_StepStateName_1 = "StepCompleted"
|
|
)
|
|
|
|
var (
|
|
_StepStateIndex_0 = [...]uint8{0, 20, 43}
|
|
_StepStateIndex_1 = [...]uint8{0, 13}
|
|
)
|
|
|
|
func (i StepState) String() string {
|
|
switch {
|
|
case 1 <= i && i <= 2:
|
|
i -= 1
|
|
return _StepStateName_0[_StepStateIndex_0[i]:_StepStateIndex_0[i+1]]
|
|
case i == 4:
|
|
return _StepStateName_1
|
|
default:
|
|
return fmt.Sprintf("StepState(%d)", i)
|
|
}
|
|
}
|
|
|
|
var _StepStateValues = []StepState{1, 2, 4}
|
|
|
|
var _StepStateNameToValueMap = map[string]StepState{
|
|
_StepStateName_0[0:20]: 1,
|
|
_StepStateName_0[20:43]: 2,
|
|
_StepStateName_1[0:13]: 4,
|
|
}
|
|
|
|
// StepStateString retrieves an enum value from the enum constants string name.
|
|
// Throws an error if the param is not part of the enum.
|
|
func StepStateString(s string) (StepState, error) {
|
|
if val, ok := _StepStateNameToValueMap[s]; ok {
|
|
return val, nil
|
|
}
|
|
return 0, fmt.Errorf("%s does not belong to StepState values", s)
|
|
}
|
|
|
|
// StepStateValues returns all values of the enum
|
|
func StepStateValues() []StepState {
|
|
return _StepStateValues
|
|
}
|
|
|
|
// IsAStepState returns "true" if the value is listed in the enum definition. "false" otherwise
|
|
func (i StepState) IsAStepState() bool {
|
|
for _, v := range _StepStateValues {
|
|
if i == v {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|