/// <summary>
        /// Converts an <see cref="EmbeddedVNodeBuilder"/> to a <see cref="ClusterVNode"/>.
        /// </summary>
        public ClusterVNode Build() {
            EnsureHttpPrefixes();
            SetUpProjectionsIfNeeded();

            var dbConfig = CreateDbConfig(_chunkSize, _dbPath, _chunksCacheSize,
                _inMemoryDb);
            var db = new TFChunkDb(dbConfig);

            var vNodeSettings = new ClusterVNodeSettings(Guid.NewGuid(),
                0,
                _internalTcp,
                _internalSecureTcp,
                _externalTcp,
                _externalSecureTcp,
                _internalHttp,
                _externalHttp,
                _httpPrefixes.ToArray(),
                _enableTrustedAuth,
                _certificate,
                _workerThreads,
                _discoverViaDns,
                _clusterDns,
                _gossipSeeds.ToArray(),
                _minFlushDelay,
                _clusterNodeCount,
                _prepareAckCount,
                _commitAckCount,
                _prepareTimeout,
                _commitTimeout,
                _useSsl,
                _sslTargetHost,
                _sslValidateServer,
                _statsPeriod,
                _statsStorage,
                _nodePriority,
                _authenticationProviderFactory,
                _disableScavengeMerging,
                _adminOnPublic,
                _statsOnPublic,
                _gossipOnPublic,
                _gossipInterval,
                _gossipAllowedTimeDifference,
                _gossipTimeout,
                _intTcpHeartbeatTimeout,
                _intTcpHeartbeatInterval,
                _extTcpHeartbeatTimeout,
                _extTcpHeartbeatInterval,
                !_skipVerifyDbHashes,
                _maxMemtableSize);
            var infoController = new InfoController(null);
            return new ClusterVNode(db, vNodeSettings, GetGossipSource(), infoController, _subsystems.ToArray());
        }
Esempio n. 2
0
        /// <summary>
        /// Converts an <see cref="VNodeBuilder"/> to a <see cref="ClusterVNode"/>.
        /// </summary>
        /// <param name="options">The options with which to build the infoController</param>
        /// <param name="consumerStrategies">The consumer strategies with which to build the node</param>
        /// <returns>A <see cref="ClusterVNode"/> built with the options that were set on the <see cref="VNodeBuilder"/></returns>
        public ClusterVNode Build(IOptions options = null, IPersistentSubscriptionConsumerStrategyFactory[] consumerStrategies = null)
        {
            EnsureHttpPrefixes();
            SetUpProjectionsIfNeeded();
            _gossipAdvertiseInfo = EnsureGossipAdvertiseInfo();


            _dbConfig = CreateDbConfig(_chunkSize, _cachedChunks, _dbPath, _chunksCacheSize,
                    _inMemoryDb, _log);
            FileStreamExtensions.ConfigureFlush(disableFlushToDisk: _unsafeDisableFlushToDisk);

            _db = new TFChunkDb(_dbConfig);

            _vNodeSettings = new ClusterVNodeSettings(Guid.NewGuid(),
                    0,
                    _internalTcp,
                    _internalSecureTcp,
                    _externalTcp,
                    _externalSecureTcp,
                    _internalHttp,
                    _externalHttp,
                    _gossipAdvertiseInfo,
                    _intHttpPrefixes.ToArray(),
                    _extHttpPrefixes.ToArray(),
                    _enableTrustedAuth,
                    _certificate,
                    _workerThreads,
                    _discoverViaDns,
                    _clusterDns,
                    _gossipSeeds.ToArray(),
                    _minFlushDelay,
                    _clusterNodeCount,
                    _prepareAckCount,
                    _commitAckCount,
                    _prepareTimeout,
                    _commitTimeout,
                    _useSsl,
                    _sslTargetHost,
                    _sslValidateServer,
                    _statsPeriod,
                    _statsStorage,
                    _nodePriority,
                    _authenticationProviderFactory,
                    _disableScavengeMerging,
                    _scavengeHistoryMaxAge,
                    _adminOnPublic,
                    _statsOnPublic,
                    _gossipOnPublic,
                    _gossipInterval,
                    _gossipAllowedTimeDifference,
                    _gossipTimeout,
                    _intTcpHeartbeatTimeout,
                    _intTcpHeartbeatInterval,
                    _extTcpHeartbeatTimeout,
                    _extTcpHeartbeatInterval,
                    !_skipVerifyDbHashes,
                    _maxMemtableSize,
                    _hashCollisionReadLimit,
                    _startStandardProjections,
                    _disableHTTPCaching,
                    _logHttpRequests,
                    _index,
                    _enableHistograms,
                    _indexCacheDepth,
                    _indexBitnessVersion,
                    consumerStrategies,
                    _unsafeIgnoreHardDelete,
                    _betterOrdering,
                    _readerThreadsCount,
                    _alwaysKeepScavenged);
            var infoController = new InfoController(options, _projectionType);

            _log.Info("{0,-25} {1}", "INSTANCE ID:", _vNodeSettings.NodeInfo.InstanceId);
            _log.Info("{0,-25} {1}", "DATABASE:", _db.Config.Path);
            _log.Info("{0,-25} {1} (0x{1:X})", "WRITER CHECKPOINT:", _db.Config.WriterCheckpoint.Read());
            _log.Info("{0,-25} {1} (0x{1:X})", "CHASER CHECKPOINT:", _db.Config.ChaserCheckpoint.Read());
            _log.Info("{0,-25} {1} (0x{1:X})", "EPOCH CHECKPOINT:", _db.Config.EpochCheckpoint.Read());
            _log.Info("{0,-25} {1} (0x{1:X})", "TRUNCATE CHECKPOINT:", _db.Config.TruncateCheckpoint.Read());

            return new ClusterVNode(_db, _vNodeSettings, GetGossipSource(), infoController, _subsystems.ToArray());
        }