/// <summary> /// Initializes a new instance of the <see cref="ZooKeeperServer"/> class. /// </summary> /// <param name="protocol">Protocol used for communication</param> /// <param name="instrumentation">Instrumentation consumer</param> /// <param name="cancellationToken">Token to observe for cancellation signal</param> public ZooKeeperServer(IZooKeeperCommunicationProtocol protocol, IZooKeeperServerInstrumentation instrumentation, CancellationToken cancellationToken) { if (protocol == null) { throw new ArgumentNullException(nameof(protocol)); } this.protocol = protocol; this.instrumentation = instrumentation; this.cancellationToken = cancellationToken; }
/// <summary> /// Initializes a new instance of the <see cref="ZooKeeperSession"/> class. /// </summary> /// <param name="server">ZooKeeper server object</param> /// <param name="sessionId">Session ID</param> /// <param name="onInitSession">Function to process init request and returns a request handler</param> /// <param name="connection">Secure transport connection object</param> /// <param name="protocol">Communication protocol for serialization and deserialization</param> /// <param name="instrumentation">Instrumentation object to get the notification of internal state change</param> public ZooKeeperSession( ZooKeeperServer server, ulong sessionId, Func <Requests.RequestInit, IRingMasterRequestHandlerOverlapped> onInitSession, IConnection connection, IZooKeeperCommunicationProtocol protocol, IZooKeeperServerInstrumentation instrumentation) { this.server = server; this.sessionId = sessionId; this.connection = connection; this.onInitSession = onInitSession; this.protocol = protocol; this.instrumentation = instrumentation; this.sessionState = new ZkprPerSessionState(this.sessionId); }