add channel create call

This commit is contained in:
Connor Clark 2016-04-20 16:02:53 -07:00
parent 20693583d9
commit 6ad6a61c33
5 changed files with 36 additions and 6 deletions

View File

@ -11,3 +11,14 @@ grpc_event grpc_completion_queue_pluck_(grpc_completion_queue *cq, void *tag,
void *reserved) { void *reserved) {
return grpc_completion_queue_pluck(cq, tag, *deadline, reserved); return grpc_completion_queue_pluck(cq, tag, *deadline, reserved);
} }
grpc_call *grpc_channel_create_call_(grpc_channel *channel,
grpc_call *parent_call,
uint32_t propagation_mask,
grpc_completion_queue *completion_queue,
const char *method, const char *host,
gpr_timespec *deadline, void *reserved) {
return grpc_channel_create_call(channel, parent_call, propagation_mask,
completion_queue, method, host, *deadline,
reserved);
}

View File

@ -39,7 +39,8 @@ library
test-suite test test-suite test
build-depends: build-depends:
base base
, QuickCheck , QuickCheck
, grpc-haskell
default-language: Haskell2010 default-language: Haskell2010
ghc-options: -Wall -fwarn-incomplete-patterns -O2 -threaded -rtsopts ghc-options: -Wall -fwarn-incomplete-patterns -O2 -threaded -rtsopts
hs-source-dirs: tests hs-source-dirs: tests

View File

@ -7,6 +7,8 @@ grpc_event *grpc_completion_queue_pluck_(grpc_completion_queue *cq, void *tag,
gpr_timespec *deadline); gpr_timespec *deadline);
grpc_call *grpc_channel_create_call_(grpc_channel *channel, grpc_call *grpc_channel_create_call_(grpc_channel *channel,
grpc_completion_queue *completion_queue, grpc_call *parent_call,
const char *method, const char *host, uint32_t propagation_mask,
gpr_timespec *deadline); grpc_completion_queue *completion_queue,
const char *method, const char *host,
gpr_timespec *deadline, void *reserved);

View File

@ -44,7 +44,7 @@ data ArgValue = ArgString String | ArgInt Int
{#pointer *grpc_op as Op newtype #} {#pointer *grpc_op as Op newtype #}
{#fun grpc_init as ^ {} -> `()'#} {#fun grpc_init as ^ {} -> `()'#}
{#fun grpc_shutdown as ^ {} -> `()'#} {#fun grpc_shutdown as ^ {} -> `()'#}
{#fun grpc_completion_queue_create as ^ {`Ptr ()'} -> `CompletionQueue'#} {#fun grpc_completion_queue_create as ^ {`Ptr ()'} -> `CompletionQueue'#}
@ -54,7 +54,7 @@ data ArgValue = ArgString String | ArgInt Int
{#fun grpc_completion_queue_shutdown as ^ {`CompletionQueue'} -> `()'#} {#fun grpc_completion_queue_shutdown as ^ {`CompletionQueue'} -> `()'#}
{#fun grpc_completion_queue_destroy as ^ {`CompletionQueue'} -> `()'#} {#fun grpc_completion_queue_destroy as ^ {`CompletionQueue'} -> `()'#}
{#fun grpc_channel_create_call_ as ^ {`Channel', `CompletionQueue', `String', `String', `CTimeSpecPtr'} -> `Call'#} {#fun grpc_channel_create_call_ as ^ {`Channel', `Call', `Int', `CompletionQueue', `String', `String', `CTimeSpecPtr', `Ptr ()'} -> `Call'#}
{#fun grpc_insecure_channel_create as ^ {`String', `ChannelArgsPtr', `Ptr ()'} -> `Channel'#} {#fun grpc_insecure_channel_create as ^ {`String', `ChannelArgsPtr', `Ptr ()'} -> `Channel'#}
{#fun grpc_channel_destroy as ^ {`Channel'} -> `()'#} {#fun grpc_channel_destroy as ^ {`Channel'} -> `()'#}

View File

@ -1,6 +1,7 @@
module Network.GRPC.Core.Constants where module Network.GRPC.Core.Constants where
#include "grpc/grpc.h" #include "grpc/grpc.h"
#include "grpc/impl/codegen/propagation_bits.h"
argEnableCensus :: Int argEnableCensus :: Int
argEnableCensus = #const GRPC_ARG_ENABLE_CENSUS argEnableCensus = #const GRPC_ARG_ENABLE_CENSUS
@ -16,3 +17,18 @@ writeBufferHint = #const GRPC_WRITE_BUFFER_HINT
writeNoCompress :: Int writeNoCompress :: Int
writeNoCompress = #const GRPC_WRITE_NO_COMPRESS writeNoCompress = #const GRPC_WRITE_NO_COMPRESS
newtype PropagationMask = PropagationMask {unPropagationMask :: Int}
deriving (Show, Eq, Ord)
propagateDeadline :: Int
propagateDeadline = #const GRPC_PROPAGATE_DEADLINE
propagateCensusStatsContext :: Int
propagateCensusStatsContext = #const GRPC_PROPAGATE_CENSUS_STATS_CONTEXT
propagateCensusTracingContext :: Int
propagateCensusTracingContext = #const GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT
propagateCancellation :: Int
propagateCancellation = #const GRPC_PROPAGATE_CANCELLATION