zrepl/endpoint/replicationguaranteekind_enumer.go
Christian Schwarz 30cdc1430e replication + endpoint: replication guarantees: guarantee_{resumability,incremental,nothing}
This commit

- adds a configuration in which no step holds, replication cursors, etc. are created
- removes the send.step_holds.disable_incremental setting
- creates a new config option `replication` for active-side jobs
- adds the replication.protection.{initial,incremental} settings, each
  of which can have values
    - `guarantee_resumability`
    - `guarantee_incremental`
    - `guarantee_nothing`
  (refer to docs/configuration/replication.rst for semantics)

The `replication` config from an active side is sent to both endpoint.Sender and endpoint.Receiver
for each replication step. Sender and Receiver then act accordingly.

For `guarantee_incremental`, we add the new `tentative-replication-cursor` abstraction.
The necessity for that abstraction is outlined in https://github.com/zrepl/zrepl/issues/340.

fixes https://github.com/zrepl/zrepl/issues/340
2020-07-26 20:32:35 +02:00

81 lines
2.4 KiB
Go

// Code generated by "enumer -type=ReplicationGuaranteeKind -json -transform=snake -trimprefix=ReplicationGuaranteeKind"; DO NOT EDIT.
//
package endpoint
import (
"encoding/json"
"fmt"
)
const (
_ReplicationGuaranteeKindName_0 = "resumabilityincremental"
_ReplicationGuaranteeKindName_1 = "none"
)
var (
_ReplicationGuaranteeKindIndex_0 = [...]uint8{0, 12, 23}
_ReplicationGuaranteeKindIndex_1 = [...]uint8{0, 4}
)
func (i ReplicationGuaranteeKind) String() string {
switch {
case 1 <= i && i <= 2:
i -= 1
return _ReplicationGuaranteeKindName_0[_ReplicationGuaranteeKindIndex_0[i]:_ReplicationGuaranteeKindIndex_0[i+1]]
case i == 4:
return _ReplicationGuaranteeKindName_1
default:
return fmt.Sprintf("ReplicationGuaranteeKind(%d)", i)
}
}
var _ReplicationGuaranteeKindValues = []ReplicationGuaranteeKind{1, 2, 4}
var _ReplicationGuaranteeKindNameToValueMap = map[string]ReplicationGuaranteeKind{
_ReplicationGuaranteeKindName_0[0:12]: 1,
_ReplicationGuaranteeKindName_0[12:23]: 2,
_ReplicationGuaranteeKindName_1[0:4]: 4,
}
// ReplicationGuaranteeKindString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func ReplicationGuaranteeKindString(s string) (ReplicationGuaranteeKind, error) {
if val, ok := _ReplicationGuaranteeKindNameToValueMap[s]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to ReplicationGuaranteeKind values", s)
}
// ReplicationGuaranteeKindValues returns all values of the enum
func ReplicationGuaranteeKindValues() []ReplicationGuaranteeKind {
return _ReplicationGuaranteeKindValues
}
// IsAReplicationGuaranteeKind returns "true" if the value is listed in the enum definition. "false" otherwise
func (i ReplicationGuaranteeKind) IsAReplicationGuaranteeKind() bool {
for _, v := range _ReplicationGuaranteeKindValues {
if i == v {
return true
}
}
return false
}
// MarshalJSON implements the json.Marshaler interface for ReplicationGuaranteeKind
func (i ReplicationGuaranteeKind) MarshalJSON() ([]byte, error) {
return json.Marshal(i.String())
}
// UnmarshalJSON implements the json.Unmarshaler interface for ReplicationGuaranteeKind
func (i *ReplicationGuaranteeKind) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
return fmt.Errorf("ReplicationGuaranteeKind should be a string, got %s", data)
}
var err error
*i, err = ReplicationGuaranteeKindString(s)
return err
}