コード例 #1
0
        /// <summary>
        /// Reads data from specified reader into current instance.
        /// </summary>
        /// <param name="r">The binary reader.</param>
        private void ReadCore(BinaryReader r)
        {
            // Simple properties
            ClientMode         = r.ReadBoolean();
            IncludedEventTypes = r.ReadIntArray();

            MetricsExpireTime      = r.ReadLongAsTimespan();
            MetricsHistorySize     = r.ReadInt();
            MetricsLogFrequency    = r.ReadLongAsTimespan();
            MetricsUpdateFrequency = r.ReadLongAsTimespan();
            NetworkSendRetryCount  = r.ReadInt();
            NetworkSendRetryDelay  = r.ReadLongAsTimespan();
            NetworkTimeout         = r.ReadLongAsTimespan();
            WorkDirectory          = r.ReadString();
            Localhost = r.ReadString();

            // Cache config
            var cacheCfgCount = r.ReadInt();

            CacheConfiguration = new List <CacheConfiguration>(cacheCfgCount);
            for (int i = 0; i < cacheCfgCount; i++)
            {
                CacheConfiguration.Add(new CacheConfiguration(r));
            }

            // Discovery config
            DiscoverySpi = r.ReadBoolean() ? new TcpDiscoverySpi(r) : null;

            // Binary config
            if (r.ReadBoolean())
            {
                BinaryConfiguration = BinaryConfiguration ?? new BinaryConfiguration();
                BinaryConfiguration.CompactFooter = r.ReadBoolean();
            }
        }
コード例 #2
0
        /// <summary>
        /// Reads data from specified reader into current instance.
        /// </summary>
        /// <param name="r">The binary reader.</param>
        private void ReadCore(BinaryReader r)
        {
            // Simple properties
            _clientMode = r.ReadBooleanNullable();
            IncludedEventTypes = r.ReadIntArray();
            _metricsExpireTime = r.ReadTimeSpanNullable();
            _metricsHistorySize = r.ReadIntNullable();
            _metricsLogFrequency = r.ReadTimeSpanNullable();
            _metricsUpdateFrequency = r.ReadTimeSpanNullable();
            _networkSendRetryCount = r.ReadIntNullable();
            _networkSendRetryDelay = r.ReadTimeSpanNullable();
            _networkTimeout = r.ReadTimeSpanNullable();
            WorkDirectory = r.ReadString();
            Localhost = r.ReadString();
            _isDaemon = r.ReadBooleanNullable();
            _isLateAffinityAssignment = r.ReadBooleanNullable();
            _failureDetectionTimeout = r.ReadTimeSpanNullable();

            // Cache config
            var cacheCfgCount = r.ReadInt();
            CacheConfiguration = new List<CacheConfiguration>(cacheCfgCount);
            for (int i = 0; i < cacheCfgCount; i++)
                CacheConfiguration.Add(new CacheConfiguration(r));

            // Discovery config
            DiscoverySpi = r.ReadBoolean() ? new TcpDiscoverySpi(r) : null;

            // Communication config
            CommunicationSpi = r.ReadBoolean() ? new TcpCommunicationSpi(r) : null;

            // Binary config
            if (r.ReadBoolean())
            {
                BinaryConfiguration = BinaryConfiguration ?? new BinaryConfiguration();
                BinaryConfiguration.CompactFooter = r.ReadBoolean();
            }

            // User attributes
            UserAttributes = Enumerable.Range(0, r.ReadInt())
                .ToDictionary(x => r.ReadString(), x => r.ReadObject<object>());

            // Atomic
            if (r.ReadBoolean())
            {
                AtomicConfiguration = new AtomicConfiguration
                {
                    AtomicSequenceReserveSize = r.ReadInt(),
                    Backups = r.ReadInt(),
                    CacheMode = (CacheMode) r.ReadInt()
                };
            }

            // Tx
            if (r.ReadBoolean())
            {
                TransactionConfiguration = new TransactionConfiguration
                {
                    PessimisticTransactionLogSize = r.ReadInt(),
                    DefaultTransactionConcurrency = (TransactionConcurrency) r.ReadInt(),
                    DefaultTransactionIsolation = (TransactionIsolation) r.ReadInt(),
                    DefaultTimeout = TimeSpan.FromMilliseconds(r.ReadLong()),
                    PessimisticTransactionLogLinger = TimeSpan.FromMilliseconds(r.ReadInt())
                };
            }

            // Swap
            SwapSpaceSpi = SwapSpaceSerializer.Read(r);
        }
コード例 #3
0
        /// <summary>
        /// Reads data from specified reader into current instance.
        /// </summary>
        /// <param name="r">The binary reader.</param>
        private void ReadCore(BinaryReader r)
        {
            // Simple properties
            _clientMode             = r.ReadBooleanNullable();
            IncludedEventTypes      = r.ReadIntArray();
            _metricsExpireTime      = r.ReadTimeSpanNullable();
            _metricsHistorySize     = r.ReadIntNullable();
            _metricsLogFrequency    = r.ReadTimeSpanNullable();
            _metricsUpdateFrequency = r.ReadTimeSpanNullable();
            _networkSendRetryCount  = r.ReadIntNullable();
            _networkSendRetryDelay  = r.ReadTimeSpanNullable();
            _networkTimeout         = r.ReadTimeSpanNullable();
            WorkDirectory           = r.ReadString();
            Localhost = r.ReadString();
            _isDaemon = r.ReadBooleanNullable();
            _isLateAffinityAssignment      = r.ReadBooleanNullable();
            _failureDetectionTimeout       = r.ReadTimeSpanNullable();
            _clientFailureDetectionTimeout = r.ReadTimeSpanNullable();
            _longQueryWarningTimeout       = r.ReadTimeSpanNullable();
            _isActiveOnStart = r.ReadBooleanNullable();

            // Thread pools
            _publicThreadPoolSize        = r.ReadIntNullable();
            _stripedThreadPoolSize       = r.ReadIntNullable();
            _serviceThreadPoolSize       = r.ReadIntNullable();
            _systemThreadPoolSize        = r.ReadIntNullable();
            _asyncCallbackThreadPoolSize = r.ReadIntNullable();
            _managementThreadPoolSize    = r.ReadIntNullable();
            _dataStreamerThreadPoolSize  = r.ReadIntNullable();
            _utilityCacheThreadPoolSize  = r.ReadIntNullable();
            _queryThreadPoolSize         = r.ReadIntNullable();

            // Cache config
            var cacheCfgCount = r.ReadInt();

            CacheConfiguration = new List <CacheConfiguration>(cacheCfgCount);
            for (int i = 0; i < cacheCfgCount; i++)
            {
                CacheConfiguration.Add(new CacheConfiguration(r));
            }

            // Discovery config
            DiscoverySpi = r.ReadBoolean() ? new TcpDiscoverySpi(r) : null;

            // Communication config
            CommunicationSpi = r.ReadBoolean() ? new TcpCommunicationSpi(r) : null;

            // Binary config
            if (r.ReadBoolean())
            {
                BinaryConfiguration = BinaryConfiguration ?? new BinaryConfiguration();

                if (r.ReadBoolean())
                {
                    BinaryConfiguration.CompactFooter = r.ReadBoolean();
                }

                if (r.ReadBoolean())
                {
                    BinaryConfiguration.NameMapper = BinaryBasicNameMapper.SimpleNameInstance;
                }
            }

            // User attributes
            UserAttributes = Enumerable.Range(0, r.ReadInt())
                             .ToDictionary(x => r.ReadString(), x => r.ReadObject <object>());

            // Atomic
            if (r.ReadBoolean())
            {
                AtomicConfiguration = new AtomicConfiguration
                {
                    AtomicSequenceReserveSize = r.ReadInt(),
                    Backups   = r.ReadInt(),
                    CacheMode = (CacheMode)r.ReadInt()
                };
            }

            // Tx
            if (r.ReadBoolean())
            {
                TransactionConfiguration = new TransactionConfiguration
                {
                    PessimisticTransactionLogSize = r.ReadInt(),
                    DefaultTransactionConcurrency = (TransactionConcurrency)r.ReadInt(),
                    DefaultTransactionIsolation   = (TransactionIsolation)r.ReadInt(),
                    DefaultTimeout = TimeSpan.FromMilliseconds(r.ReadLong()),
                    PessimisticTransactionLogLinger = TimeSpan.FromMilliseconds(r.ReadInt())
                };
            }

            // Event storage
            switch (r.ReadByte())
            {
            case 1: EventStorageSpi = new NoopEventStorageSpi();
                break;

            case 2:
                EventStorageSpi = MemoryEventStorageSpi.Read(r);
                break;
            }

            if (r.ReadBoolean())
            {
                MemoryConfiguration = new MemoryConfiguration(r);
            }

            // SQL
            if (r.ReadBoolean())
            {
                SqlConnectorConfiguration = new SqlConnectorConfiguration(r);
            }

            // Persistence.
            if (r.ReadBoolean())
            {
                PersistentStoreConfiguration = new PersistentStoreConfiguration(r);
            }
        }
コード例 #4
0
        /// <summary>
        /// Reads data into this instance from the specified reader.
        /// </summary>
        /// <param name="reader">The reader.</param>
        private void Read(BinaryReader reader)
        {
            // Make sure system marshaller is used.
            Debug.Assert(reader.Marshaller == BinaryUtils.Marshaller);

            AtomicityMode     = (CacheAtomicityMode)reader.ReadInt();
            Backups           = reader.ReadInt();
            CacheMode         = (CacheMode)reader.ReadInt();
            CopyOnRead        = reader.ReadBoolean();
            EagerTtl          = reader.ReadBoolean();
            Invalidate        = reader.ReadBoolean();
            KeepBinaryInStore = reader.ReadBoolean();
            LoadPreviousValue = reader.ReadBoolean();
            LockTimeout       = reader.ReadLongAsTimespan();
#pragma warning disable 618
            LongQueryWarningTimeout = reader.ReadLongAsTimespan();
#pragma warning restore 618
            MaxConcurrentAsyncOperations = reader.ReadInt();
            Name                            = reader.ReadString();
            ReadFromBackup                  = reader.ReadBoolean();
            RebalanceBatchSize              = reader.ReadInt();
            RebalanceDelay                  = reader.ReadLongAsTimespan();
            RebalanceMode                   = (CacheRebalanceMode)reader.ReadInt();
            RebalanceThrottle               = reader.ReadLongAsTimespan();
            RebalanceTimeout                = reader.ReadLongAsTimespan();
            SqlEscapeAll                    = reader.ReadBoolean();
            WriteBehindBatchSize            = reader.ReadInt();
            WriteBehindEnabled              = reader.ReadBoolean();
            WriteBehindFlushFrequency       = reader.ReadLongAsTimespan();
            WriteBehindFlushSize            = reader.ReadInt();
            WriteBehindFlushThreadCount     = reader.ReadInt();
            WriteBehindCoalescing           = reader.ReadBoolean();
            WriteSynchronizationMode        = (CacheWriteSynchronizationMode)reader.ReadInt();
            ReadThrough                     = reader.ReadBoolean();
            WriteThrough                    = reader.ReadBoolean();
            EnableStatistics                = reader.ReadBoolean();
            DataRegionName                  = reader.ReadString();
            PartitionLossPolicy             = (PartitionLossPolicy)reader.ReadInt();
            GroupName                       = reader.ReadString();
            CacheStoreFactory               = reader.ReadObject <IFactory <ICacheStore> >();
            SqlIndexMaxInlineSize           = reader.ReadInt();
            OnheapCacheEnabled              = reader.ReadBoolean();
            StoreConcurrentLoadAllThreshold = reader.ReadInt();
            RebalanceOrder                  = reader.ReadInt();
            RebalanceBatchesPrefetchCount   = reader.ReadLong();
            MaxQueryIteratorsCount          = reader.ReadInt();
            QueryDetailMetricsSize          = reader.ReadInt();
            QueryParallelism                = reader.ReadInt();
            SqlSchema                       = reader.ReadString();

            QueryEntities = reader.ReadCollectionRaw(r => new QueryEntity(r));

            NearConfiguration = reader.ReadBoolean() ? new NearCacheConfiguration(reader) : null;

            EvictionPolicy      = EvictionPolicyBase.Read(reader);
            AffinityFunction    = AffinityFunctionSerializer.Read(reader);
            ExpiryPolicyFactory = ExpiryPolicySerializer.ReadPolicyFactory(reader);

            KeyConfiguration = reader.ReadCollectionRaw(r => new CacheKeyConfiguration(r));

            var count = reader.ReadInt();

            if (count > 0)
            {
                PluginConfigurations = new List <ICachePluginConfiguration>(count);
                for (int i = 0; i < count; i++)
                {
                    if (reader.ReadBoolean())
                    {
                        // FactoryId-based plugin: skip.
                        reader.ReadInt();                             // Skip factory id.
                        var size = reader.ReadInt();
                        reader.Stream.Seek(size, SeekOrigin.Current); // Skip custom data.
                    }
                    else
                    {
                        // Pure .NET plugin.
                        PluginConfigurations.Add(reader.ReadObject <ICachePluginConfiguration>());
                    }
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Reads data from specified reader into current instance.
        /// </summary>
        /// <param name="r">The binary reader.</param>
        private void ReadCore(BinaryReader r)
        {
            // Simple properties
            ClientMode = r.ReadBoolean();
            IncludedEventTypes = r.ReadIntArray();

            MetricsExpireTime = r.ReadLongAsTimespan();
            MetricsHistorySize = r.ReadInt();
            MetricsLogFrequency = r.ReadLongAsTimespan();
            MetricsUpdateFrequency = r.ReadLongAsTimespan();
            NetworkSendRetryCount = r.ReadInt();
            NetworkSendRetryDelay = r.ReadLongAsTimespan();
            NetworkTimeout = r.ReadLongAsTimespan();
            WorkDirectory = r.ReadString();
            Localhost = r.ReadString();

            // Cache config
            var cacheCfgCount = r.ReadInt();
            CacheConfiguration = new List<CacheConfiguration>(cacheCfgCount);
            for (int i = 0; i < cacheCfgCount; i++)
                CacheConfiguration.Add(new CacheConfiguration(r));

            // Discovery config
            DiscoverySpi = r.ReadBoolean() ? new TcpDiscoverySpi(r) : null;
        }
コード例 #6
0
        /// <summary>
        /// Reads data from specified reader into current instance.
        /// </summary>
        /// <param name="r">The binary reader.</param>
        private void ReadCore(BinaryReader r)
        {
            // Simple properties
            _clientMode             = r.ReadBooleanNullable();
            IncludedEventTypes      = r.ReadIntArray();
            _metricsExpireTime      = r.ReadTimeSpanNullable();
            _metricsHistorySize     = r.ReadIntNullable();
            _metricsLogFrequency    = r.ReadTimeSpanNullable();
            _metricsUpdateFrequency = r.ReadTimeSpanNullable();
            _networkSendRetryCount  = r.ReadIntNullable();
            _networkSendRetryDelay  = r.ReadTimeSpanNullable();
            _networkTimeout         = r.ReadTimeSpanNullable();
            WorkDirectory           = r.ReadString();
            Localhost = r.ReadString();
            _isDaemon = r.ReadBooleanNullable();
            _isLateAffinityAssignment = r.ReadBooleanNullable();

            // Cache config
            var cacheCfgCount = r.ReadInt();

            CacheConfiguration = new List <CacheConfiguration>(cacheCfgCount);
            for (int i = 0; i < cacheCfgCount; i++)
            {
                CacheConfiguration.Add(new CacheConfiguration(r));
            }

            // Discovery config
            DiscoverySpi = r.ReadBoolean() ? new TcpDiscoverySpi(r) : null;

            // Communication config
            CommunicationSpi = r.ReadBoolean() ? new TcpCommunicationSpi(r) : null;

            // Binary config
            if (r.ReadBoolean())
            {
                BinaryConfiguration = BinaryConfiguration ?? new BinaryConfiguration();
                BinaryConfiguration.CompactFooter = r.ReadBoolean();
            }

            // User attributes
            UserAttributes = Enumerable.Range(0, r.ReadInt())
                             .ToDictionary(x => r.ReadString(), x => r.ReadObject <object>());

            // Atomic
            if (r.ReadBoolean())
            {
                AtomicConfiguration = new AtomicConfiguration
                {
                    AtomicSequenceReserveSize = r.ReadInt(),
                    Backups   = r.ReadInt(),
                    CacheMode = (CacheMode)r.ReadInt()
                };
            }

            // Tx
            if (r.ReadBoolean())
            {
                TransactionConfiguration = new TransactionConfiguration
                {
                    PessimisticTransactionLogSize = r.ReadInt(),
                    DefaultTransactionConcurrency = (TransactionConcurrency)r.ReadInt(),
                    DefaultTransactionIsolation   = (TransactionIsolation)r.ReadInt(),
                    DefaultTimeout = TimeSpan.FromMilliseconds(r.ReadLong()),
                    PessimisticTransactionLogLinger = TimeSpan.FromMilliseconds(r.ReadInt())
                };
            }
        }
コード例 #7
0
        /// <summary>
        /// Reads data into this instance from the specified reader.
        /// </summary>
        /// <param name="reader">The reader.</param>
        private void Read(BinaryReader reader)
        {
            // Make sure system marshaller is used.
            Debug.Assert(((BinaryReader)reader).Marshaller == BinaryUtils.Marshaller);

            AtomicityMode     = (CacheAtomicityMode)reader.ReadInt();
            Backups           = reader.ReadInt();
            CacheMode         = (CacheMode)reader.ReadInt();
            CopyOnRead        = reader.ReadBoolean();
            EagerTtl          = reader.ReadBoolean();
            Invalidate        = reader.ReadBoolean();
            KeepBinaryInStore = reader.ReadBoolean();
            LoadPreviousValue = reader.ReadBoolean();
            LockTimeout       = reader.ReadLongAsTimespan();
#pragma warning disable 618
            LongQueryWarningTimeout = reader.ReadLongAsTimespan();
#pragma warning restore 618
            MaxConcurrentAsyncOperations = reader.ReadInt();
            Name                        = reader.ReadString();
            ReadFromBackup              = reader.ReadBoolean();
            RebalanceBatchSize          = reader.ReadInt();
            RebalanceDelay              = reader.ReadLongAsTimespan();
            RebalanceMode               = (CacheRebalanceMode)reader.ReadInt();
            RebalanceThrottle           = reader.ReadLongAsTimespan();
            RebalanceTimeout            = reader.ReadLongAsTimespan();
            SqlEscapeAll                = reader.ReadBoolean();
            WriteBehindBatchSize        = reader.ReadInt();
            WriteBehindEnabled          = reader.ReadBoolean();
            WriteBehindFlushFrequency   = reader.ReadLongAsTimespan();
            WriteBehindFlushSize        = reader.ReadInt();
            WriteBehindFlushThreadCount = reader.ReadInt();
            WriteBehindCoalescing       = reader.ReadBoolean();
            WriteSynchronizationMode    = (CacheWriteSynchronizationMode)reader.ReadInt();
            ReadThrough                 = reader.ReadBoolean();
            WriteThrough                = reader.ReadBoolean();
            EnableStatistics            = reader.ReadBoolean();
            MemoryPolicyName            = reader.ReadString();
            PartitionLossPolicy         = (PartitionLossPolicy)reader.ReadInt();
            GroupName                   = reader.ReadString();
            CacheStoreFactory           = reader.ReadObject <IFactory <ICacheStore> >();

            var count = reader.ReadInt();
            QueryEntities = count == 0
                ? null
                : Enumerable.Range(0, count).Select(x => new QueryEntity(reader)).ToList();

            NearConfiguration = reader.ReadBoolean() ? new NearCacheConfiguration(reader) : null;

            EvictionPolicy      = EvictionPolicyBase.Read(reader);
            AffinityFunction    = AffinityFunctionSerializer.Read(reader);
            ExpiryPolicyFactory = ExpiryPolicySerializer.ReadPolicyFactory(reader);

            count = reader.ReadInt();

            if (count > 0)
            {
                PluginConfigurations = new List <ICachePluginConfiguration>(count);
                for (int i = 0; i < count; i++)
                {
                    if (reader.ReadBoolean())
                    {
                        // FactoryId-based plugin: skip.
                        var size = reader.ReadInt();
                        reader.Stream.Seek(size, SeekOrigin.Current);
                    }
                    else
                    {
                        // Pure .NET plugin.
                        PluginConfigurations.Add(reader.ReadObject <ICachePluginConfiguration>());
                    }
                }
            }
        }