Example #1
0
        public Follower(ZooKeeperService zooKeeperService,
                        ILogger logger,
                        ResourceManager store,
                        string clientId,
                        int clientNumber,
                        string watchSiblingPath,
                        TimeSpan sessionTimeout,
                        TimeSpan onStartDelay,
                        CancellationToken followerToken)
        {
            this.zooKeeperService = zooKeeperService;
            this.logger           = logger;
            this.store            = store;
            this.clientId         = clientId;
            this.clientNumber     = clientNumber;
            this.watchSiblingPath = watchSiblingPath;
            this.siblingId        = watchSiblingPath.Substring(watchSiblingPath.LastIndexOf("/", StringComparison.Ordinal));
            this.sessionTimeout   = sessionTimeout;
            this.onStartDelay     = onStartDelay;
            this.followerToken    = followerToken;

            this.rebalancingCts    = new CancellationTokenSource();
            this.events            = new BlockingCollection <FollowerEvent>();
            this.disconnectedTimer = new Stopwatch();
        }
Example #2
0
 public ResourceManager(ZooKeeperService zooKeeperService,
                        ILogger logger,
                        OnChangeActions onChangeActions)
 {
     this.zooKeeperService = zooKeeperService;
     this.logger           = logger;
     this.resources        = new List <string>();
     this.assignmentStatus = AssignmentStatus.NoAssignmentYet;
     this.onChangeActions  = onChangeActions;
 }
Example #3
0
        public Coordinator(ZooKeeperService zooKeeperService,
            ILogger logger,
            ResourceManager store,
            string clientId,
            TimeSpan minRebalancingInterval,
            TimeSpan sessionTimeout,
            TimeSpan onStartDelay,
            CancellationToken coordinatorToken)
        {
            this.zooKeeperService = zooKeeperService;
            this.logger = logger;
            this.store = store;
            this.clientId = clientId;
            this.minRebalancingInterval = minRebalancingInterval;
            this.sessionTimeout = sessionTimeout;
            this.onStartDelay = onStartDelay;
            this.coordinatorToken = coordinatorToken;

            this.rebalancingCts = new CancellationTokenSource();
            this.events = new BlockingCollection<CoordinatorEvent>();
            this.disconnectedTimer = new Stopwatch();
        }