/// <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 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(); }
/// <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(); }
/// <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="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> /// 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(); } }