Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
1b926ee4
Commit
1b926ee4
authored
9 years ago
by
Jan Tattermusch
Browse files
Options
Downloads
Patches
Plain Diff
add comments
parent
9698b5b2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/csharp/Grpc.Core/CallInvocationDetails.cs
+40
-0
40 additions, 0 deletions
src/csharp/Grpc.Core/CallInvocationDetails.cs
src/csharp/Grpc.Core/Calls.cs
+44
-0
44 additions, 0 deletions
src/csharp/Grpc.Core/Calls.cs
with
84 additions
and
0 deletions
src/csharp/Grpc.Core/CallInvocationDetails.cs
+
40
−
0
View file @
1b926ee4
...
@@ -49,16 +49,38 @@ namespace Grpc.Core
...
@@ -49,16 +49,38 @@ namespace Grpc.Core
readonly
Marshaller
<
TResponse
>
responseMarshaller
;
readonly
Marshaller
<
TResponse
>
responseMarshaller
;
CallOptions
options
;
CallOptions
options
;
/// <summary>
/// Initializes a new instance of the <see cref="Grpc.Core.CallInvocationDetails`2"/> struct.
/// </summary>
/// <param name="channel">Channel to use for this call.</param>
/// <param name="method">Method to call.</param>
/// <param name="options">Call options.</param>
public
CallInvocationDetails
(
Channel
channel
,
Method
<
TRequest
,
TResponse
>
method
,
CallOptions
options
)
:
public
CallInvocationDetails
(
Channel
channel
,
Method
<
TRequest
,
TResponse
>
method
,
CallOptions
options
)
:
this
(
channel
,
method
,
null
,
options
)
this
(
channel
,
method
,
null
,
options
)
{
{
}
}
/// <summary>
/// Initializes a new instance of the <see cref="Grpc.Core.CallInvocationDetails`2"/> struct.
/// </summary>
/// <param name="channel">Channel to use for this call.</param>
/// <param name="method">Method to call.</param>
/// <param name="host">Host that contains the method. if <c>null</c>, default host will be used.</param>
/// <param name="options">Call options.</param>
public
CallInvocationDetails
(
Channel
channel
,
Method
<
TRequest
,
TResponse
>
method
,
string
host
,
CallOptions
options
)
:
public
CallInvocationDetails
(
Channel
channel
,
Method
<
TRequest
,
TResponse
>
method
,
string
host
,
CallOptions
options
)
:
this
(
channel
,
method
.
FullName
,
host
,
method
.
RequestMarshaller
,
method
.
ResponseMarshaller
,
options
)
this
(
channel
,
method
.
FullName
,
host
,
method
.
RequestMarshaller
,
method
.
ResponseMarshaller
,
options
)
{
{
}
}
/// <summary>
/// Initializes a new instance of the <see cref="Grpc.Core.CallInvocationDetails`2"/> struct.
/// </summary>
/// <param name="channel">Channel to use for this call.</param>
/// <param name="method">Qualified method name.</param>
/// <param name="host">Host that contains the method.</param>
/// <param name="requestMarshaller">Request marshaller.</param>
/// <param name="responseMarshaller">Response marshaller.</param>
/// <param name="options">Call options.</param>
public
CallInvocationDetails
(
Channel
channel
,
string
method
,
string
host
,
Marshaller
<
TRequest
>
requestMarshaller
,
Marshaller
<
TResponse
>
responseMarshaller
,
CallOptions
options
)
public
CallInvocationDetails
(
Channel
channel
,
string
method
,
string
host
,
Marshaller
<
TRequest
>
requestMarshaller
,
Marshaller
<
TResponse
>
responseMarshaller
,
CallOptions
options
)
{
{
this
.
channel
=
Preconditions
.
CheckNotNull
(
channel
,
"channel"
);
this
.
channel
=
Preconditions
.
CheckNotNull
(
channel
,
"channel"
);
...
@@ -69,6 +91,9 @@ namespace Grpc.Core
...
@@ -69,6 +91,9 @@ namespace Grpc.Core
this
.
options
=
options
;
this
.
options
=
options
;
}
}
/// <summary>
/// Get channel associated with this call.
/// </summary>
public
Channel
Channel
public
Channel
Channel
{
{
get
get
...
@@ -77,6 +102,9 @@ namespace Grpc.Core
...
@@ -77,6 +102,9 @@ namespace Grpc.Core
}
}
}
}
/// <summary>
/// Gets name of method to be called.
/// </summary>
public
string
Method
public
string
Method
{
{
get
get
...
@@ -85,6 +113,9 @@ namespace Grpc.Core
...
@@ -85,6 +113,9 @@ namespace Grpc.Core
}
}
}
}
/// <summary>
/// Get name of host.
/// </summary>
public
string
Host
public
string
Host
{
{
get
get
...
@@ -93,6 +124,9 @@ namespace Grpc.Core
...
@@ -93,6 +124,9 @@ namespace Grpc.Core
}
}
}
}
/// <summary>
/// Gets marshaller used to serialize requests.
/// </summary>
public
Marshaller
<
TRequest
>
RequestMarshaller
public
Marshaller
<
TRequest
>
RequestMarshaller
{
{
get
get
...
@@ -101,6 +135,9 @@ namespace Grpc.Core
...
@@ -101,6 +135,9 @@ namespace Grpc.Core
}
}
}
}
/// <summary>
/// Gets marshaller used to deserialized responses.
/// </summary>
public
Marshaller
<
TResponse
>
ResponseMarshaller
public
Marshaller
<
TResponse
>
ResponseMarshaller
{
{
get
get
...
@@ -109,6 +146,9 @@ namespace Grpc.Core
...
@@ -109,6 +146,9 @@ namespace Grpc.Core
}
}
}
}
/// <summary>
/// Gets the call options.
/// </summary>
public
CallOptions
Options
public
CallOptions
Options
{
{
get
get
...
...
This diff is collapsed.
Click to expand it.
src/csharp/Grpc.Core/Calls.cs
+
44
−
0
View file @
1b926ee4
...
@@ -38,9 +38,20 @@ namespace Grpc.Core
...
@@ -38,9 +38,20 @@ namespace Grpc.Core
{
{
/// <summary>
/// <summary>
/// Helper methods for generated clients to make RPC calls.
/// Helper methods for generated clients to make RPC calls.
/// Most users will use this class only indirectly and will be
/// making calls using client object generated from protocol
/// buffer definition files.
/// </summary>
/// </summary>
public
static
class
Calls
public
static
class
Calls
{
{
/// <summary>
/// Invokes a simple remote call in a blocking fashion.
/// </summary>
/// <returns>The response.</returns>
/// <param name="call">The call defintion.</param>
/// <param name="req">Request message.</param>
/// <typeparam name="TRequest">Type of request message.</typeparam>
/// <typeparam name="TResponse">The of response message.</typeparam>
public
static
TResponse
BlockingUnaryCall
<
TRequest
,
TResponse
>(
CallInvocationDetails
<
TRequest
,
TResponse
>
call
,
TRequest
req
)
public
static
TResponse
BlockingUnaryCall
<
TRequest
,
TResponse
>(
CallInvocationDetails
<
TRequest
,
TResponse
>
call
,
TRequest
req
)
where
TRequest
:
class
where
TRequest
:
class
where
TResponse
:
class
where
TResponse
:
class
...
@@ -49,6 +60,14 @@ namespace Grpc.Core
...
@@ -49,6 +60,14 @@ namespace Grpc.Core
return
asyncCall
.
UnaryCall
(
req
);
return
asyncCall
.
UnaryCall
(
req
);
}
}
/// <summary>
/// Invokes a simple remote call asynchronously.
/// </summary>
/// <returns>An awaitable call object providing access to the response.</returns>
/// <param name="call">The call defintion.</param>
/// <param name="req">Request message.</param>
/// <typeparam name="TRequest">Type of request message.</typeparam>
/// <typeparam name="TResponse">The of response message.</typeparam>
public
static
AsyncUnaryCall
<
TResponse
>
AsyncUnaryCall
<
TRequest
,
TResponse
>(
CallInvocationDetails
<
TRequest
,
TResponse
>
call
,
TRequest
req
)
public
static
AsyncUnaryCall
<
TResponse
>
AsyncUnaryCall
<
TRequest
,
TResponse
>(
CallInvocationDetails
<
TRequest
,
TResponse
>
call
,
TRequest
req
)
where
TRequest
:
class
where
TRequest
:
class
where
TResponse
:
class
where
TResponse
:
class
...
@@ -58,6 +77,15 @@ namespace Grpc.Core
...
@@ -58,6 +77,15 @@ namespace Grpc.Core
return
new
AsyncUnaryCall
<
TResponse
>(
asyncResult
,
asyncCall
.
GetStatus
,
asyncCall
.
GetTrailers
,
asyncCall
.
Cancel
);
return
new
AsyncUnaryCall
<
TResponse
>(
asyncResult
,
asyncCall
.
GetStatus
,
asyncCall
.
GetTrailers
,
asyncCall
.
Cancel
);
}
}
/// <summary>
/// Invokes a server streaming call asynchronously.
/// In server streaming scenario, client sends on request and server responds with a stream of responses.
/// </summary>
/// <returns>A call object providing access to the asynchronous response stream.</returns>
/// <param name="call">The call defintion.</param>
/// <param name="req">Request message.</param>
/// <typeparam name="TRequest">Type of request message.</typeparam>
/// <typeparam name="TResponse">The of response messages.</typeparam>
public
static
AsyncServerStreamingCall
<
TResponse
>
AsyncServerStreamingCall
<
TRequest
,
TResponse
>(
CallInvocationDetails
<
TRequest
,
TResponse
>
call
,
TRequest
req
)
public
static
AsyncServerStreamingCall
<
TResponse
>
AsyncServerStreamingCall
<
TRequest
,
TResponse
>(
CallInvocationDetails
<
TRequest
,
TResponse
>
call
,
TRequest
req
)
where
TRequest
:
class
where
TRequest
:
class
where
TResponse
:
class
where
TResponse
:
class
...
@@ -68,6 +96,13 @@ namespace Grpc.Core
...
@@ -68,6 +96,13 @@ namespace Grpc.Core
return
new
AsyncServerStreamingCall
<
TResponse
>(
responseStream
,
asyncCall
.
GetStatus
,
asyncCall
.
GetTrailers
,
asyncCall
.
Cancel
);
return
new
AsyncServerStreamingCall
<
TResponse
>(
responseStream
,
asyncCall
.
GetStatus
,
asyncCall
.
GetTrailers
,
asyncCall
.
Cancel
);
}
}
/// <summary>
/// Invokes a client streaming call asynchronously.
/// In client streaming scenario, client sends a stream of requests and server responds with a single response.
/// </summary>
/// <returns>An awaitable call object providing access to the response.</returns>
/// <typeparam name="TRequest">Type of request messages.</typeparam>
/// <typeparam name="TResponse">The of response message.</typeparam>
public
static
AsyncClientStreamingCall
<
TRequest
,
TResponse
>
AsyncClientStreamingCall
<
TRequest
,
TResponse
>(
CallInvocationDetails
<
TRequest
,
TResponse
>
call
)
public
static
AsyncClientStreamingCall
<
TRequest
,
TResponse
>
AsyncClientStreamingCall
<
TRequest
,
TResponse
>(
CallInvocationDetails
<
TRequest
,
TResponse
>
call
)
where
TRequest
:
class
where
TRequest
:
class
where
TResponse
:
class
where
TResponse
:
class
...
@@ -78,6 +113,15 @@ namespace Grpc.Core
...
@@ -78,6 +113,15 @@ namespace Grpc.Core
return
new
AsyncClientStreamingCall
<
TRequest
,
TResponse
>(
requestStream
,
resultTask
,
asyncCall
.
GetStatus
,
asyncCall
.
GetTrailers
,
asyncCall
.
Cancel
);
return
new
AsyncClientStreamingCall
<
TRequest
,
TResponse
>(
requestStream
,
resultTask
,
asyncCall
.
GetStatus
,
asyncCall
.
GetTrailers
,
asyncCall
.
Cancel
);
}
}
/// <summary>
/// Invokes a duplex streaming call asynchronously.
/// In duplex streaming scenario, client sends a stream of requests and server responds with a stream of responses.
/// The response stream is completely independent and both side can be sending messages at the same time.
/// </summary>
/// <returns>A call object providing access to the asynchronous request and response streams.</returns>
/// <param name="call">The call definition.</param>
/// <typeparam name="TRequest">Type of request messages.</typeparam>
/// <typeparam name="TResponse">Type of reponse messages.</typeparam>
public
static
AsyncDuplexStreamingCall
<
TRequest
,
TResponse
>
AsyncDuplexStreamingCall
<
TRequest
,
TResponse
>(
CallInvocationDetails
<
TRequest
,
TResponse
>
call
)
public
static
AsyncDuplexStreamingCall
<
TRequest
,
TResponse
>
AsyncDuplexStreamingCall
<
TRequest
,
TResponse
>(
CallInvocationDetails
<
TRequest
,
TResponse
>
call
)
where
TRequest
:
class
where
TRequest
:
class
where
TResponse
:
class
where
TResponse
:
class
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment