github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/coordination/config.go (about)

     1  package coordination
     2  
     3  import "github.com/ydb-platform/ydb-go-genproto/protos/Ydb_Coordination"
     4  
     5  type ConsistencyMode uint
     6  
     7  const (
     8  	ConsistencyModeUnset ConsistencyMode = iota
     9  	ConsistencyModeStrict
    10  	ConsistencyModeRelaxed
    11  
    12  	consistencyAggregated = "Aggregated"
    13  	consistencyDetailed   = "Detailed"
    14  	consistencyRelaxed    = "Relaxed"
    15  	consistencyStrict     = "Strict"
    16  	consistencyUnknown    = "Unknown"
    17  	consistencyUnset      = "Unset"
    18  )
    19  
    20  func (t ConsistencyMode) String() string {
    21  	switch t {
    22  	default:
    23  		return consistencyUnknown
    24  	case ConsistencyModeUnset:
    25  		return consistencyUnset
    26  	case ConsistencyModeStrict:
    27  		return consistencyStrict
    28  	case ConsistencyModeRelaxed:
    29  		return consistencyRelaxed
    30  	}
    31  }
    32  
    33  type RatelimiterCountersMode uint
    34  
    35  const (
    36  	RatelimiterCountersModeUnset RatelimiterCountersMode = iota
    37  	RatelimiterCountersModeAggregated
    38  	RatelimiterCountersModeDetailed
    39  )
    40  
    41  func (t RatelimiterCountersMode) String() string {
    42  	switch t {
    43  	default:
    44  		return consistencyUnknown
    45  	case RatelimiterCountersModeUnset:
    46  		return consistencyUnset
    47  	case RatelimiterCountersModeAggregated:
    48  		return consistencyAggregated
    49  	case RatelimiterCountersModeDetailed:
    50  		return consistencyDetailed
    51  	}
    52  }
    53  
    54  type NodeConfig struct {
    55  	Path                     string
    56  	SelfCheckPeriodMillis    uint32
    57  	SessionGracePeriodMillis uint32
    58  	ReadConsistencyMode      ConsistencyMode
    59  	AttachConsistencyMode    ConsistencyMode
    60  	RatelimiterCountersMode  RatelimiterCountersMode
    61  }
    62  
    63  func (t ConsistencyMode) To() Ydb_Coordination.ConsistencyMode {
    64  	switch t {
    65  	case ConsistencyModeStrict:
    66  		return Ydb_Coordination.ConsistencyMode_CONSISTENCY_MODE_STRICT
    67  	case ConsistencyModeRelaxed:
    68  		return Ydb_Coordination.ConsistencyMode_CONSISTENCY_MODE_RELAXED
    69  	default:
    70  		return Ydb_Coordination.ConsistencyMode_CONSISTENCY_MODE_UNSET
    71  	}
    72  }
    73  
    74  func (t RatelimiterCountersMode) To() Ydb_Coordination.RateLimiterCountersMode {
    75  	switch t {
    76  	case RatelimiterCountersModeAggregated:
    77  		return Ydb_Coordination.RateLimiterCountersMode_RATE_LIMITER_COUNTERS_MODE_AGGREGATED
    78  	case RatelimiterCountersModeDetailed:
    79  		return Ydb_Coordination.RateLimiterCountersMode_RATE_LIMITER_COUNTERS_MODE_DETAILED
    80  	default:
    81  		return Ydb_Coordination.RateLimiterCountersMode_RATE_LIMITER_COUNTERS_MODE_UNSET
    82  	}
    83  }