public void StartUnary(BatchContextSafeHandle ctx, byte[] payload, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
 {
     using (Profilers.ForCurrentThread().NewScope("CallSafeHandle.StartUnary"))
     {
         Native.grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), metadataArray, writeFlags)
             .CheckOk();
     }
 }
 public void StartUnary(UnaryResponseClientHandler callback, byte[] payload, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
 {
     using (completionQueue.NewScope())
     {
         var ctx = BatchContextSafeHandle.Create();
         completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedStatusOnClient(), context.GetReceivedMessage(), context.GetReceivedInitialMetadata()));
         Native.grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), metadataArray, writeFlags)
             .CheckOk();
     }
 }
예제 #3
0
 public void StartSendStatusFromServer(SendCompletionHandler callback, Status status, MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata,
                                       byte[] optionalPayload, WriteFlags writeFlags)
 {
     using (completionQueue.NewScope())
     {
         var ctx = BatchContextSafeHandle.Create();
         var optionalPayloadLength = optionalPayload != null ? new UIntPtr((ulong)optionalPayload.Length) : UIntPtr.Zero;
         completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success));
         var statusDetailBytes = MarshalUtils.GetBytesUTF8(status.Detail);
         Native.grpcsharp_call_send_status_from_server(this, ctx, status.StatusCode, statusDetailBytes, new UIntPtr((ulong)statusDetailBytes.Length), metadataArray, sendEmptyInitialMetadata,
                                                       optionalPayload, optionalPayloadLength, writeFlags).CheckOk();
     }
 }
예제 #4
0
 public WriteRequest(byte[] buffer, int offset) : base(buffer, offset)
 {
     StructureSize          = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 0);
     DataOffset             = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 2);
     DataLength             = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 4);
     Offset                 = LittleEndianConverter.ToUInt64(buffer, offset + SMB2Header.Length + 8);
     FileId                 = new FileID(buffer, offset + SMB2Header.Length + 16);
     Channel                = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 32);
     RemainingBytes         = LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 36);
     WriteChannelInfoOffset = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 40);
     WriteChannelInfoLength = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 42);
     Flags            = (WriteFlags)LittleEndianConverter.ToUInt32(buffer, offset + SMB2Header.Length + 44);
     Data             = ByteReader.ReadBytes(buffer, offset + DataOffset, (int)DataLength);
     WriteChannelInfo = ByteReader.ReadBytes(buffer, offset + WriteChannelInfoOffset, WriteChannelInfoLength);
 }
예제 #5
0
        /// <summary>
        /// Initiates sending a message. Only one send operation can be active at a time.
        /// completionDelegate is invoked upon completion.
        /// </summary>
        protected void StartSendMessageInternal(TWrite msg, WriteFlags writeFlags, AsyncCompletionDelegate <object> completionDelegate)
        {
            byte[] payload = UnsafeSerialize(msg);

            lock (myLock)
            {
                GrpcPreconditions.CheckNotNull(completionDelegate, "Completion delegate cannot be null");
                CheckSendingAllowed(allowFinished: false);

                call.StartSendMessage(HandleSendFinished, payload, writeFlags, !initialMetadataSent);

                sendCompletionDelegate = completionDelegate;
                initialMetadataSent    = true;
                streamingWritesCounter++;
            }
        }
예제 #6
0
        /// <summary>
        /// Initiates sending a message. Only one send operation can be active at a time.
        /// </summary>
        protected Task SendMessageInternalAsync(TWrite msg, WriteFlags writeFlags)
        {
            byte[] payload = UnsafeSerialize(msg);

            lock (myLock)
            {
                GrpcPreconditions.CheckState(started);
                var earlyResult = CheckSendAllowedOrEarlyResult();
                if (earlyResult != null)
                {
                    return(earlyResult);
                }

                call.StartSendMessage(HandleSendFinished, payload, writeFlags, !initialMetadataSent);

                initialMetadataSent = true;
                streamingWritesCounter++;
                streamingWriteTcs = new TaskCompletionSource <object>();
                return(streamingWriteTcs.Task);
            }
        }
예제 #7
0
        /// <summary>
        /// Writes the current data.
        /// </summary>
        private void WriteCurrentData(ConnectedClient client, DataPacket request, out ResponsePacket response)
        {
            byte[]   buffer    = request.Buffer;
            int      index     = ArgumentIndex;
            DateTime timestamp = GetTime(buffer, ref index);
            int      cnlCnt    = GetInt32(buffer, ref index);
            Slice    slice     = new Slice(timestamp, cnlCnt);

            for (int i = 0, idx1 = index, idx2 = idx1 + cnlCnt * 4; i < cnlCnt; i++)
            {
                slice.CnlNums[i] = GetInt32(buffer, ref idx1);
                slice.CnlData[i] = GetCnlData(buffer, ref idx2);
            }

            index += cnlCnt * 14;
            int        deviceNum  = GetInt32(buffer, ref index);
            WriteFlags writeFlags = (WriteFlags)buffer[index];

            coreLogic.WriteCurrentData(slice, deviceNum, writeFlags);

            response = new ResponsePacket(request, client.OutBuf);
        }
예제 #8
0
        /// <summary>
        /// Initiates sending a message. Only one send operation can be active at a time.
        /// </summary>
        protected Task SendMessageInternalAsync(TWrite msg, WriteFlags writeFlags)
        {
            using (var serializationScope = DefaultSerializationContext.GetInitializedThreadLocalScope())
            {
                var payload = UnsafeSerialize(msg, serializationScope.Context);
                lock (myLock)
                {
                    GrpcPreconditions.CheckState(started);
                    var earlyResult = CheckSendAllowedOrEarlyResult();
                    if (earlyResult != null)
                    {
                        return(earlyResult);
                    }

                    call.StartSendMessage(SendCompletionCallback, payload, writeFlags, !initialMetadataSent);

                    initialMetadataSent = true;
                    streamingWritesCounter++;
                    streamingWriteTcs = new TaskCompletionSource <object>();
                    return(streamingWriteTcs.Task);
                }
            }
        }
예제 #9
0
 GRPCCallError IPlatformInvocation.grpcsharp_call_send_message(CallSafeHandle call,
                                                               BatchContextSafeHandle ctx, byte[] send_buffer, UIntPtr send_buffer_len, WriteFlags writeFlags,
                                                               bool sendEmptyInitialMetadata)
 {
     return(grpcsharp_call_send_message(call, ctx, send_buffer, send_buffer_len, writeFlags,
                                        sendEmptyInitialMetadata));
 }
예제 #10
0
 public void StartUnary(BatchContextSafeHandle ctx, byte[] payload, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
 {
     grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), metadataArray, writeFlags)
         .CheckOk();
 }
예제 #11
0
 public void StartSendMessage(SendCompletionHandler callback, byte[] payload, WriteFlags writeFlags, bool sendEmptyInitialMetadata)
 {
     SendCompletionHandler = callback;
 }
예제 #12
0
 public void StartUnary(BatchContextSafeHandle ctx, byte[] payload, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
 {
     throw new NotImplementedException();
 }
예제 #13
0
 /// <summary>
 /// Sends a streaming request. Only one pending send action is allowed at any given time.
 /// </summary>
 public IObservable <Unit> SendMessageAsync(TRequest msg, WriteFlags writeFlags)
 {
     return(SendMessageInternalAsync(msg, writeFlags));
 }
예제 #14
0
 public void StartServerStreaming(ReceivedStatusOnClientHandler callback, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags)
 {
     using (completionQueue.NewScope())
     {
         var ctx = BatchContextSafeHandle.Create();
         completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedStatusOnClient()));
         Native.grpcsharp_call_start_server_streaming(this, ctx, payload, new UIntPtr((ulong)payload.Length), writeFlags, metadataArray, callFlags).CheckOk();
     }
 }
예제 #15
0
파일: Space.cs 프로젝트: azist/azos
 public Task <SaveResult <ChangeResult> > DeleteAsync(ObjectRef obj, WriteFlags flags = WriteFlags.None, Guid idempotencyToken = default(Guid), INode node = null)
 {
     throw new NotImplementedException();
 }
예제 #16
0
 public void Overwrite(WriteFlags writeFlags, uint numThreads)
 {
     WimLibException.CheckWimLibError(NativeMethods.Overwrite(_ptr, writeFlags, numThreads));
 }
 /// <summary>
 /// Initializes a new instance of <c>WriteOptions</c> class.
 /// </summary>
 /// <param name="flags">The write flags.</param>
 public WriteOptions(WriteFlags flags = default(WriteFlags))
 {
     this.flags = flags;
 }
예제 #18
0
 public void StartSendMessage(BatchCompletionDelegate callback, byte[] payload, WriteFlags writeFlags, bool sendEmptyInitialMetadata)
 {
     var ctx = BatchContextSafeHandle.Create();
     completionRegistry.RegisterBatchCompletion(ctx, callback);
     grpcsharp_call_send_message(this, ctx, payload, new UIntPtr((ulong)payload.Length), writeFlags, sendEmptyInitialMetadata).CheckOk();
 }
예제 #19
0
 public void StartServerStreaming(BatchCompletionDelegate callback, byte[] payload, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
 {
     var ctx = BatchContextSafeHandle.Create();
     completionRegistry.RegisterBatchCompletion(ctx, callback);
     grpcsharp_call_start_server_streaming(this, ctx, payload, new UIntPtr((ulong)payload.Length), metadataArray, writeFlags).CheckOk();
 }
예제 #20
0
 static extern GRPCCallError grpcsharp_call_send_message(CallSafeHandle call,
     BatchContextSafeHandle ctx, byte[] send_buffer, UIntPtr send_buffer_len, WriteFlags writeFlags, bool sendEmptyInitialMetadata);
예제 #21
0
 GRPCCallError IPlatformInvocation.grpcsharp_call_send_message(CallSafeHandle call,
     BatchContextSafeHandle ctx, byte[] send_buffer, UIntPtr send_buffer_len, WriteFlags writeFlags,
     bool sendEmptyInitialMetadata)
 {
     return grpcsharp_call_send_message(call, ctx, send_buffer, send_buffer_len, writeFlags,
         sendEmptyInitialMetadata);
 }
예제 #22
0
파일: Space.cs 프로젝트: azist/azos
 public Task <SaveResult <ChangeResult> > SetObjectAsync(HeapObject instance, WriteFlags flags = WriteFlags.None, Guid idempotencyToken = default(Guid), INode node = null)
 {
     throw new NotImplementedException();
 }
예제 #23
0
 internal static extern CallError grpcsharp_call_send_message(CallSafeHandle call,
                                                              BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, bool sendEmptyInitialMetadata);
예제 #24
0
 public void StartUnary(UnaryResponseClientHandler callback, byte[] payload, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
 {
     using (completionQueue.NewScope())
     {
         var ctx = BatchContextSafeHandle.Create();
         completionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedStatusOnClient(), context.GetReceivedMessage(), context.GetReceivedInitialMetadata()));
         Native.grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), metadataArray, writeFlags)
         .CheckOk();
     }
 }
예제 #25
0
    public void DbRename(Txn txn, string file, string database, string newname, WriteFlags flags) {
      byte[] fBytes = null;
      Util.StrToUtf8(file, ref fBytes);
      byte[] dBytes = null;
      Util.StrToUtf8(database, ref dBytes);
      byte[] nBytes = null;
      Util.StrToUtf8(newname, ref nBytes);

      DbRetVal ret;
      // lock environement first, to avoid deadlocks
      lock (rscLock) {
        if (txn != null) {
          lock (txn.rscLock) {
            DB_TXN* txp = txn.CheckDisposed();
            ret = DbRename(txp, fBytes, dBytes, nBytes, flags);
          }
        }
        else
          ret = DbRename(null, fBytes, dBytes, nBytes, flags);
      }
      Util.CheckRetVal(ret);
    }
예제 #26
0
 public void StartUnary(BatchContextSafeHandle ctx, byte[] payload, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
 {
     using (Profilers.ForCurrentThread().NewScope("CallSafeHandle.StartUnary"))
     {
         Native.grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), metadataArray, writeFlags)
         .CheckOk();
     }
 }
예제 #27
0
 public void StartServerStreaming(ReceivedStatusOnClientHandler callback, byte[] payload, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
 {
     ReceivedStatusOnClientHandler = callback;
 }
 public void StartSendMessage(SendCompletionHandler callback, byte[] payload, WriteFlags writeFlags, bool sendEmptyInitialMetadata)
 {
     using (completionQueue.NewScope())
     {
         var ctx = BatchContextSafeHandle.Create();
         completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success));
         Native.grpcsharp_call_send_message(this, ctx, payload, new UIntPtr((ulong)payload.Length), writeFlags, sendEmptyInitialMetadata).CheckOk();
     }
 }
예제 #29
0
 public ResponseWithFlags(TResponse response, WriteFlags writeFlags)
 {
     this.Response   = response;
     this.WriteFlags = writeFlags;
 }
예제 #30
0
 static extern GRPCCallError grpcsharp_call_start_unary(CallSafeHandle call,
                                                        BatchContextSafeHandle ctx, byte[] send_buffer, UIntPtr send_buffer_len, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags);
예제 #31
0
파일: AsyncCall.cs 프로젝트: zz198808/grpc
 /// <summary>
 /// Sends a streaming request. Only one pending send action is allowed at any given time.
 /// </summary>
 public Task SendMessageAsync(TRequest msg, WriteFlags writeFlags)
 {
     return(SendMessageInternalAsync(msg, writeFlags));
 }
예제 #32
0
 public void StartServerStreaming(ReceivedStatusOnClientHandler callback, byte[] payload, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
 {
     using (completionQueue.NewScope())
     {
         var ctx = BatchContextSafeHandle.Create();
         completionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedStatusOnClient()));
         grpcsharp_call_start_server_streaming(this, ctx, payload, new UIntPtr((ulong)payload.Length), metadataArray, writeFlags).CheckOk();
     }
 }
 public void StartSendStatusFromServer(SendCompletionHandler callback, Status status, MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata,
     byte[] optionalPayload, WriteFlags writeFlags)
 {
     using (completionQueue.NewScope())
     {
         var ctx = BatchContextSafeHandle.Create();
         var optionalPayloadLength = optionalPayload != null ? new UIntPtr((ulong)optionalPayload.Length) : UIntPtr.Zero;
         completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success));
         Native.grpcsharp_call_send_status_from_server(this, ctx, status.StatusCode, status.Detail, metadataArray, sendEmptyInitialMetadata,
             optionalPayload, optionalPayloadLength, writeFlags).CheckOk();
     }
 }
예제 #34
0
 public void StartSendStatusFromServer(SendCompletionHandler callback, Status status, MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata,
                                       byte[] optionalPayload, WriteFlags writeFlags)
 {
     SendStatusFromServerHandler = callback;
 }
예제 #35
0
 /// <summary>
 /// Initializes a new instance of <c>WriteOptions</c> class.
 /// </summary>
 /// <param name="flags">The write flags.</param>
 public WriteOptions(WriteFlags flags = default(WriteFlags))
 {
     this.flags = flags;
 }
예제 #36
0
 public void StartUnary(UnaryResponseClientHandler callback, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags)
 {
     UnaryResponseClientHandler = callback;
 }
예제 #37
0
 GRPCCallError IPlatformInvocation.grpcsharp_call_start_server_streaming(CallSafeHandle call,
                                                                         BatchContextSafeHandle ctx, byte[] send_buffer, UIntPtr send_buffer_len,
                                                                         MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
 {
     return(grpcsharp_call_start_server_streaming(call, ctx, send_buffer, send_buffer_len, metadataArray,
                                                  writeFlags));
 }
예제 #38
0
 public void StartUnary(BatchContextSafeHandle ctx, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags)
 {
     throw new NotImplementedException();
 }
예제 #39
0
 static extern GRPCCallError grpcsharp_call_start_server_streaming(CallSafeHandle call,
     BatchContextSafeHandle ctx, byte[] send_buffer, UIntPtr send_buffer_len,
     MetadataArraySafeHandle metadataArray, WriteFlags writeFlags);
예제 #40
0
 public void StartServerStreaming(ReceivedStatusOnClientHandler callback, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags)
 {
     ReceivedStatusOnClientHandler = callback;
 }
예제 #41
0
 GRPCCallError IPlatformInvocation.grpcsharp_call_start_server_streaming(CallSafeHandle call,
     BatchContextSafeHandle ctx, byte[] send_buffer, UIntPtr send_buffer_len,
     MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
 {
     return grpcsharp_call_start_server_streaming(call, ctx, send_buffer, send_buffer_len, metadataArray,
         writeFlags);
 }
예제 #42
0
 public void StartSendMessage(SendCompletionHandler callback, byte[] payload, WriteFlags writeFlags, bool sendEmptyInitialMetadata)
 {
     SendCompletionHandler = callback;
 }
예제 #43
0
 public void StartUnary(BatchContextSafeHandle ctx, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags)
 {
     Native.grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), writeFlags, metadataArray, callFlags)
     .CheckOk();
 }
예제 #44
0
 public void StartSendStatusFromServer(SendCompletionHandler callback, Status status, MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata,
     byte[] optionalPayload, WriteFlags writeFlags)
 {
     SendStatusFromServerHandler = callback;
 }
예제 #45
0
 internal static extern CallError grpcsharp_call_start_server_streaming(CallSafeHandle call,
                                                                        BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen,
                                                                        MetadataArraySafeHandle metadataArray, WriteFlags writeFlags);
예제 #46
0
 /// <summary>
 /// Sends a streaming request. Only one pending send action is allowed at any given time.
 /// completionDelegate is called when the operation finishes.
 /// </summary>
 public void StartSendMessage(TRequest msg, WriteFlags writeFlags, AsyncCompletionDelegate <object> completionDelegate)
 {
     StartSendMessageInternal(msg, writeFlags, completionDelegate);
 }
예제 #47
0
 internal static extern CallError grpcsharp_call_send_status_from_server(CallSafeHandle call,
                                                                         BatchContextSafeHandle ctx, StatusCode statusCode, string statusMessage, MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata,
                                                                         byte[] optionalSendBuffer, UIntPtr optionalSendBufferLen, WriteFlags writeFlags);
예제 #48
0
 public void StartUnary(UnaryResponseClientHandler callback, byte[] payload, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
 {
     UnaryResponseClientHandler = callback;
 }
예제 #49
0
 public static async Task <SaveResult <ChangeResult> > DeleteAsync <T>(this IHeap heap,
                                                                       ObjectRef obj,
                                                                       WriteFlags flags      = WriteFlags.None,
                                                                       Guid idempotencyToken = default(Guid),
                                                                       INode node            = null) where T : HeapObject
 => await heap.GetSpace <T>().DeleteAsync(obj, flags, idempotencyToken, node);
예제 #50
0
 DbRetVal DbRename(DB_TXN* txp, byte[] fBytes, byte[] dBytes, byte[] nBytes, WriteFlags flags) {
   DB_ENV* evp = CheckDisposed();
   fixed (byte* fp = fBytes, dp = dBytes, np = nBytes) {
     return evp->DbRename(evp, txp, fp, dp, np, unchecked((UInt32)flags));
   }
 }