Esempio n. 1
0
 /// <summary>
 /// Does the out in op with affinity awareness.
 /// </summary>
 private Task <T> DoOutInOpAffinityAsync <T>(ClientOp opId, TK key, Func <IBinaryStream, T> readFunc)
 {
     return(_ignite.Socket.DoOutInOpAffinityAsync(opId,
                                                  stream => WriteRequest(w => w.WriteObjectDetached(key), stream),
                                                  readFunc, _id, key, HandleError <T>));
 }
Esempio n. 2
0
 /// <summary>
 /// Does the out op.
 /// </summary>
 private void DoOutOp(ClientOp opId, Action <BinaryWriter> writeAction = null)
 {
     DoOutInOp <object>(opId, writeAction, null);
 }
Esempio n. 3
0
 /// <summary>
 /// Does the out op.
 /// </summary>
 private void DoOutOp(ClientOp opId, Action <ClientRequestContext> writeAction = null)
 {
     DoOutInOp <object>(opId, writeAction, null);
 }
Esempio n. 4
0
 /// <summary>
 /// Does the out op with affinity awareness.
 /// </summary>
 private void DoOutOpAffinity(ClientOp opId, TK key, TV val)
 {
     DoOutInOpAffinity <object>(opId, key, val, null);
 }
Esempio n. 5
0
 /// <summary>
 /// Performs an async send-receive operation.
 /// </summary>
 public Task <T> DoOutInOpAsync <T>(ClientOp opId, Action <ClientRequestContext> writeAction,
                                    Func <ClientResponseContext, T> readFunc, Func <ClientStatusCode, string, T> errorFunc = null)
 {
     return(GetSocket().DoOutInOpAsync(opId, writeAction, readFunc, errorFunc));
 }
Esempio n. 6
0
 /// <summary>
 /// Does the out in op.
 /// </summary>
 private T DoOutInOp <T>(ClientOp opId, Action <ClientRequestContext> writeAction,
                         Func <ClientResponseContext, T> readFunc)
 {
     return(_socket.DoOutInOp(opId, writeAction, readFunc));
 }
Esempio n. 7
0
 /// <summary>
 /// Validates specified op code against current protocol version and features.
 /// </summary>
 /// <param name="operation">Operation.</param>
 public void ValidateOp(ClientOp operation)
 {
     ValidateOp(operation, true);
 }
Esempio n. 8
0
 /// <summary>
 /// Does the out op with partition awareness.
 /// </summary>
 private Task DoOutOpAffinityAsync(ClientOp opId, TK key, Action <ClientRequestContext> writeAction = null)
 {
     return(DoOutInOpAffinityAsync <object>(opId, key, writeAction, null));
 }
Esempio n. 9
0
        /// <summary>
        /// Writes the message to a byte array.
        /// </summary>
        private RequestMessage WriteMessage(Action <ClientRequestContext> writeAction, ClientOp opId)
        {
            _features.ValidateOp(opId);

            var requestId = Interlocked.Increment(ref _requestId);

            // Potential perf improvements:
            // * ArrayPool<T>
            // * Write to socket stream directly (not trivial because of unknown size)
            var stream = new BinaryHeapStream(256);

            stream.WriteInt(0); // Reserve message size.
            stream.WriteShort((short)opId);
            stream.WriteLong(requestId);

            if (writeAction != null)
            {
                var ctx = new ClientRequestContext(stream, this);
                writeAction(ctx);
                ctx.FinishMarshal();
            }

            stream.WriteInt(0, stream.Position - 4); // Write message size.

            return(new RequestMessage(requestId, stream.GetArray(), stream.Position));
        }
Esempio n. 10
0
 /// <summary>
 /// Does the out in op.
 /// </summary>
 protected T DoOutInOp <T>(ClientOp opId, Action <ClientRequestContext> writeAction,
                           Func <ClientResponseContext, T> readFunc)
 {
     return(_ignite.Socket.DoOutInOp(opId, writeAction, readFunc, HandleError <T>));
 }
Esempio n. 11
0
 /// <summary>
 /// Validates op code against current protocol version.
 /// </summary>
 /// <param name="operation">Operation.</param>
 /// <param name="protocolVersion">Protocol version.</param>
 public static void ValidateOp(ClientOp operation, ClientProtocolVersion protocolVersion)
 {
     ValidateOp(operation, protocolVersion, operation.GetMinVersion());
 }
Esempio n. 12
0
 /// <summary>
 /// Does the out in op with partition awareness.
 /// </summary>
 private Task <T> DoOutInOpAffinityAsync <T>(ClientOp opId, TK key, Action <ClientRequestContext> writeAction,
                                             Func <ClientResponseContext, T> readFunc)
 {
     return(_ignite.Socket.DoOutInOpAffinityAsync(opId, ctx => WriteRequest(writeAction, ctx),
                                                  readFunc, _id, key, HandleError <T>));
 }
Esempio n. 13
0
 /// <summary>
 /// Does the out in op.
 /// </summary>
 private T DoOutInOp <T>(ClientOp opId, Action <ClientRequestContext> writeAction,
                         Func <ClientResponseContext, T> readFunc)
 {
     return(_ignite.Socket.DoOutInOp(opId, ctx => WriteRequest(writeAction, ctx),
                                     readFunc, HandleError <T>));
 }
Esempio n. 14
0
 /// <summary>
 /// Does the out op.
 /// </summary>
 private Task DoOutOpAsync(ClientOp opId, Action <BinaryWriter> writeAction = null)
 {
     return(DoOutInOpAsync <object>(opId, writeAction, null));
 }
Esempio n. 15
0
 /// <summary>
 /// Returns a value indicating whether specified operation is supported.
 /// </summary>
 public bool HasOp(ClientOp op)
 {
     return(ValidateOp(op, false));
 }
Esempio n. 16
0
 /// <summary>
 /// Does the out in op.
 /// </summary>
 private Task <T> DoOutInOpAsync <T>(ClientOp opId, Action <BinaryWriter> writeAction,
                                     Func <IBinaryStream, T> readFunc)
 {
     return(_ignite.Socket.DoOutInOpAsync(opId, stream => WriteRequest(writeAction, stream),
                                          readFunc, HandleError <T>));
 }
Esempio n. 17
0
 /** <inheritdoc /> */
 public Task <T> DoOutInOpAsync <T>(ClientOp opId, Action <IBinaryStream> writeAction, Func <IBinaryStream, T> readFunc, Func <ClientStatusCode, string, T> errorFunc = null)
 {
     return(GetSocket().DoOutInOpAsync(opId, writeAction, readFunc, errorFunc));
 }