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

            var count = reader.ReadInt();

            _dict = new Dictionary<string, int>(count);
            _list = new List<Entry>(count);

            for (var i = 0; i < count; i++)
            {
                var key = reader.ReadString();

                var valBytes = reader.ReadByteArray();

                if (valBytes != null)
                {
                    var entry = new Entry(key, true, valBytes);

                    _dict[key] = _list.Count;

                    _list.Add(entry);
                }
                else
                    AddRemovedKey(key);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Reads the configuration from reader.
        /// </summary>
        public static ISwapSpaceSpi Read(IBinaryRawReader reader)
        {
            Debug.Assert(reader != null);

            var type = (Type) reader.ReadByte();

            switch (type)
            {
                case Type.None:
                    return null;

                case Type.File:
                    return new FileSwapSpaceSpi
                    {
                        BaseDirectory = reader.ReadString(),
                        MaximumSparsity = reader.ReadFloat(),
                        MaximumWriteQueueSize = reader.ReadInt(),
                        ReadStripesNumber = reader.ReadInt(),
                        WriteBufferSize = reader.ReadInt()
                    };

                default:
                    throw new ArgumentOutOfRangeException("Invalid Swap Space SPI type: " + type);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal TaskEvent(IBinaryRawReader r) : base(r)
 {
     _taskName = r.ReadString();
     _taskClassName = r.ReadString();
     _taskSessionId = IgniteGuid.Read(r);
     _internal = r.ReadBoolean();
     _subjectId = r.ReadGuid();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="IgniteSessionStateStoreData"/> class.
 /// </summary>
 /// <param name="reader">The reader.</param>
 public IgniteSessionStateStoreData(IBinaryRawReader reader) : base(
     new IgniteSessionStateItemCollection(reader),
     DeserializeStaticObjects(reader.ReadByteArray()), reader.ReadInt())
 {
     LockNodeId = reader.ReadGuid();
     LockId = reader.ReadLong();
     LockTime = reader.ReadTimestamp();
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal CacheRebalancingEvent(IBinaryRawReader r) : base(r)
 {
     _cacheName = r.ReadString();
     _partition = r.ReadInt();
     _discoveryNode = ReadNode(r);
     _discoveryEventType = r.ReadInt();
     _discoveryEventName = r.ReadString();
     _discoveryTimestamp = r.ReadLong();
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal CacheQueryExecutedEvent(IBinaryRawReader r) : base(r)
 {
     _queryType = r.ReadString();
     _cacheName = r.ReadString();
     _className = r.ReadString();
     _clause = r.ReadString();
     _subjectId = r.ReadGuid();
     _taskName = r.ReadString();
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="r">The reader to read data from.</param>
        internal DiscoveryEvent(IBinaryRawReader r) : base(r)
        {
            _eventNode = ReadNode(r);
            _topologyVersion = r.ReadLong();

            var nodes = IgniteUtils.ReadNodes(r);

            _topologyNodes = nodes == null ? null : new ReadOnlyCollection<IClusterNode>(nodes);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal JobEvent(IBinaryRawReader r) : base(r)
 {
     _taskName = r.ReadString();
     _taskClassName = r.ReadString();
     _taskSessionId = IgniteGuid.Read(r);
     _jobId = IgniteGuid.Read(r);
     _taskNode = ReadNode(r);
     _taskSubjectId = r.ReadGuid();
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CacheMetricsImpl"/> class.
 /// </summary>
 /// <param name="reader">The reader.</param>
 public CacheMetricsImpl(IBinaryRawReader reader)
 {
     CacheGets = reader.ReadLong();
     CachePuts = reader.ReadLong();
     CacheHits = reader.ReadLong();
     CacheMisses = reader.ReadLong();
     CacheTxCommits = reader.ReadLong();
     CacheTxRollbacks = reader.ReadLong();
     CacheEvictions = reader.ReadLong();
     CacheRemovals = reader.ReadLong();
     AveragePutTime = reader.ReadFloat();
     AverageGetTime = reader.ReadFloat();
     AverageRemoveTime = reader.ReadFloat();
     AverageTxCommitTime = reader.ReadFloat();
     AverageTxRollbackTime = reader.ReadFloat();
     CacheName = reader.ReadString();
     OverflowSize = reader.ReadLong();
     OffHeapEntriesCount = reader.ReadLong();
     OffHeapAllocatedSize = reader.ReadLong();
     Size = reader.ReadInt();
     KeySize = reader.ReadInt();
     IsEmpty = reader.ReadBoolean();
     DhtEvictQueueCurrentSize = reader.ReadInt();
     TxThreadMapSize = reader.ReadInt();
     TxXidMapSize = reader.ReadInt();
     TxCommitQueueSize = reader.ReadInt();
     TxPrepareQueueSize = reader.ReadInt();
     TxStartVersionCountsSize = reader.ReadInt();
     TxCommittedVersionsSize = reader.ReadInt();
     TxRolledbackVersionsSize = reader.ReadInt();
     TxDhtThreadMapSize = reader.ReadInt();
     TxDhtXidMapSize = reader.ReadInt();
     TxDhtCommitQueueSize = reader.ReadInt();
     TxDhtPrepareQueueSize = reader.ReadInt();
     TxDhtStartVersionCountsSize = reader.ReadInt();
     TxDhtCommittedVersionsSize = reader.ReadInt();
     TxDhtRolledbackVersionsSize = reader.ReadInt();
     IsWriteBehindEnabled = reader.ReadBoolean();
     WriteBehindFlushSize = reader.ReadInt();
     WriteBehindFlushThreadCount = reader.ReadInt();
     WriteBehindFlushFrequency = reader.ReadLong();
     WriteBehindStoreBatchSize = reader.ReadInt();
     WriteBehindTotalCriticalOverflowCount = reader.ReadInt();
     WriteBehindCriticalOverflowCount = reader.ReadInt();
     WriteBehindErrorRetryCount = reader.ReadInt();
     WriteBehindBufferSize = reader.ReadInt();
     KeyType = reader.ReadString();
     ValueType = reader.ReadString();
     IsStoreByValue = reader.ReadBoolean();
     IsStatisticsEnabled = reader.ReadBoolean();
     IsManagementEnabled = reader.ReadBoolean();
     IsReadThrough = reader.ReadBoolean();
     IsWriteThrough = reader.ReadBoolean();
     CacheHitPercentage = reader.ReadFloat();
     CacheMissPercentage = reader.ReadFloat();
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceContext"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public ServiceContext(IBinaryRawReader reader)
        {
            Debug.Assert(reader != null);

            Name = reader.ReadString();
            ExecutionId = reader.ReadGuid() ?? Guid.Empty;
            IsCancelled = reader.ReadBoolean();
            CacheName = reader.ReadString();
            AffinityKey = reader.ReadObject<object>();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="TcpDiscoveryMulticastIpFinder"/> class.
 /// </summary>
 /// <param name="reader">The reader.</param>
 internal TcpDiscoveryMulticastIpFinder(IBinaryRawReader reader)
     : base(reader)
 {
     LocalAddress = reader.ReadString();
     MulticastGroup = reader.ReadString();
     MulticastPort = reader.ReadInt();
     AddressRequestAttempts = reader.ReadInt();
     ResponseTimeout = TimeSpan.FromMilliseconds(reader.ReadInt());
     TimeToLive = reader.ReadBoolean() ? (byte?) reader.ReadInt() : null;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="TcpDiscoveryStaticIpFinder"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal TcpDiscoveryStaticIpFinder(IBinaryRawReader reader)
        {
            var count = reader.ReadInt();

            if (count > 0)
            {
                Endpoints = new List<string>(count);

                for (int i = 0; i < count; i++)
                    Endpoints.Add(reader.ReadString());
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TransactionMetricsImpl"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public TransactionMetricsImpl(IBinaryRawReader reader)
        {
            var commitTime = reader.ReadTimestamp();
            Debug.Assert(commitTime.HasValue);
            CommitTime = commitTime.Value;

            var rollbackTime = reader.ReadTimestamp();
            Debug.Assert(rollbackTime.HasValue);
            RollbackTime = rollbackTime.Value;

            TxCommits = reader.ReadInt();
            TxRollbacks = reader.ReadInt();
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SessionStateLockResult"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public SessionStateLockResult(IBinaryRawReader reader)
        {
            _success = reader.ReadBoolean();

            if (_success)
                _data = new IgniteSessionStateStoreData(reader);

            _lockTime = reader.ReadTimestamp();
            _lockId = reader.ReadLong();

            Debug.Assert(_success ^ (_data == null));
            Debug.Assert(_success ^ (_lockTime != null));
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal CacheQueryReadEvent(IBinaryRawReader r) : base(r)
 {
     _queryType = r.ReadString();
     _cacheName = r.ReadString();
     _className = r.ReadString();
     _clause = r.ReadString();
     _subjectId = r.ReadGuid();
     _taskName = r.ReadString();
     _key = r.ReadObject<object>();
     _value = r.ReadObject<object>();
     _oldValue = r.ReadObject<object>();
     _row = r.ReadObject<object>();
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Serializes content from the writer
        /// </summary>
        public void FromBinary(IBinaryRawReader reader)
        {
            Station = reader.ReadDouble();
            var offsetCount = reader.ReadInt();

            Offsets = new List <StationOffsetRow>();
            for (var i = 0; i < offsetCount; i++)
            {
                var offset = new StationOffsetRow();
                offset.FromBinary(reader);
                Offsets.Add(offset);
            }
            Minimum.FromBinary(reader);
            Maximum.FromBinary(reader);
            Average.FromBinary(reader);
        }
Ejemplo n.º 17
0
        public override void InternalFromBinary(IBinaryRawReader reader)
        {
            if (reader is null)
            {
                throw new ArgumentNullException(nameof(reader));
            }

            base.InternalFromBinary(reader);

            var version = VersionSerializationHelper.CheckVersionByte(reader, VERSION_NUMBER);

            if (version == 1)
            {
                AlignmentUid = reader.ReadGuid() ?? Guid.Empty;
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Reads long as timespan with range checks.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>TimeSpan.</returns>
        public static TimeSpan ReadLongAsTimespan(this IBinaryRawReader reader)
        {
            long ms = reader.ReadLong();

            if (ms >= TimeSpan.MaxValue.TotalMilliseconds)
            {
                return(TimeSpan.MaxValue);
            }

            if (ms <= TimeSpan.MinValue.TotalMilliseconds)
            {
                return(TimeSpan.MinValue);
            }

            return(TimeSpan.FromMilliseconds(ms));
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QueryField"/> class.
        /// </summary>
        internal QueryField(IBinaryRawReader reader, ClientProtocolVersion srvVer)
        {
            Debug.Assert(reader != null);

            Name          = reader.ReadString();
            FieldTypeName = reader.ReadString();
            IsKeyField    = reader.ReadBoolean();
            NotNull       = reader.ReadBoolean();
            DefaultValue  = reader.ReadObject <object>();

            if (srvVer.CompareTo(ClientSocket.Ver120) >= 0)
            {
                Precision = reader.ReadInt();
                Scale     = reader.ReadInt();
            }
        }
        /// <summary>
        /// Reads the instance.
        /// </summary>
        internal static TcpDiscoveryIpFinderBase ReadInstance(IBinaryRawReader reader)
        {
            var code = reader.ReadByte();

            switch (code)
            {
            case TypeCodeVmIpFinder:
                return(new TcpDiscoveryStaticIpFinder(reader));

            case TypeCodeMulticastIpFinder:
                return(new TcpDiscoveryMulticastIpFinder(reader));

            default:
                return(null);
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Reads data into this instance from the specified reader.
        /// </summary>
        /// <param name="reader">The reader.</param>
        private void Read(IBinaryRawReader reader)
        {
            Debug.Assert(reader != null);

            KeyAlgorithm = reader.ReadString();

            KeyStoreType     = reader.ReadString();
            KeyStoreFilePath = reader.ReadString();
            KeyStorePassword = reader.ReadString();

            Protocol = reader.ReadString();

            TrustStoreType     = reader.ReadString();
            TrustStoreFilePath = reader.ReadString();
            TrustStorePassword = reader.ReadString();
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Serializes content from the writer
        /// </summary>
        public override void InternalFromBinary(IBinaryRawReader reader)
        {
            base.InternalFromBinary(reader);

            var version = VersionSerializationHelper.CheckVersionByte(reader, VERSION_NUMBER);

            if (version == 1)
            {
                ReportElevation   = reader.ReadBoolean();
                ReportCmv         = reader.ReadBoolean();
                ReportMdp         = reader.ReadBoolean();
                ReportPassCount   = reader.ReadBoolean();
                ReportTemperature = reader.ReadBoolean();
                ReportCutFill     = reader.ReadBoolean();
            }
        }
Ejemplo n.º 23
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal CacheEvent(IBinaryRawReader r) : base(r)
 {
     _cacheName        = r.ReadString();
     _partition        = r.ReadInt();
     _isNear           = r.ReadBoolean();
     _eventNode        = ReadNode(r);
     _key              = r.ReadObject <object>();
     _xid              = r.ReadObject <IgniteGuid?>();
     _newValue         = r.ReadObject <object>();
     _oldValue         = r.ReadObject <object>();
     _hasOldValue      = r.ReadBoolean();
     _hasNewValue      = r.ReadBoolean();
     _subjectId        = r.ReadGuid();
     _closureClassName = r.ReadString();
     _taskName         = r.ReadString();
 }
        /// <summary>
        /// Reads the instance.
        /// </summary>
        internal static TcpDiscoveryIpFinderBase ReadInstance(IBinaryRawReader reader)
        {
            var code = reader.ReadByte();

            switch (code)
            {
                case TypeCodeVmIpFinder:
                    return new TcpDiscoveryStaticIpFinder(reader);

                case TypeCodeMulticastIpFinder:
                    return new TcpDiscoveryMulticastIpFinder(reader);

                default:
                    return null;
            }
        }
Ejemplo n.º 25
0
        public override void InternalFromBinary(IBinaryRawReader reader)
        {
            var version = VersionSerializationHelper.CheckVersionByte(reader, VERSION_NUMBER);

            if (version == 1)
            {
                ResponseCode                        = (SubGridRequestsResponseResult)reader.ReadInt();
                ClusterNode                         = reader.ReadString();
                NumSubgridsProcessed                = reader.ReadLong();
                NumSubgridsExamined                 = reader.ReadLong();
                NumProdDataSubGridsProcessed        = reader.ReadLong();
                NumProdDataSubGridsExamined         = reader.ReadLong();
                NumSurveyedSurfaceSubGridsProcessed = reader.ReadLong();
                NumSurveyedSurfaceSubGridsExamined  = reader.ReadLong();
            }
        }
Ejemplo n.º 26
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();

            SystemRegionInitialSize = reader.ReadLong();
            SystemRegionMaxSize     = reader.ReadLong();
            PageSize         = reader.ReadInt();
            ConcurrencyLevel = reader.ReadInt();
            WalAutoArchiveAfterInactivity = reader.ReadLongAsTimespan();

            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);
            }
        }
Ejemplo n.º 27
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal CacheEvent(IBinaryRawReader r)
     : base(r)
 {
     _cacheName = r.ReadString();
     _partition = r.ReadInt();
     _isNear = r.ReadBoolean();
     _eventNode = ReadNode(r);
     _key = r.ReadObject<object>();
     _xid = IgniteGuid.Read(r);
     _newValue = r.ReadObject<object>();
     _oldValue = r.ReadObject<object>();
     _hasOldValue = r.ReadBoolean();
     _hasNewValue = r.ReadBoolean();
     _subjectId = r.ReadGuid();
     _closureClassName = r.ReadString();
     _taskName = r.ReadString();
 }
Ejemplo n.º 28
0
        /// <summary>
        /// Serialises content from the writer
        /// </summary>
        public override void InternalFromBinary(IBinaryRawReader reader)
        {
            base.InternalFromBinary(reader);

            var version = VersionSerializationHelper.CheckVersionByte(reader, VERSION_NUMBER);

            if (version == 1)
            {
                Mode = (DisplayMode)reader.ReadInt();

                NEECoords = new XYZ();
                NEECoords = NEECoords.FromBinary(reader);

                OTGCellX = reader.ReadInt();
                OTGCellY = reader.ReadInt();
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AffinityFunctionContext"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal AffinityFunctionContext(IBinaryRawReader reader)
        {
            var cnt = reader.ReadInt();

            if (cnt > 0)
            {
                _previousAssignment = new List<List<IClusterNode>>(cnt);

                for (var i = 0; i < cnt; i++)
                    _previousAssignment.Add(IgniteUtils.ReadNodes(reader));
            }

            _backups = reader.ReadInt();
            _currentTopologySnapshot = IgniteUtils.ReadNodes(reader);
            _currentTopologyVersion = new AffinityTopologyVersion(reader.ReadLong(), reader.ReadInt());
            _discoveryEvent = EventReader.Read<DiscoveryEvent>(reader);
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DataRegionConfiguration"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal DataRegionConfiguration(IBinaryRawReader reader)
        {
            Name = reader.ReadString();
            PersistenceEnabled       = reader.ReadBoolean();
            InitialSize              = reader.ReadLong();
            MaxSize                  = reader.ReadLong();
            SwapPath                 = reader.ReadString();
            PageEvictionMode         = (DataPageEvictionMode)reader.ReadInt();
            EvictionThreshold        = reader.ReadDouble();
            EmptyPagesPoolSize       = reader.ReadInt();
            MetricsEnabled           = reader.ReadBoolean();
            MetricsSubIntervalCount  = reader.ReadInt();
            MetricsRateTimeInterval  = reader.ReadLongAsTimespan();
            CheckpointPageBufferSize = reader.ReadLong();

            LazyMemoryAllocation = reader.ReadBoolean();
        }
Ejemplo n.º 31
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DataStorageMetrics"/> class.
        /// </summary>
        public DataStorageMetrics(IBinaryRawReader reader)
        {
            Debug.Assert(reader != null);

            WalLoggingRate                         = reader.ReadFloat();
            WalWritingRate                         = reader.ReadFloat();
            WalArchiveSegments                     = reader.ReadInt();
            WalFsyncTimeAverage                    = reader.ReadFloat();
            LastCheckpointDuration                 = reader.ReadLongAsTimespan();
            LastCheckpointLockWaitDuration         = reader.ReadLongAsTimespan();
            LastCheckpointMarkDuration             = reader.ReadLongAsTimespan();
            LastCheckpointPagesWriteDuration       = reader.ReadLongAsTimespan();
            LastCheckpointFsyncDuration            = reader.ReadLongAsTimespan();
            LastCheckpointTotalPagesNumber         = reader.ReadLong();
            LastCheckpointDataPagesNumber          = reader.ReadLong();
            LastCheckpointCopiedOnWritePagesNumber = reader.ReadLong();
        }
Ejemplo n.º 32
0
        public override void InternalFromBinary(IBinaryRawReader reader)
        {
            var version = VersionSerializationHelper.CheckVersionByte(reader, VERSION_NUMBER);

            if (version == 1)
            {
                if (reader.ReadBoolean())
                {
                    (AttributeFilter ??= new CellPassAttributeFilter()).FromBinary(reader);
                }

                if (reader.ReadBoolean())
                {
                    (SpatialFilter ??= new CellSpatialFilter()).FromBinary(reader);
                }
            }
        }
Ejemplo n.º 33
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QueryEntity"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal QueryEntity(IBinaryRawReader reader)
        {
            KeyTypeName   = reader.ReadString();
            ValueTypeName = reader.ReadString();

            var count = reader.ReadInt();

            Fields = count == 0 ? null : Enumerable.Range(0, count).Select(x =>
                                                                           new QueryField(reader.ReadString(), reader.ReadString())).ToList();

            count   = reader.ReadInt();
            Aliases = count == 0 ? null : Enumerable.Range(0, count)
                      .Select(x => new QueryAlias(reader.ReadString(), reader.ReadString())).ToList();

            count   = reader.ReadInt();
            Indexes = count == 0 ? null : Enumerable.Range(0, count).Select(x => new QueryIndex(reader)).ToList();
        }
Ejemplo n.º 34
0
        /// <summary>
        /// Serialises content from the writer
        /// </summary>
        public override void InternalFromBinary(IBinaryRawReader reader)
        {
            base.InternalFromBinary(reader);

            var version = VersionSerializationHelper.CheckVersionByte(reader, VERSION_NUMBER);

            if (version == 1)
            {
                AbovePassTargetRangeColour  = Color.FromArgb(reader.ReadInt());
                WithinPassTargetRangeColour = Color.FromArgb(reader.ReadInt());
                BelowPassTargetRangeColour  = Color.FromArgb(reader.ReadInt());

                UseMachineTargetPass = reader.ReadBoolean();

                TargetPassCountRange.FromBinary(reader);
            }
        }
Ejemplo n.º 35
0
        public override void InternalFromBinary(IBinaryRawReader reader)
        {
            base.InternalFromBinary(reader);

            var version = VersionSerializationHelper.CheckVersionByte(reader, VERSION_NUMBER);

            if (version == 1)
            {
                NodeId            = reader.ReadGuid() ?? Guid.Empty;
                RequestDescriptor = reader.ReadGuid() ?? Guid.Empty;

                if (reader.ReadBoolean())
                {
                    Payload = new SerialisedByteArrayWrapper(reader.ReadByteArray());
                }
            }
        }
Ejemplo n.º 36
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CacheConfiguration"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal CacheConfiguration(IBinaryRawReader reader)
        {
            AtomicityMode        = (CacheAtomicityMode)reader.ReadInt();
            AtomicWriteOrderMode = (CacheAtomicWriteOrderMode)reader.ReadInt();
            Backups           = reader.ReadInt();
            CacheMode         = (CacheMode)reader.ReadInt();
            CopyOnRead        = reader.ReadBoolean();
            EagerTtl          = reader.ReadBoolean();
            EnableSwap        = reader.ReadBoolean();
            EvictSynchronized = reader.ReadBoolean();
            EvictSynchronizedConcurrencyLevel = reader.ReadInt();
            EvictSynchronizedKeyBufferSize    = reader.ReadInt();
            EvictSynchronizedTimeout          = reader.ReadLongAsTimespan();
            Invalidate                   = reader.ReadBoolean();
            KeepBinaryInStore            = reader.ReadBoolean();
            LoadPreviousValue            = reader.ReadBoolean();
            LockTimeout                  = reader.ReadLongAsTimespan();
            LongQueryWarningTimeout      = reader.ReadLongAsTimespan();
            MaxConcurrentAsyncOperations = reader.ReadInt();
            MaxEvictionOverflowRatio     = reader.ReadFloat();
            MemoryMode                   = (CacheMemoryMode)reader.ReadInt();
            Name                        = reader.ReadString();
            OffHeapMaxMemory            = reader.ReadLong();
            ReadFromBackup              = reader.ReadBoolean();
            RebalanceBatchSize          = reader.ReadInt();
            RebalanceDelay              = reader.ReadLongAsTimespan();
            RebalanceMode               = (CacheRebalanceMode)reader.ReadInt();
            RebalanceThrottle           = reader.ReadLongAsTimespan();
            RebalanceTimeout            = reader.ReadLongAsTimespan();
            SqlEscapeAll                = reader.ReadBoolean();
            SqlOnheapRowCacheSize       = reader.ReadInt();
            StartSize                   = reader.ReadInt();
            WriteBehindBatchSize        = reader.ReadInt();
            WriteBehindEnabled          = reader.ReadBoolean();
            WriteBehindFlushFrequency   = reader.ReadLongAsTimespan();
            WriteBehindFlushSize        = reader.ReadInt();
            WriteBehindFlushThreadCount = reader.ReadInt();
            WriteSynchronizationMode    = (CacheWriteSynchronizationMode)reader.ReadInt();
            ReadThrough                 = reader.ReadBoolean();
            WriteThrough                = reader.ReadBoolean();
            CacheStoreFactory           = reader.ReadObject <IFactory <ICacheStore> >();

            var count = reader.ReadInt();

            QueryEntities = count == 0 ? null : Enumerable.Range(0, count).Select(x => new QueryEntity(reader)).ToList();
        }
Ejemplo n.º 37
0
        /// <summary>
        /// Serialises content from the writer
        /// </summary>
        public override void InternalFromBinary(IBinaryRawReader reader)
        {
            base.InternalFromBinary(reader);

            var version = VersionSerializationHelper.CheckVersionByte(reader, VERSION_NUMBER);

            if (version == 1)
            {
                AboveMaxLevelColour = Color.FromArgb(reader.ReadInt());
                WithinLevelsColour  = Color.FromArgb(reader.ReadInt());
                BelowMinLevelColour = Color.FromArgb(reader.ReadInt());

                UseMachineTempWarningLevels = reader.ReadBoolean();

                TemperatureLevels.FromBinary(reader);
            }
        }
Ejemplo n.º 38
0
        /// <summary>
        /// Serializes content from the writer
        /// </summary>
        public override void InternalFromBinary(IBinaryRawReader reader)
        {
            base.InternalFromBinary(reader);

            var version = VersionSerializationHelper.CheckVersionByte(reader, VERSION_NUMBER);

            if (version == 1)
            {
                GridInterval     = reader.ReadDouble();
                GridReportOption = (GridReportOption)reader.ReadInt();
                StartNorthing    = reader.ReadDouble();
                StartEasting     = reader.ReadDouble();
                EndNorthing      = reader.ReadDouble();
                EndEasting       = reader.ReadDouble();
                Azimuth          = reader.ReadDouble();
            }
        }
Ejemplo n.º 39
0
        /// <summary>
        /// Reads the instance.
        /// </summary>
        internal static IAffinityFunction Read(IBinaryRawReader reader)
        {
            Debug.Assert(reader != null);

            var typeCode = reader.ReadByte();

            if (typeCode == TypeCodeNull)
            {
                return(null);
            }

            var partitions    = reader.ReadInt();
            var exclNeighbors = reader.ReadBoolean();
            var overrideFlags = (UserOverrides)reader.ReadByte();
            var userFunc      = reader.ReadObjectEx <IAffinityFunction>();

            if (userFunc != null)
            {
                Debug.Assert(overrideFlags != UserOverrides.None);

                var rendezvous = userFunc as RendezvousAffinityFunction;
                if (rendezvous != null)
                {
                    rendezvous.Partitions           = partitions;
                    rendezvous.ExcludeNeighbors     = exclNeighbors;
                    rendezvous.AffinityBackupFilter = ReadBackupFilter(reader);
                }

                return(userFunc);
            }

            Debug.Assert(overrideFlags == UserOverrides.None);

            if (typeCode != TypeCodeRendezvous)
            {
                throw new InvalidOperationException("Invalid AffinityFunction type code: " + typeCode);
            }

            return(new RendezvousAffinityFunction
            {
                Partitions = partitions,
                ExcludeNeighbors = exclNeighbors,
                AffinityBackupFilter = ReadBackupFilter(reader)
            });
        }
Ejemplo n.º 40
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ClientClusterNode"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public ClientClusterNode(IBinaryRawReader reader)
        {
            var id = reader.ReadGuid();

            Debug.Assert(id.HasValue);

            _id = id.Value;

            _attrs        = ClusterNodeImpl.ReadAttributes(reader);
            _addrs        = reader.ReadCollectionAsList <string>().AsReadOnly();
            _hosts        = reader.ReadCollectionAsList <string>().AsReadOnly();
            _order        = reader.ReadLong();
            _isLocal      = reader.ReadBoolean();
            _isDaemon     = reader.ReadBoolean();
            _isClient     = reader.ReadBoolean();
            _consistentId = reader.ReadObject <object>();
            _version      = new IgniteProductVersion(reader);
        }
Ejemplo n.º 41
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ClusterNodeImpl"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public ClusterNodeImpl(IBinaryRawReader reader)
        {
            var id = reader.ReadGuid();

            Debug.Assert(id.HasValue);

            _id = id.Value;

            _attrs    = reader.ReadDictionaryAsGeneric <string, object>().AsReadOnly();
            _addrs    = reader.ReadCollectionAsList <string>().AsReadOnly();
            _hosts    = reader.ReadCollectionAsList <string>().AsReadOnly();
            _order    = reader.ReadLong();
            _isLocal  = reader.ReadBoolean();
            _isDaemon = reader.ReadBoolean();
            _isClient = reader.ReadBoolean();

            _metrics = reader.ReadBoolean() ? new ClusterMetricsImpl(reader) : null;
        }
Ejemplo n.º 42
0
        /// <summary>
        /// Serializes content from the writer
        /// </summary>
        public override void InternalFromBinary(IBinaryRawReader reader)
        {
            base.InternalFromBinary(reader);

            var version = VersionSerializationHelper.CheckVersionByte(reader, VERSION_NUMBER);

            if (version == 1)
            {
                var pointCount = reader.ReadInt();
                Points = new List <StationOffsetPoint>();
                for (int i = 0; i < pointCount; i++)
                {
                    StationOffsetPoint point = null;
                    (point = new StationOffsetPoint()).FromBinary(reader);
                    Points.Add(point);
                }
            }
        }
Ejemplo n.º 43
0
        /// <summary>
        /// Serializes content from the writer
        /// </summary>
        public override void InternalFromBinary(IBinaryRawReader reader)
        {
            base.InternalFromBinary(reader);

            var version = VersionSerializationHelper.CheckVersionByte(reader, VERSION_NUMBER);

            if (version == 1)
            {
                CellSize = reader.ReadDouble();

                var count = reader.ReadInt();
                ProfilePathNEE = new XYZ[count];
                for (int i = 0; i < count; i++)
                {
                    ProfilePathNEE[i] = ProfilePathNEE[i].FromBinary(reader);
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ClientConnectorConfiguration"/> class.
        /// </summary>
        internal ClientConnectorConfiguration(IBinaryRawReader reader)
        {
            Debug.Assert(reader != null);

            Host = reader.ReadString();
            Port = reader.ReadInt();
            PortRange = reader.ReadInt();
            SocketSendBufferSize = reader.ReadInt();
            SocketReceiveBufferSize = reader.ReadInt();
            TcpNoDelay = reader.ReadBoolean();
            MaxOpenCursorsPerConnection = reader.ReadInt();
            ThreadPoolSize = reader.ReadInt();
            IdleTimeout = reader.ReadLongAsTimespan();

            ThinClientEnabled = reader.ReadBoolean();
            OdbcEnabled = reader.ReadBoolean();
            JdbcEnabled = reader.ReadBoolean();
        }
Ejemplo n.º 45
0
 /// <summary>
 /// Serializes content of the cell from the writer
 /// </summary>
 public void FromBinary(IBinaryRawReader reader)
 {
     EventElevationMappingMode = (ElevationMappingMode)reader.ReadByte();
     EventInAvoidZoneState     = reader.ReadByte();
     EventDesignNameID         = reader.ReadInt();
     EventVibrationState       = (VibrationState)reader.ReadByte();
     EventAutoVibrationState   = (AutoVibrationState)reader.ReadByte();
     EventMachineGear          = (MachineGear)reader.ReadByte();
     EventMachineRMVThreshold  = reader.ReadShort();
     EventMachineAutomatics    = (AutomaticsType)reader.ReadByte();
     PositioningTechnology     = (PositioningTech)reader.ReadByte();
     GPSTolerance          = (ushort)reader.ReadInt();
     GPSAccuracy           = (GPSAccuracy)reader.ReadByte();
     MapReset_PriorDate    = DateTime.FromBinary(reader.ReadLong());
     MapReset_DesignNameID = reader.ReadInt();
     LayerID    = (ushort)reader.ReadInt();
     EventFlags = reader.ReadByte();
 }
Ejemplo n.º 46
0
        /// <summary>
        /// Reads the partitions assignment from a stream.
        /// </summary>
        /// <param name="stream">The stream.</param>
        /// <param name="marsh">The marshaller.</param>
        /// <returns>Partitions assignment.</returns>
        internal static IEnumerable <IEnumerable <IClusterNode> > ReadPartitions(IBinaryStream stream, Marshaller marsh)
        {
            Debug.Assert(stream != null);
            Debug.Assert(marsh != null);

            IBinaryRawReader reader = marsh.StartUnmarshal(stream);

            var partCnt = reader.ReadInt();

            var res = new List <IEnumerable <IClusterNode> >(partCnt);

            for (var i = 0; i < partCnt; i++)
            {
                res.Add(IgniteUtils.ReadNodes(reader));
            }

            return(res);
        }
Ejemplo n.º 47
0
        /// <summary>
        /// Writes .NET-specific fields.
        /// </summary>
        private static ICollection <int> ReadDotNetFields(IBinaryRawReader reader)
        {
            int count = reader.ReadInt();

            if (count <= 0)
            {
                return(null);
            }

            var res = new HashSet <int>();

            for (int i = 0; i < count; i++)
            {
                res.Add(reader.ReadInt());
            }

            return(res);
        }
Ejemplo n.º 48
0
#pragma warning restore 618

        /// <summary>
        /// Gets the data region metrics.
        /// </summary>
        public ICollection <IDataRegionMetrics> GetDataRegionMetrics()
        {
            return(DoInOp(OpDataRegionMetrics, stream =>
            {
                IBinaryRawReader reader = Marshaller.StartUnmarshal(stream, false);

                var cnt = reader.ReadInt();

                var res = new List <IDataRegionMetrics>(cnt);

                for (int i = 0; i < cnt; i++)
                {
                    res.Add(new DataRegionMetrics(reader));
                }

                return res;
            }));
        }
Ejemplo n.º 49
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BinaryType" /> class.
 /// </summary>
 /// <param name="reader">The reader.</param>
 public BinaryType(IBinaryRawReader reader)
 {
     TypeId = reader.ReadInt();
     TypeName = reader.ReadString();
     AffinityKeyFieldName = reader.ReadString();
     _fields = reader.ReadDictionaryAsGeneric<string, int>();
 }
Ejemplo n.º 50
0
 /// <summary>
 /// Reads the policy.
 /// </summary>
 public static IExpiryPolicy ReadPolicy(IBinaryRawReader reader)
 {
     return new ExpiryPolicy(ConvertDuration(reader.ReadLong()), ConvertDuration(reader.ReadLong()),
         ConvertDuration(reader.ReadLong()));
 }
Ejemplo n.º 51
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal CheckpointEvent(IBinaryRawReader r) : base(r)
 {
     _key = r.ReadString();
 }
Ejemplo n.º 52
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QueryEntity"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal QueryEntity(IBinaryRawReader reader)
        {
            KeyTypeName = reader.ReadString();
            ValueTypeName = reader.ReadString();

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

            count = reader.ReadInt();
            Aliases = count == 0 ? null : Enumerable.Range(0, count)
                .Select(x=> new QueryAlias(reader.ReadString(), reader.ReadString())).ToList();

            count = reader.ReadInt();
            Indexes = count == 0 ? null : Enumerable.Range(0, count).Select(x => new QueryIndex(reader)).ToList();
        }
Ejemplo n.º 53
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CacheMetricsImpl"/> class.
 /// </summary>
 /// <param name="reader">The reader.</param>
 public CacheMetricsImpl(IBinaryRawReader reader)
 {
     _cacheHits = reader.ReadLong();
     _cacheHitPercentage = reader.ReadFloat();
     _cacheMisses = reader.ReadLong();
     _cacheMissPercentage = reader.ReadFloat();
     _cacheGets = reader.ReadLong();
     _cachePuts = reader.ReadLong();
     _cacheRemovals = reader.ReadLong();
     _cacheEvictions = reader.ReadLong();
     _averageGetTime = reader.ReadFloat();
     _averagePutTime = reader.ReadFloat();
     _averageRemoveTime = reader.ReadFloat();
     _averageTxCommitTime = reader.ReadFloat();
     _averageTxRollbackTime = reader.ReadFloat();
     _cacheTxCommits = reader.ReadLong();
     _cacheTxRollbacks = reader.ReadLong();
     _cacheName = reader.ReadString();
     _overflowSize = reader.ReadLong();
     _offHeapGets = reader.ReadLong();
     _offHeapPuts = reader.ReadLong();
     _offHeapRemovals = reader.ReadLong();
     _offHeapEvictions = reader.ReadLong();
     _offHeapHits = reader.ReadLong();
     _offHeapHitPercentage = reader.ReadFloat();
     _offHeapMisses = reader.ReadLong();
     _offHeapMissPercentage = reader.ReadFloat();
     _offHeapEntriesCount = reader.ReadLong();
     _offHeapPrimaryEntriesCount = reader.ReadLong();
     _offHeapBackupEntriesCount = reader.ReadLong();
     _offHeapAllocatedSize = reader.ReadLong();
     _offHeapMaxSize = reader.ReadLong();
     _swapGets = reader.ReadLong();
     _swapPuts = reader.ReadLong();
     _swapRemovals = reader.ReadLong();
     _swapHits = reader.ReadLong();
     _swapMisses = reader.ReadLong();
     _swapEntriesCount = reader.ReadLong();
     _swapSize = reader.ReadLong();
     _swapHitPercentage = reader.ReadFloat();
     _swapMissPercentage = reader.ReadFloat();
     _size = reader.ReadInt();
     _keySize = reader.ReadInt();
     _isEmpty = reader.ReadBoolean();
     _dhtEvictQueueCurrentSize = reader.ReadInt();
     _txThreadMapSize = reader.ReadInt();
     _txXidMapSize = reader.ReadInt();
     _txCommitQueueSize = reader.ReadInt();
     _txPrepareQueueSize = reader.ReadInt();
     _txStartVersionCountsSize = reader.ReadInt();
     _txCommittedVersionsSize = reader.ReadInt();
     _txRolledbackVersionsSize = reader.ReadInt();
     _txDhtThreadMapSize = reader.ReadInt();
     _txDhtXidMapSize = reader.ReadInt();
     _txDhtCommitQueueSize = reader.ReadInt();
     _txDhtPrepareQueueSize = reader.ReadInt();
     _txDhtStartVersionCountsSize = reader.ReadInt();
     _txDhtCommittedVersionsSize = reader.ReadInt();
     _txDhtRolledbackVersionsSize = reader.ReadInt();
     _isWriteBehindEnabled = reader.ReadBoolean();
     _writeBehindFlushSize = reader.ReadInt();
     _writeBehindFlushThreadCount = reader.ReadInt();
     _writeBehindFlushFrequency = reader.ReadLong();
     _writeBehindStoreBatchSize = reader.ReadInt();
     _writeBehindTotalCriticalOverflowCount = reader.ReadInt();
     _writeBehindCriticalOverflowCount = reader.ReadInt();
     _writeBehindErrorRetryCount = reader.ReadInt();
     _writeBehindBufferSize = reader.ReadInt();
     _keyType = reader.ReadString();
     _valueType = reader.ReadString();
     _isStoreByValue = reader.ReadBoolean();
     _isStatisticsEnabled = reader.ReadBoolean();
     _isManagementEnabled = reader.ReadBoolean();
     _isReadThrough = reader.ReadBoolean();
     _isWriteThrough = reader.ReadBoolean();
 }
Ejemplo n.º 54
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CacheConfiguration"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal CacheConfiguration(IBinaryRawReader reader)
        {
            AtomicityMode = (CacheAtomicityMode) reader.ReadInt();
            AtomicWriteOrderMode = (CacheAtomicWriteOrderMode) reader.ReadInt();
            Backups = reader.ReadInt();
            CacheMode = (CacheMode) reader.ReadInt();
            CopyOnRead = reader.ReadBoolean();
            EagerTtl = reader.ReadBoolean();
            EnableSwap = reader.ReadBoolean();
            EvictSynchronized = reader.ReadBoolean();
            EvictSynchronizedConcurrencyLevel = reader.ReadInt();
            EvictSynchronizedKeyBufferSize = reader.ReadInt();
            EvictSynchronizedTimeout = reader.ReadLongAsTimespan();
            Invalidate = reader.ReadBoolean();
            KeepBinaryInStore = reader.ReadBoolean();
            LoadPreviousValue = reader.ReadBoolean();
            LockTimeout = reader.ReadLongAsTimespan();
            LongQueryWarningTimeout = reader.ReadLongAsTimespan();
            MaxConcurrentAsyncOperations = reader.ReadInt();
            MaxEvictionOverflowRatio = reader.ReadFloat();
            MemoryMode = (CacheMemoryMode) reader.ReadInt();
            Name = reader.ReadString();
            OffHeapMaxMemory = reader.ReadLong();
            ReadFromBackup = reader.ReadBoolean();
            RebalanceBatchSize = reader.ReadInt();
            RebalanceDelay = reader.ReadLongAsTimespan();
            RebalanceMode = (CacheRebalanceMode) reader.ReadInt();
            RebalanceThrottle = reader.ReadLongAsTimespan();
            RebalanceTimeout = reader.ReadLongAsTimespan();
            SqlEscapeAll = reader.ReadBoolean();
            SqlOnheapRowCacheSize = reader.ReadInt();
            StartSize = reader.ReadInt();
            WriteBehindBatchSize = reader.ReadInt();
            WriteBehindEnabled = reader.ReadBoolean();
            WriteBehindFlushFrequency = reader.ReadLongAsTimespan();
            WriteBehindFlushSize = reader.ReadInt();
            WriteBehindFlushThreadCount = reader.ReadInt();
            WriteSynchronizationMode = (CacheWriteSynchronizationMode) reader.ReadInt();
            CacheStoreFactory = reader.ReadObject<IFactory<ICacheStore>>();

            var count = reader.ReadInt();
            QueryEntities = count == 0 ? null : Enumerable.Range(0, count).Select(x => new QueryEntity(reader)).ToList();
        }
Ejemplo n.º 55
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal SwapSpaceEvent(IBinaryRawReader r) : base(r)
 {
     _space = r.ReadString();
 }
Ejemplo n.º 56
0
        /// <summary>
        /// Reads the instance.
        /// </summary>
        internal static IAffinityFunction Read(IBinaryRawReader reader)
        {
            AffinityFunctionBase fun;

            var typeCode = reader.ReadByte();
            switch (typeCode)
            {
                case TypeCodeNull:
                    return null;
                case TypeCodeFair:
                    fun = new FairAffinityFunction();
                    break;
                case TypeCodeRendezvous:
                    fun = new RendezvousAffinityFunction();
                    break;
                case TypeCodeUser:
                    var f = reader.ReadObject<IAffinityFunction>();
                    reader.ReadInt(); // skip partition count

                    return f;
                default:
                    throw new InvalidOperationException("Invalid AffinityFunction type code: " + typeCode);
            }

            fun.Partitions = reader.ReadInt();
            fun.ExcludeNeighbors = reader.ReadBoolean();

            return fun;
        }
Ejemplo n.º 57
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BinaryType" /> class.
 /// </summary>
 /// <param name="reader">The reader.</param>
 public BinaryType(IBinaryRawReader reader)
 {
     _typeId = reader.ReadInt();
     _typeName = reader.ReadString();
     _affinityKeyFieldName = reader.ReadString();
     _fields = reader.ReadDictionaryAsGeneric<string, int>();
     _isEnum = reader.ReadBoolean();
 }
Ejemplo n.º 58
0
        /// <summary>
        /// Reads an instance.
        /// </summary>
        internal static EvictionPolicyBase Read(IBinaryRawReader reader)
        {
            EvictionPolicyBase p;

            switch (reader.ReadByte())
            {
                case 0:
                    return null;
                case 1:
                    p = new FifoEvictionPolicy();
                    break;
                case 2:
                    p = new LruEvictionPolicy();
                    break;
                default:
                    throw new InvalidOperationException("Unsupported eviction policy.");
            }

            p.BatchSize = reader.ReadInt();
            p.MaxSize = reader.ReadInt();
            p.MaxMemorySize = reader.ReadLong();

            return p;
        }
Ejemplo n.º 59
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CacheEntryProcessorHolder"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public CacheEntryProcessorHolder(IBinaryRawReader reader)
        {
            _proc = reader.ReadObject<object>();
            _arg = reader.ReadObject<object>();

            _processFunc = GetProcessFunc(_proc);

            var kvTypes = DelegateTypeDescriptor.GetCacheEntryProcessorTypes(_proc.GetType());

            _entryCtor = MutableCacheEntry.GetCtor(kvTypes.Item1, kvTypes.Item2);
        }
Ejemplo n.º 60
0
 /// <summary>
 /// Reads the expiry policy factory.
 /// </summary>
 public static IFactory<IExpiryPolicy> ReadPolicyFactory(IBinaryRawReader reader)
 {
     return reader.ReadBoolean() ? new ExpiryPolicyFactory(ReadPolicy(reader)) : null;
 }