/// <summary>
 /// Initializes a new instance of the <see cref="PortableMetadataImpl" /> class.
 /// </summary>
 /// <param name="reader">The reader.</param>
 public PortableMetadataImpl(IPortableRawReader reader)
 {
     TypeId               = reader.ReadInt();
     TypeName             = reader.ReadString();
     AffinityKeyFieldName = reader.ReadString();
     _fields              = reader.ReadGenericDictionary <string, int>();
 }
Esempio n. 2
0
        /// <summary>
        /// Creates an event instance by type id.
        /// </summary>
        /// <param name="clsId">Type id.</param>
        /// <param name="reader">Reader.</param>
        /// <returns>Created and deserialized instance.</returns>
        /// <exception cref="System.InvalidOperationException">Invalid event class id:  + clsId</exception>
        private static IEvent CreateInstance(int clsId, IPortableRawReader reader)
        {
            switch (clsId)
            {
            case 2: return(new CacheEvent(reader));

            case 3: return(new CacheQueryExecutedEvent(reader));

            case 4: return(new CacheQueryReadEvent(reader));

            case 5: return(new CacheRebalancingEvent(reader));

            case 6: return(new CheckpointEvent(reader));

            case 7: return(new DiscoveryEvent(reader));

            case 8: return(new JobEvent(reader));

            case 9: return(new SwapSpaceEvent(reader));

            case 10: return(new TaskEvent(reader));
            }

            throw new InvalidOperationException("Invalid event class id: " + clsId);
        }
Esempio n. 3
0
        /// <summary>
        /// Reads node collection from stream.
        /// </summary>
        /// <param name="reader">Reader.</param>
        /// <param name="pred">The predicate.</param>
        /// <returns> Nodes list or null. </returns>
        public static List <IClusterNode> ReadNodes(IPortableRawReader reader, Func <ClusterNodeImpl, bool> pred = null)
        {
            var cnt = reader.ReadInt();

            if (cnt < 0)
            {
                return(null);
            }

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

            var ignite = ((PortableReaderImpl)reader).Marshaller.Ignite;

            if (pred == null)
            {
                for (var i = 0; i < cnt; i++)
                {
                    res.Add(ignite.GetNode(reader.ReadGuid()));
                }
            }
            else
            {
                for (var i = 0; i < cnt; i++)
                {
                    var node = ignite.GetNode(reader.ReadGuid());

                    if (pred(node))
                    {
                        res.Add(node);
                    }
                }
            }

            return(res);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="InteropDotNetConfiguration"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public InteropDotNetConfiguration(IPortableReader reader)
        {
            IPortableRawReader rawReader = reader.RawReader();

            PortableCfg = rawReader.ReadObject <InteropDotNetPortableConfiguration>();

            Assemblies = (List <string>)rawReader.ReadGenericCollection <string>();
        }
Esempio n. 5
0
        /// <summary>
        /// Reads this object from the given reader.
        /// </summary>
        /// <param name="r">Reader.</param>
        public static IgniteGuid ReadPortable(IPortableRawReader r)
        {
            var guid = r.ReadGuid();

            return(guid == null
                ? new IgniteGuid(Guid.Empty, 0)
                : new IgniteGuid(guid.Value, r.ReadLong()));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TransactionMetricsImpl"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public TransactionMetricsImpl(IPortableRawReader reader)
        {
            CommitTime = reader.ReadDate() ?? default(DateTime);
            RollbackTime = reader.ReadDate() ?? default(DateTime);

            TxCommits = reader.ReadInt();
            TxRollbacks = reader.ReadInt();
        }
Esempio n. 7
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal TaskEvent(IPortableRawReader r) : base(r)
 {
     _taskName = r.ReadString();
     _taskClassName = r.ReadString();
     _taskSessionId = IgniteGuid.ReadPortable(r);
     _internal = r.ReadBoolean();
     _subjectId = r.ReadGuid() ?? Guid.Empty;
 }
Esempio n. 8
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal TaskEvent(IPortableRawReader r) : base(r)
 {
     _taskName      = r.ReadString();
     _taskClassName = r.ReadString();
     _taskSessionId = IgniteGuid.ReadPortable(r);
     _internal      = r.ReadBoolean();
     _subjectId     = r.ReadGuid() ?? Guid.Empty;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="TransactionMetricsImpl"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public TransactionMetricsImpl(IPortableRawReader reader)
        {
            CommitTime   = reader.ReadDate() ?? default(DateTime);
            RollbackTime = reader.ReadDate() ?? default(DateTime);

            TxCommits   = reader.ReadInt();
            TxRollbacks = reader.ReadInt();
        }
Esempio n. 10
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="r">The reader to read data from.</param>
        internal DiscoveryEvent(IPortableRawReader r) : base(r)
        {
            _eventNode       = ReadNode(r);
            _topologyVersion = r.ReadLong();

            var nodes = IgniteUtils.ReadNodes(r);

            _topologyNodes = nodes == null ? null : new ReadOnlyCollection <IClusterNode>(nodes);
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal CacheQueryExecutedEvent(IPortableRawReader r) : base(r)
 {
     _queryType = r.ReadString();
     _cacheName = r.ReadString();
     _className = r.ReadString();
     _clause = r.ReadString();
     _subjectId = r.ReadGuid() ?? Guid.Empty;
     _taskName = r.ReadString();
 }
Esempio n. 12
0
        /** <inheritDoc /> */
        public ICacheMetrics GetMetrics()
        {
            return(DoInOp((int)CacheOp.Metrics, stream =>
            {
                IPortableRawReader reader = Marshaller.StartUnmarshal(stream, false);

                return new CacheMetricsImpl(reader);
            }));
        }
Esempio n. 13
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal CacheRebalancingEvent(IPortableRawReader 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(IPortableRawReader r) : base(r)
 {
     _queryType = r.ReadString();
     _cacheName = r.ReadString();
     _className = r.ReadString();
     _clause    = r.ReadString();
     _subjectId = r.ReadGuid() ?? Guid.Empty;
     _taskName  = r.ReadString();
 }
Esempio n. 15
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal JobEvent(IPortableRawReader r) : base(r)
 {
     _taskName = r.ReadString();
     _taskClassName = r.ReadString();
     _taskSessionId = IgniteGuid.ReadPortable(r);
     _jobId = IgniteGuid.ReadPortable(r);
     _taskNode = ReadNode(r);
     _taskSubjectId = r.ReadGuid() ?? Guid.Empty;
 }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="r">The reader to read data from.</param>
        internal DiscoveryEvent(IPortableRawReader r) : base(r)
        {
            _eventNode = ReadNode(r);
            _topologyVersion = r.ReadLong();

            var nodes = IgniteUtils.ReadNodes(r);

            _topologyNodes = nodes == null ? null : new ReadOnlyCollection<IClusterNode>(nodes);
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal CacheRebalancingEvent(IPortableRawReader r) : base(r)
 {
     _cacheName = r.ReadString();
     _partition = r.ReadInt();
     _discoveryNode = ReadNode(r);
     _discoveryEventType = r.ReadInt();
     _discoveryEventName = r.ReadString();
     _discoveryTimestamp = r.ReadLong();
 }
Esempio n. 18
0
        /** <inheritDoc /> */
        public ITransactionMetrics GetMetrics()
        {
            return(DoInOp(OpMetrics, stream =>
            {
                IPortableRawReader reader = Marshaller.StartUnmarshal(stream, false);

                return new TransactionMetricsImpl(reader);
            }));
        }
Esempio n. 19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CacheMetricsImpl"/> class.
 /// </summary>
 /// <param name="reader">The reader.</param>
 public CacheMetricsImpl(IPortableRawReader 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();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CacheMetricsImpl"/> class.
 /// </summary>
 /// <param name="reader">The reader.</param>
 public CacheMetricsImpl(IPortableRawReader 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();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceContext"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public ServiceContext(IPortableRawReader reader)
        {
            Debug.Assert(reader != null);

            Name = reader.ReadString();
            ExecutionId = reader.ReadGuid() ?? Guid.Empty;
            IsCancelled = reader.ReadBoolean();
            CacheName = reader.ReadString();
            AffinityKey = reader.ReadObject<object>();
        }
Esempio n. 22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceContext"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public ServiceContext(IPortableRawReader 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="InteropDotNetPortableConfiguration"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public InteropDotNetPortableConfiguration(IPortableReader reader)
        {
            IPortableRawReader rawReader = reader.RawReader();

            TypeConfigurations = rawReader.ReadGenericCollection <InteropDotNetPortableTypeConfiguration>();
            Types                   = rawReader.ReadGenericCollection <string>();
            DefaultNameMapper       = rawReader.ReadString();
            DefaultIdMapper         = rawReader.ReadString();
            DefaultSerializer       = rawReader.ReadString();
            DefaultMetadataEnabled  = rawReader.ReadBoolean();
            DefaultKeepDeserialized = rawReader.ReadBoolean();
        }
Esempio n. 24
0
        /// <summary>
        /// Updates the node information from stream.
        /// </summary>
        /// <param name="memPtr">Stream ptr.</param>
        public void UpdateNodeInfo(long memPtr)
        {
            var stream = IgniteManager.Memory.Get(memPtr).Stream();

            IPortableRawReader reader = Marshaller.StartUnmarshal(stream, false);

            var node = new ClusterNodeImpl(reader);

            node.Init(this);

            _nodes[node.Id] = node;
        }
Esempio n. 25
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal CacheQueryReadEvent(IPortableRawReader r) : base(r)
 {
     _queryType = r.ReadString();
     _cacheName = r.ReadString();
     _className = r.ReadString();
     _clause    = r.ReadString();
     _subjectId = r.ReadGuid() ?? Guid.Empty;
     _taskName  = r.ReadString();
     _key       = r.ReadObject <object>();
     _value     = r.ReadObject <object>();
     _oldValue  = r.ReadObject <object>();
     _row       = r.ReadObject <object>();
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal CacheQueryReadEvent(IPortableRawReader r) : base(r)
 {
     _queryType = r.ReadString();
     _cacheName = r.ReadString();
     _className = r.ReadString();
     _clause = r.ReadString();
     _subjectId = r.ReadGuid() ?? Guid.Empty;
     _taskName = r.ReadString();
     _key = r.ReadObject<object>();
     _value = r.ReadObject<object>();
     _oldValue = r.ReadObject<object>();
     _row = r.ReadObject<object>();
 }
Esempio n. 27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ClusterNodeImpl"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public ClusterNodeImpl(IPortableRawReader reader)
        {
            _id = reader.ReadGuid() ?? default(Guid);

            _attrs  = reader.ReadGenericDictionary <string, object>().AsReadOnly();
            _addrs  = reader.ReadGenericCollection <string>().AsReadOnly();
            _hosts  = reader.ReadGenericCollection <string>().AsReadOnly();
            _order  = reader.ReadLong();
            _local  = reader.ReadBoolean();
            _daemon = reader.ReadBoolean();

            _metrics = reader.ReadBoolean() ? new ClusterMetricsImpl(reader) : null;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="InteropDotNetPortableTypeConfiguration"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public InteropDotNetPortableTypeConfiguration(IPortableReader reader)
        {
            IPortableRawReader rawReader = reader.RawReader();

            AssemblyName         = rawReader.ReadString();
            TypeName             = rawReader.ReadString();
            NameMapper           = rawReader.ReadString();
            IdMapper             = rawReader.ReadString();
            Serializer           = rawReader.ReadString();
            AffinityKeyFieldName = rawReader.ReadString();
            MetadataEnabled      = rawReader.ReadObject <bool?>();
            KeepDeserialized     = rawReader.ReadObject <bool?>();
        }
Esempio n. 29
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EventBase"/> class.
        /// </summary>
        /// <param name="r">The reader to read data from.</param>
        protected EventBase(IPortableRawReader r)
        {
            _id = IgniteGuid.ReadPortable(r);

            _localOrder = r.ReadLong();

            _node = ReadNode(r);

            _message   = r.ReadString();
            _type      = r.ReadInt();
            _name      = r.ReadString();
            _timeStamp = r.ReadDate() ?? DateTime.Now;
        }
Esempio n. 30
0
        /// <summary>
        /// Refresh cluster node metrics.
        /// </summary>
        /// <param name="nodeId">Node</param>
        /// <param name="lastUpdateTime"></param>
        /// <returns></returns>
        internal ClusterMetricsImpl RefreshClusterNodeMetrics(Guid nodeId, long lastUpdateTime)
        {
            return(DoOutInOp(OpNodeMetrics, writer =>
            {
                writer.WriteGuid(nodeId);
                writer.WriteLong(lastUpdateTime);
            }, stream =>
            {
                IPortableRawReader reader = Marshaller.StartUnmarshal(stream, false);

                return reader.ReadBoolean() ? new ClusterMetricsImpl(reader) : null;
            }
                             ));
        }
Esempio n. 31
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal CacheEvent(IPortableRawReader r) : base(r)
 {
     _cacheName        = r.ReadString();
     _partition        = r.ReadInt();
     _isNear           = r.ReadBoolean();
     _eventNode        = ReadNode(r);
     _key              = r.ReadObject <object>();
     _xid              = IgniteGuid.ReadPortable(r);
     _lockId           = r.ReadObject <object>();
     _newValue         = r.ReadObject <object>();
     _oldValue         = r.ReadObject <object>();
     _hasOldValue      = r.ReadBoolean();
     _hasNewValue      = r.ReadBoolean();
     _subjectId        = r.ReadGuid() ?? Guid.Empty;
     _closureClassName = r.ReadString();
     _taskName         = r.ReadString();
 }
Esempio n. 32
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal CacheEvent(IPortableRawReader r) : base(r)
 {
     _cacheName = r.ReadString();
     _partition = r.ReadInt();
     _isNear = r.ReadBoolean();
     _eventNode = ReadNode(r);
     _key = r.ReadObject<object>();
     _xid = IgniteGuid.ReadPortable(r);
     _lockId = r.ReadObject<object>();
     _newValue = r.ReadObject<object>();
     _oldValue = r.ReadObject<object>();
     _hasOldValue = r.ReadBoolean();
     _hasNewValue = r.ReadBoolean();
     _subjectId = r.ReadGuid() ?? Guid.Empty;
     _closureClassName = r.ReadString();
     _taskName = r.ReadString();
 }
Esempio n. 33
0
        /** <inheritDoc /> */
        public IClusterMetrics Metrics()
        {
            if (_pred == null)
            {
                return(DoInOp(OpMetrics, stream =>
                {
                    IPortableRawReader reader = Marshaller.StartUnmarshal(stream, false);

                    return reader.ReadBoolean() ? new ClusterMetricsImpl(reader) : null;
                }));
            }
            return(DoOutInOp(OpMetricsFiltered, writer =>
            {
                WriteEnumerable(writer, Nodes().Select(node => node.Id));
            }, stream =>
            {
                IPortableRawReader reader = Marshaller.StartUnmarshal(stream, false);

                return reader.ReadBoolean() ? new ClusterMetricsImpl(reader) : null;
            }));
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal CheckpointEvent(IPortableRawReader r) : base(r)
 {
     _key = r.ReadString();
 }
Esempio n. 35
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal CheckpointEvent(IPortableRawReader r) : base(r)
 {
     _key = r.ReadString();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PortableMetadataImpl" /> class.
 /// </summary>
 /// <param name="reader">The reader.</param>
 public PortableMetadataImpl(IPortableRawReader reader)
 {
     TypeId = reader.ReadInt();
     TypeName = reader.ReadString();
     AffinityKeyFieldName = reader.ReadString();
     _fields = reader.ReadGenericDictionary<string, int>();
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal SwapSpaceEvent(IPortableRawReader r) : base(r)
 {
     _space = r.ReadString();
 }
Esempio n. 38
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="r">The reader to read data from.</param>
 internal SwapSpaceEvent(IPortableRawReader r) : base(r)
 {
     _space = r.ReadString();
 }
Esempio n. 39
0
        /// <summary>
        /// Invokes a store operation.
        /// </summary>
        /// <param name="input">Input stream.</param>
        /// <param name="cb">Callback.</param>
        /// <param name="grid">Grid.</param>
        /// <returns>Invocation result.</returns>
        /// <exception cref="IgniteException">Invalid operation type:  + opType</exception>
        public int Invoke(IPortableStream input, IUnmanagedTarget cb, Ignite grid)
        {
            IPortableReader reader = grid.Marshaller.StartUnmarshal(input,
                                                                    _convertPortable ? PortableMode.Deserialize : PortableMode.ForcePortable);

            IPortableRawReader rawReader = reader.RawReader();

            int opType = rawReader.ReadByte();

            // Setup cache sessoin for this invocation.
            long sesId = rawReader.ReadLong();

            CacheStoreSession ses = grid.HandleRegistry.Get <CacheStoreSession>(sesId, true);

            ses.CacheName = rawReader.ReadString();

            _sesProxy.SetSession(ses);

            try
            {
                // Perform operation.
                switch (opType)
                {
                case OpLoadCache:
                    _store.LoadCache((k, v) => WriteObjects(cb, grid, k, v), rawReader.ReadObjectArray <object>());

                    break;

                case OpLoad:
                    object val = _store.Load(rawReader.ReadObject <object>());

                    if (val != null)
                    {
                        WriteObjects(cb, grid, val);
                    }

                    break;

                case OpLoadAll:
                    var keys = rawReader.ReadCollection();

                    var result = _store.LoadAll(keys);

                    foreach (DictionaryEntry entry in result)
                    {
                        WriteObjects(cb, grid, entry.Key, entry.Value);
                    }

                    break;

                case OpPut:
                    _store.Write(rawReader.ReadObject <object>(), rawReader.ReadObject <object>());

                    break;

                case OpPutAll:
                    _store.WriteAll(rawReader.ReadDictionary());

                    break;

                case OpRmv:
                    _store.Delete(rawReader.ReadObject <object>());

                    break;

                case OpRmvAll:
                    _store.DeleteAll(rawReader.ReadCollection());

                    break;

                case OpSesEnd:
                    grid.HandleRegistry.Release(sesId);

                    _store.SessionEnd(rawReader.ReadBoolean());

                    break;

                default:
                    throw new IgniteException("Invalid operation type: " + opType);
                }

                return(0);
            }
            finally
            {
                _sesProxy.ClearSession();
            }
        }
Esempio n. 40
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ClusterMetricsImpl"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public ClusterMetricsImpl(IPortableRawReader reader)
        {
            LastUpdateTimeRaw = reader.ReadLong();

            DateTime?lastUpdateTime0 = reader.ReadDate();

            LastUpdateTime     = lastUpdateTime0 ?? default(DateTime);
            MaximumActiveJobs  = reader.ReadInt();
            CurrentActiveJobs  = reader.ReadInt();
            AverageActiveJobs  = reader.ReadFloat();
            MaximumWaitingJobs = reader.ReadInt();

            CurrentWaitingJobs  = reader.ReadInt();
            AverageWaitingJobs  = reader.ReadFloat();
            MaximumRejectedJobs = reader.ReadInt();
            CurrentRejectedJobs = reader.ReadInt();
            AverageRejectedJobs = reader.ReadFloat();

            TotalRejectedJobs    = reader.ReadInt();
            MaximumCancelledJobs = reader.ReadInt();
            CurrentCancelledJobs = reader.ReadInt();
            AverageCancelledJobs = reader.ReadFloat();
            TotalCancelledJobs   = reader.ReadInt();

            TotalExecutedJobs     = reader.ReadInt();
            MaximumJobWaitTime    = reader.ReadLong();
            CurrentJobWaitTime    = reader.ReadLong();
            AverageJobWaitTime    = reader.ReadDouble();
            MaximumJobExecuteTime = reader.ReadLong();

            CurrentJobExecuteTime = reader.ReadLong();
            AverageJobExecuteTime = reader.ReadDouble();
            TotalExecutedTasks    = reader.ReadInt();
            TotalIdleTime         = reader.ReadLong();
            CurrentIdleTime       = reader.ReadLong();

            TotalCpus             = reader.ReadInt();
            CurrentCpuLoad        = reader.ReadDouble();
            AverageCpuLoad        = reader.ReadDouble();
            CurrentGcCpuLoad      = reader.ReadDouble();
            HeapMemoryInitialized = reader.ReadLong();

            HeapMemoryUsed           = reader.ReadLong();
            HeapMemoryCommitted      = reader.ReadLong();
            HeapMemoryMaximum        = reader.ReadLong();
            HeapMemoryTotal          = reader.ReadLong();
            NonHeapMemoryInitialized = reader.ReadLong();

            NonHeapMemoryUsed      = reader.ReadLong();
            NonHeapMemoryCommitted = reader.ReadLong();
            NonHeapMemoryMaximum   = reader.ReadLong();
            NonHeapMemoryTotal     = reader.ReadLong();
            UpTime = reader.ReadLong();

            DateTime?startTime0 = reader.ReadDate();

            StartTime = startTime0 ?? default(DateTime);

            DateTime?nodeStartTime0 = reader.ReadDate();

            NodeStartTime = nodeStartTime0 ?? default(DateTime);

            CurrentThreadCount       = reader.ReadInt();
            MaximumThreadCount       = reader.ReadInt();
            TotalStartedThreadCount  = reader.ReadLong();
            CurrentDaemonThreadCount = reader.ReadInt();
            LastDataVersion          = reader.ReadLong();

            SentMessagesCount         = reader.ReadInt();
            SentBytesCount            = reader.ReadLong();
            ReceivedMessagesCount     = reader.ReadInt();
            ReceivedBytesCount        = reader.ReadLong();
            OutboundMessagesQueueSize = reader.ReadInt();

            TotalNodes = reader.ReadInt();
        }
Esempio n. 41
0
 /// <summary>
 /// Reads a node from stream.
 /// </summary>
 /// <param name="reader">Reader.</param>
 /// <returns>Node or null.</returns>
 protected static IClusterNode ReadNode(IPortableRawReader reader)
 {
     return(((PortableReaderImpl)reader).Marshaller.Ignite.GetNode(reader.ReadGuid()));
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ClusterMetricsImpl"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public ClusterMetricsImpl(IPortableRawReader reader)
        {
            LastUpdateTimeRaw = reader.ReadLong();

            DateTime? lastUpdateTime0 = reader.ReadDate();

            LastUpdateTime = lastUpdateTime0 ?? default(DateTime);
            MaximumActiveJobs = reader.ReadInt();
            CurrentActiveJobs = reader.ReadInt();
            AverageActiveJobs = reader.ReadFloat();
            MaximumWaitingJobs = reader.ReadInt();

            CurrentWaitingJobs = reader.ReadInt();
            AverageWaitingJobs = reader.ReadFloat();
            MaximumRejectedJobs = reader.ReadInt();
            CurrentRejectedJobs = reader.ReadInt();
            AverageRejectedJobs = reader.ReadFloat();

            TotalRejectedJobs = reader.ReadInt();
            MaximumCancelledJobs = reader.ReadInt();
            CurrentCancelledJobs = reader.ReadInt();
            AverageCancelledJobs = reader.ReadFloat();
            TotalCancelledJobs = reader.ReadInt();

            TotalExecutedJobs = reader.ReadInt();
            MaximumJobWaitTime = reader.ReadLong();
            CurrentJobWaitTime = reader.ReadLong();
            AverageJobWaitTime = reader.ReadDouble();
            MaximumJobExecuteTime = reader.ReadLong();

            CurrentJobExecuteTime = reader.ReadLong();
            AverageJobExecuteTime = reader.ReadDouble();
            TotalExecutedTasks = reader.ReadInt();
            TotalIdleTime = reader.ReadLong();
            CurrentIdleTime = reader.ReadLong();

            TotalCpus = reader.ReadInt();
            CurrentCpuLoad = reader.ReadDouble();
            AverageCpuLoad = reader.ReadDouble();
            CurrentGcCpuLoad = reader.ReadDouble();
            HeapMemoryInitialized = reader.ReadLong();

            HeapMemoryUsed = reader.ReadLong();
            HeapMemoryCommitted = reader.ReadLong();
            HeapMemoryMaximum = reader.ReadLong();
            HeapMemoryTotal = reader.ReadLong();
            NonHeapMemoryInitialized = reader.ReadLong();

            NonHeapMemoryUsed = reader.ReadLong();
            NonHeapMemoryCommitted = reader.ReadLong();
            NonHeapMemoryMaximum = reader.ReadLong();
            NonHeapMemoryTotal = reader.ReadLong();
            UpTime = reader.ReadLong();

            DateTime? startTime0 = reader.ReadDate();

            StartTime = startTime0 ?? default(DateTime);

            DateTime? nodeStartTime0 = reader.ReadDate();

            NodeStartTime = nodeStartTime0 ?? default(DateTime);

            CurrentThreadCount = reader.ReadInt();
            MaximumThreadCount = reader.ReadInt();
            TotalStartedThreadCount = reader.ReadLong();
            CurrentDaemonThreadCount = reader.ReadInt();
            LastDataVersion = reader.ReadLong();

            SentMessagesCount = reader.ReadInt();
            SentBytesCount = reader.ReadLong();
            ReceivedMessagesCount = reader.ReadInt();
            ReceivedBytesCount = reader.ReadLong();
            OutboundMessagesQueueSize = reader.ReadInt();

            TotalNodes = reader.ReadInt();
        }