Esempio n. 1
0
        internal static (TimeoutValue SessionTimeout, TimeoutValue ConnectTimeout, EquatableReadOnlyList <ZooKeeperAuthInfo> AuthInfo, IReadOnlyList <ACL> Acl) GetOptions(Action <ZooKeeperDistributedSynchronizationOptionsBuilder>?options)
        {
            var builder = new ZooKeeperDistributedSynchronizationOptionsBuilder();

            options?.Invoke(builder);
            return(
                SessionTimeout : builder._sessionTimeout,
                ConnectTimeout : builder._connectTimeout,
                AuthInfo : new EquatableReadOnlyList <ZooKeeperAuthInfo>(builder._authInfo),
                Acl : builder._acl.Count != 0 ? builder._acl.ToArray() : DefaultAcl
                );
        }
Esempio n. 2
0
        public ZooKeeperSynchronizationHelper(
            ZooKeeperPath path,
            bool assumePathExists,
            string connectionString,
            Action <ZooKeeperDistributedSynchronizationOptionsBuilder>?optionsBuilder,
            bool setAcquiredMarker = false)
        {
            this.Path = path;
            this._assumePathExists = assumePathExists;
            var options = ZooKeeperDistributedSynchronizationOptionsBuilder.GetOptions(optionsBuilder);

            this._connectionInfo = new ZooKeeperConnectionInfo(
                connectionString ?? throw new ArgumentNullException(nameof(connectionString)),
                ConnectTimeout: options.ConnectTimeout,
                SessionTimeout: options.SessionTimeout,
                AuthInfo: options.AuthInfo
                );
            this._acl = options.Acl;
            this._setAcquiredMarker = setAcquiredMarker;
        }