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
026dfe60
Commit
026dfe60
authored
8 years ago
by
Jan Tattermusch
Browse files
Options
Downloads
Plain Diff
Merge pull request #6820 from mdsteele/server-async
Add interfaces for ServerAsyncReader/Writers
parents
129cd658
080749e8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/grpc++/impl/codegen/async_stream.h
+32
-11
32 additions, 11 deletions
include/grpc++/impl/codegen/async_stream.h
include/grpc++/impl/codegen/impl/async_stream.h
+32
-11
32 additions, 11 deletions
include/grpc++/impl/codegen/impl/async_stream.h
with
64 additions
and
22 deletions
include/grpc++/impl/codegen/async_stream.h
+
32
−
11
View file @
026dfe60
...
@@ -299,8 +299,16 @@ class ClientAsyncReaderWriter GRPC_FINAL
...
@@ -299,8 +299,16 @@ class ClientAsyncReaderWriter GRPC_FINAL
};
};
template
<
class
W
,
class
R
>
template
<
class
W
,
class
R
>
class
ServerAsyncReader
GRPC_FINAL
:
public
ServerAsyncStreamingInterface
,
class
ServerAsyncReaderInterface
:
public
ServerAsyncStreamingInterface
,
public
AsyncReaderInterface
<
R
>
{
public
AsyncReaderInterface
<
R
>
{
public:
virtual
void
Finish
(
const
W
&
msg
,
const
Status
&
status
,
void
*
tag
)
=
0
;
virtual
void
FinishWithError
(
const
Status
&
status
,
void
*
tag
)
=
0
;
};
template
<
class
W
,
class
R
>
class
ServerAsyncReader
GRPC_FINAL
:
public
ServerAsyncReaderInterface
<
W
,
R
>
{
public:
public:
explicit
ServerAsyncReader
(
ServerContext
*
ctx
)
explicit
ServerAsyncReader
(
ServerContext
*
ctx
)
:
call_
(
nullptr
,
nullptr
,
nullptr
),
ctx_
(
ctx
)
{}
:
call_
(
nullptr
,
nullptr
,
nullptr
),
ctx_
(
ctx
)
{}
...
@@ -321,7 +329,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
...
@@ -321,7 +329,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
call_
.
PerformOps
(
&
read_ops_
);
call_
.
PerformOps
(
&
read_ops_
);
}
}
void
Finish
(
const
W
&
msg
,
const
Status
&
status
,
void
*
tag
)
{
void
Finish
(
const
W
&
msg
,
const
Status
&
status
,
void
*
tag
)
GRPC_OVERRIDE
{
finish_ops_
.
set_output_tag
(
tag
);
finish_ops_
.
set_output_tag
(
tag
);
if
(
!
ctx_
->
sent_initial_metadata_
)
{
if
(
!
ctx_
->
sent_initial_metadata_
)
{
finish_ops_
.
SendInitialMetadata
(
ctx_
->
initial_metadata_
,
finish_ops_
.
SendInitialMetadata
(
ctx_
->
initial_metadata_
,
...
@@ -338,7 +346,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
...
@@ -338,7 +346,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
call_
.
PerformOps
(
&
finish_ops_
);
call_
.
PerformOps
(
&
finish_ops_
);
}
}
void
FinishWithError
(
const
Status
&
status
,
void
*
tag
)
{
void
FinishWithError
(
const
Status
&
status
,
void
*
tag
)
GRPC_OVERRIDE
{
GPR_CODEGEN_ASSERT
(
!
status
.
ok
());
GPR_CODEGEN_ASSERT
(
!
status
.
ok
());
finish_ops_
.
set_output_tag
(
tag
);
finish_ops_
.
set_output_tag
(
tag
);
if
(
!
ctx_
->
sent_initial_metadata_
)
{
if
(
!
ctx_
->
sent_initial_metadata_
)
{
...
@@ -363,8 +371,14 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
...
@@ -363,8 +371,14 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
};
};
template
<
class
W
>
template
<
class
W
>
class
ServerAsyncWriter
GRPC_FINAL
:
public
ServerAsyncStreamingInterface
,
class
ServerAsyncWriterInterface
:
public
ServerAsyncStreamingInterface
,
public
AsyncWriterInterface
<
W
>
{
public
AsyncWriterInterface
<
W
>
{
public:
virtual
void
Finish
(
const
Status
&
status
,
void
*
tag
)
=
0
;
};
template
<
class
W
>
class
ServerAsyncWriter
GRPC_FINAL
:
public
ServerAsyncWriterInterface
<
W
>
{
public:
public:
explicit
ServerAsyncWriter
(
ServerContext
*
ctx
)
explicit
ServerAsyncWriter
(
ServerContext
*
ctx
)
:
call_
(
nullptr
,
nullptr
,
nullptr
),
ctx_
(
ctx
)
{}
:
call_
(
nullptr
,
nullptr
,
nullptr
),
ctx_
(
ctx
)
{}
...
@@ -391,7 +405,7 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
...
@@ -391,7 +405,7 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
call_
.
PerformOps
(
&
write_ops_
);
call_
.
PerformOps
(
&
write_ops_
);
}
}
void
Finish
(
const
Status
&
status
,
void
*
tag
)
{
void
Finish
(
const
Status
&
status
,
void
*
tag
)
GRPC_OVERRIDE
{
finish_ops_
.
set_output_tag
(
tag
);
finish_ops_
.
set_output_tag
(
tag
);
if
(
!
ctx_
->
sent_initial_metadata_
)
{
if
(
!
ctx_
->
sent_initial_metadata_
)
{
finish_ops_
.
SendInitialMetadata
(
ctx_
->
initial_metadata_
,
finish_ops_
.
SendInitialMetadata
(
ctx_
->
initial_metadata_
,
...
@@ -414,9 +428,16 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
...
@@ -414,9 +428,16 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
/// Server-side interface for asynchronous bi-directional streaming.
/// Server-side interface for asynchronous bi-directional streaming.
template
<
class
W
,
class
R
>
template
<
class
W
,
class
R
>
class
ServerAsyncReaderWriter
GRPC_FINAL
:
public
ServerAsyncStreamingInterface
,
class
ServerAsyncReaderWriterInterface
:
public
ServerAsyncStreamingInterface
,
public
AsyncWriterInterface
<
W
>
,
public
AsyncWriterInterface
<
W
>
,
public
AsyncReaderInterface
<
R
>
{
public
AsyncReaderInterface
<
R
>
{
public:
virtual
void
Finish
(
const
Status
&
status
,
void
*
tag
)
=
0
;
};
template
<
class
W
,
class
R
>
class
ServerAsyncReaderWriter
GRPC_FINAL
:
public
ServerAsyncReaderWriterInterface
<
W
,
R
>
{
public:
public:
explicit
ServerAsyncReaderWriter
(
ServerContext
*
ctx
)
explicit
ServerAsyncReaderWriter
(
ServerContext
*
ctx
)
:
call_
(
nullptr
,
nullptr
,
nullptr
),
ctx_
(
ctx
)
{}
:
call_
(
nullptr
,
nullptr
,
nullptr
),
ctx_
(
ctx
)
{}
...
@@ -449,7 +470,7 @@ class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
...
@@ -449,7 +470,7 @@ class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
call_
.
PerformOps
(
&
write_ops_
);
call_
.
PerformOps
(
&
write_ops_
);
}
}
void
Finish
(
const
Status
&
status
,
void
*
tag
)
{
void
Finish
(
const
Status
&
status
,
void
*
tag
)
GRPC_OVERRIDE
{
finish_ops_
.
set_output_tag
(
tag
);
finish_ops_
.
set_output_tag
(
tag
);
if
(
!
ctx_
->
sent_initial_metadata_
)
{
if
(
!
ctx_
->
sent_initial_metadata_
)
{
finish_ops_
.
SendInitialMetadata
(
ctx_
->
initial_metadata_
,
finish_ops_
.
SendInitialMetadata
(
ctx_
->
initial_metadata_
,
...
...
This diff is collapsed.
Click to expand it.
include/grpc++/impl/codegen/impl/async_stream.h
+
32
−
11
View file @
026dfe60
...
@@ -295,8 +295,16 @@ class ClientAsyncReaderWriter GRPC_FINAL
...
@@ -295,8 +295,16 @@ class ClientAsyncReaderWriter GRPC_FINAL
};
};
template
<
class
W
,
class
R
>
template
<
class
W
,
class
R
>
class
ServerAsyncReader
GRPC_FINAL
:
public
ServerAsyncStreamingInterface
,
class
ServerAsyncReaderInterface
:
public
ServerAsyncStreamingInterface
,
public
AsyncReaderInterface
<
R
>
{
public
AsyncReaderInterface
<
R
>
{
public:
virtual
void
Finish
(
const
W
&
msg
,
const
Status
&
status
,
void
*
tag
)
=
0
;
virtual
void
FinishWithError
(
const
Status
&
status
,
void
*
tag
)
=
0
;
};
template
<
class
W
,
class
R
>
class
ServerAsyncReader
GRPC_FINAL
:
public
ServerAsyncReaderInterface
<
W
,
R
>
{
public:
public:
explicit
ServerAsyncReader
(
ServerContext
*
ctx
)
explicit
ServerAsyncReader
(
ServerContext
*
ctx
)
:
call_
(
nullptr
,
nullptr
,
nullptr
),
ctx_
(
ctx
)
{}
:
call_
(
nullptr
,
nullptr
,
nullptr
),
ctx_
(
ctx
)
{}
...
@@ -316,7 +324,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
...
@@ -316,7 +324,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
call_
.
PerformOps
(
&
read_ops_
);
call_
.
PerformOps
(
&
read_ops_
);
}
}
void
Finish
(
const
W
&
msg
,
const
Status
&
status
,
void
*
tag
)
{
void
Finish
(
const
W
&
msg
,
const
Status
&
status
,
void
*
tag
)
GRPC_OVERRIDE
{
finish_ops_
.
set_output_tag
(
tag
);
finish_ops_
.
set_output_tag
(
tag
);
if
(
!
ctx_
->
sent_initial_metadata_
)
{
if
(
!
ctx_
->
sent_initial_metadata_
)
{
finish_ops_
.
SendInitialMetadata
(
ctx_
->
initial_metadata_
);
finish_ops_
.
SendInitialMetadata
(
ctx_
->
initial_metadata_
);
...
@@ -332,7 +340,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
...
@@ -332,7 +340,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
call_
.
PerformOps
(
&
finish_ops_
);
call_
.
PerformOps
(
&
finish_ops_
);
}
}
void
FinishWithError
(
const
Status
&
status
,
void
*
tag
)
{
void
FinishWithError
(
const
Status
&
status
,
void
*
tag
)
GRPC_OVERRIDE
{
GPR_CODEGEN_ASSERT
(
!
status
.
ok
());
GPR_CODEGEN_ASSERT
(
!
status
.
ok
());
finish_ops_
.
set_output_tag
(
tag
);
finish_ops_
.
set_output_tag
(
tag
);
if
(
!
ctx_
->
sent_initial_metadata_
)
{
if
(
!
ctx_
->
sent_initial_metadata_
)
{
...
@@ -356,8 +364,14 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
...
@@ -356,8 +364,14 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
};
};
template
<
class
W
>
template
<
class
W
>
class
ServerAsyncWriter
GRPC_FINAL
:
public
ServerAsyncStreamingInterface
,
class
ServerAsyncWriterInterface
:
public
ServerAsyncStreamingInterface
,
public
AsyncWriterInterface
<
W
>
{
public
AsyncWriterInterface
<
W
>
{
public:
virtual
void
Finish
(
const
Status
&
status
,
void
*
tag
)
=
0
;
};
template
<
class
W
>
class
ServerAsyncWriter
GRPC_FINAL
:
public
ServerAsyncWriterInterface
<
W
>
{
public:
public:
explicit
ServerAsyncWriter
(
ServerContext
*
ctx
)
explicit
ServerAsyncWriter
(
ServerContext
*
ctx
)
:
call_
(
nullptr
,
nullptr
,
nullptr
),
ctx_
(
ctx
)
{}
:
call_
(
nullptr
,
nullptr
,
nullptr
),
ctx_
(
ctx
)
{}
...
@@ -382,7 +396,7 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
...
@@ -382,7 +396,7 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
call_
.
PerformOps
(
&
write_ops_
);
call_
.
PerformOps
(
&
write_ops_
);
}
}
void
Finish
(
const
Status
&
status
,
void
*
tag
)
{
void
Finish
(
const
Status
&
status
,
void
*
tag
)
GRPC_OVERRIDE
{
finish_ops_
.
set_output_tag
(
tag
);
finish_ops_
.
set_output_tag
(
tag
);
if
(
!
ctx_
->
sent_initial_metadata_
)
{
if
(
!
ctx_
->
sent_initial_metadata_
)
{
finish_ops_
.
SendInitialMetadata
(
ctx_
->
initial_metadata_
);
finish_ops_
.
SendInitialMetadata
(
ctx_
->
initial_metadata_
);
...
@@ -404,9 +418,16 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
...
@@ -404,9 +418,16 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
/// Server-side interface for asynchronous bi-directional streaming.
/// Server-side interface for asynchronous bi-directional streaming.
template
<
class
W
,
class
R
>
template
<
class
W
,
class
R
>
class
ServerAsyncReaderWriter
GRPC_FINAL
:
public
ServerAsyncStreamingInterface
,
class
ServerAsyncReaderWriterInterface
:
public
ServerAsyncStreamingInterface
,
public
AsyncWriterInterface
<
W
>
,
public
AsyncWriterInterface
<
W
>
,
public
AsyncReaderInterface
<
R
>
{
public
AsyncReaderInterface
<
R
>
{
public:
virtual
void
Finish
(
const
Status
&
status
,
void
*
tag
)
=
0
;
};
template
<
class
W
,
class
R
>
class
ServerAsyncReaderWriter
GRPC_FINAL
:
public
ServerAsyncReaderWriterInterface
<
W
,
R
>
{
public:
public:
explicit
ServerAsyncReaderWriter
(
ServerContext
*
ctx
)
explicit
ServerAsyncReaderWriter
(
ServerContext
*
ctx
)
:
call_
(
nullptr
,
nullptr
,
nullptr
),
ctx_
(
ctx
)
{}
:
call_
(
nullptr
,
nullptr
,
nullptr
),
ctx_
(
ctx
)
{}
...
@@ -437,7 +458,7 @@ class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
...
@@ -437,7 +458,7 @@ class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
call_
.
PerformOps
(
&
write_ops_
);
call_
.
PerformOps
(
&
write_ops_
);
}
}
void
Finish
(
const
Status
&
status
,
void
*
tag
)
{
void
Finish
(
const
Status
&
status
,
void
*
tag
)
GRPC_OVERRIDE
{
finish_ops_
.
set_output_tag
(
tag
);
finish_ops_
.
set_output_tag
(
tag
);
if
(
!
ctx_
->
sent_initial_metadata_
)
{
if
(
!
ctx_
->
sent_initial_metadata_
)
{
finish_ops_
.
SendInitialMetadata
(
ctx_
->
initial_metadata_
);
finish_ops_
.
SendInitialMetadata
(
ctx_
->
initial_metadata_
);
...
...
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