Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DataStorageConfiguration"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal DataStorageConfiguration(IBinaryRawReader reader)
        {
            Debug.Assert(reader != null);

            StoragePath                 = reader.ReadString();
            CheckpointFrequency         = reader.ReadLongAsTimespan();
            CheckpointThreads           = reader.ReadInt();
            LockWaitTime                = reader.ReadLongAsTimespan();
            WalHistorySize              = reader.ReadInt();
            WalSegments                 = reader.ReadInt();
            WalSegmentSize              = reader.ReadInt();
            WalPath                     = reader.ReadString();
            WalArchivePath              = reader.ReadString();
            WalMode                     = (WalMode)reader.ReadInt();
            WalThreadLocalBufferSize    = reader.ReadInt();
            WalFlushFrequency           = reader.ReadLongAsTimespan();
            WalFsyncDelayNanos          = reader.ReadLong();
            WalRecordIteratorBufferSize = reader.ReadInt();
            AlwaysWriteFullPages        = reader.ReadBoolean();
            MetricsEnabled              = reader.ReadBoolean();
            MetricsSubIntervalCount     = reader.ReadInt();
            MetricsRateTimeInterval     = reader.ReadLongAsTimespan();
            CheckpointWriteOrder        = (CheckpointWriteOrder)reader.ReadInt();
            WriteThrottlingEnabled      = reader.ReadBoolean();
            WalCompactionEnabled        = reader.ReadBoolean();
            MaxWalArchiveSize           = reader.ReadLong();

#pragma warning disable 618
            SystemRegionInitialSize = reader.ReadLong();
            SystemRegionMaxSize     = reader.ReadLong();
#pragma warning restore 618
            PageSize         = reader.ReadInt();
            ConcurrencyLevel = reader.ReadInt();
            WalAutoArchiveAfterInactivity = reader.ReadLongAsTimespan();
            WalForceArchiveTimeout        = reader.ReadLongAsTimespan();
            CheckpointReadLockTimeout     = reader.ReadTimeSpanNullable();
            WalPageCompression            = (DiskPageCompression)reader.ReadInt();
            WalPageCompressionLevel       = reader.ReadIntNullable();

            var count = reader.ReadInt();

            if (count > 0)
            {
                DataRegionConfigurations = Enumerable.Range(0, count)
                                           .Select(x => new DataRegionConfiguration(reader))
                                           .ToArray();
            }

            if (reader.ReadBoolean())
            {
                DefaultDataRegionConfiguration = new DataRegionConfiguration(reader);
            }

            if (reader.ReadBoolean())
            {
                SystemDataRegionConfiguration = new SystemDataRegionConfiguration(reader);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Writes this instance to the specified writer.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal void Write(IBinaryRawWriter writer)
        {
            Debug.Assert(writer != null);

            writer.WriteString(StoragePath);
            writer.WriteTimeSpanAsLong(CheckpointFrequency);
            writer.WriteInt(CheckpointThreads);
            writer.WriteTimeSpanAsLong(LockWaitTime);
            writer.WriteInt(WalHistorySize);
            writer.WriteInt(WalSegments);
            writer.WriteInt(WalSegmentSize);
            writer.WriteString(WalPath);
            writer.WriteString(WalArchivePath);
            writer.WriteInt((int)WalMode);
            writer.WriteInt(WalThreadLocalBufferSize);
            writer.WriteTimeSpanAsLong(WalFlushFrequency);
            writer.WriteLong(WalFsyncDelayNanos);
            writer.WriteInt(WalRecordIteratorBufferSize);
            writer.WriteBoolean(AlwaysWriteFullPages);
            writer.WriteBoolean(MetricsEnabled);
            writer.WriteInt(MetricsSubIntervalCount);
            writer.WriteTimeSpanAsLong(MetricsRateTimeInterval);
            writer.WriteInt((int)CheckpointWriteOrder);
            writer.WriteBoolean(WriteThrottlingEnabled);
            writer.WriteBoolean(WalCompactionEnabled);
            writer.WriteLong(MaxWalArchiveSize);

#pragma warning disable 618
            writer.WriteLong(SystemRegionInitialSize);
            writer.WriteLong(SystemRegionMaxSize);
#pragma warning restore 618
            writer.WriteInt(PageSize);
            writer.WriteInt(ConcurrencyLevel);
            writer.WriteTimeSpanAsLong(WalAutoArchiveAfterInactivity);
            writer.WriteTimeSpanAsLong(WalForceArchiveTimeout);
            writer.WriteTimeSpanAsLongNullable(CheckpointReadLockTimeout);
            writer.WriteInt((int)WalPageCompression);
            writer.WriteIntNullable(WalPageCompressionLevel);

            if (DataRegionConfigurations != null)
            {
                writer.WriteInt(DataRegionConfigurations.Count);

                foreach (var region in DataRegionConfigurations)
                {
                    if (region == null)
                    {
                        throw new IgniteException(
                                  "DataStorageConfiguration.DataRegionConfigurations must not contain null items.");
                    }

                    region.Write(writer);
                }
            }
            else
            {
                writer.WriteInt(0);
            }

            if (DefaultDataRegionConfiguration != null)
            {
                writer.WriteBoolean(true);
                DefaultDataRegionConfiguration.Write(writer);
            }
            else
            {
                writer.WriteBoolean(false);
            }

            if (SystemDataRegionConfiguration != null)
            {
                writer.WriteBoolean(true);
                SystemDataRegionConfiguration.Write(writer);
            }
            else
            {
                writer.WriteBoolean(false);
            }
        }