forked from apple/swift-cluster-membership
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSettings.swift
66 lines (55 loc) · 2.15 KB
/
Settings.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Cluster Membership open source project
//
// Copyright (c) 2020 Apple Inc. and the Swift Cluster Membership project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.md for the list of Swift Cluster Membership project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import ClusterMembership
import Logging
import NIO
import SWIM
/// Namespace for SWIMNIO constants.
public enum SWIMNIO {}
extension SWIMNIO {
/// SWIMNIO specific settings.
public struct Settings {
/// Underlying settings for the SWIM protocol implementation.
public var swim: SWIM.Settings
public init() {
self.init(swim: .init())
}
public init(swim: SWIM.Settings) {
self.swim = swim
self.logger = swim.logger
}
/// The node as which this SWIMNIO shell should be bound.
///
/// - SeeAlso: `SWIM.Settings.node`
public var node: Node? {
get {
self.swim.node
}
set {
self.swim.node = newValue
}
}
// ==== Settings specific to SWIMNIO ---------------------------------------------------------------------------
/// Allows for customizing the used logger.
/// By default the same as passed in `swim.logger` in the initializer is used.
public var logger: Logger
// TODO: retry initial contact points max count: https://github.com/apple/swift-cluster-membership/issues/32
/// How frequently the shell should retry attempting to join a `swim.initialContactPoint`
public var initialContactPointPingInterval: TimeAmount = .seconds(5)
/// For testing only, as it effectively disables the swim protocol period ticks.
///
/// Allows for disabling of the periodically scheduled protocol period ticks.
internal var _startPeriodicPingTimer: Bool = true
}
}