Exemplo n.º 1
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);
        }
Exemplo n.º 2
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;
 }
Exemplo n.º 3
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;
 }
Exemplo n.º 4
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>
 /// 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();
 }
Exemplo n.º 6
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 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();
 }
Exemplo n.º 8
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>();
        }
Exemplo n.º 9
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>
 /// 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>();
 }
Exemplo n.º 11
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>();
 }
Exemplo n.º 12
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;
        }
Exemplo n.º 13
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();
 }
Exemplo n.º 14
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();
 }
Exemplo n.º 15
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()));
 }