mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 13:27:53 +00:00
lib: remove unnecessary rpc request in grpc
Bit of leftover copypaste code there. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
420752a9b6
commit
f6239dc799
@ -179,10 +179,9 @@ class NorthboundImpl
|
|||||||
zlog_debug("received RPC GetCapabilities()");
|
zlog_debug("received RPC GetCapabilities()");
|
||||||
|
|
||||||
switch (tag->state) {
|
switch (tag->state) {
|
||||||
case CREATE: {
|
case CREATE:
|
||||||
REQUEST_RPC(GetCapabilities);
|
REQUEST_RPC(GetCapabilities);
|
||||||
tag->state = PROCESS;
|
tag->state = PROCESS;
|
||||||
}
|
|
||||||
case PROCESS: {
|
case PROCESS: {
|
||||||
|
|
||||||
// Response: string frr_version = 1;
|
// Response: string frr_version = 1;
|
||||||
@ -303,10 +302,9 @@ class NorthboundImpl
|
|||||||
zlog_debug("received RPC CreateCandidate()");
|
zlog_debug("received RPC CreateCandidate()");
|
||||||
|
|
||||||
switch (tag->state) {
|
switch (tag->state) {
|
||||||
case CREATE: {
|
case CREATE:
|
||||||
REQUEST_RPC(CreateCandidate);
|
REQUEST_RPC(CreateCandidate);
|
||||||
tag->state = PROCESS;
|
tag->state = PROCESS;
|
||||||
}
|
|
||||||
case PROCESS: {
|
case PROCESS: {
|
||||||
struct candidate *candidate = create_candidate();
|
struct candidate *candidate = create_candidate();
|
||||||
if (!candidate) {
|
if (!candidate) {
|
||||||
@ -336,10 +334,9 @@ class NorthboundImpl
|
|||||||
frr::DeleteCandidateResponse> *tag)
|
frr::DeleteCandidateResponse> *tag)
|
||||||
{
|
{
|
||||||
switch (tag->state) {
|
switch (tag->state) {
|
||||||
case CREATE: {
|
case CREATE:
|
||||||
REQUEST_RPC(DeleteCandidate);
|
REQUEST_RPC(DeleteCandidate);
|
||||||
tag->state = PROCESS;
|
tag->state = PROCESS;
|
||||||
}
|
|
||||||
case PROCESS: {
|
case PROCESS: {
|
||||||
|
|
||||||
// Request: uint32 candidate_id = 1;
|
// Request: uint32 candidate_id = 1;
|
||||||
@ -380,10 +377,9 @@ class NorthboundImpl
|
|||||||
frr::UpdateCandidateResponse> *tag)
|
frr::UpdateCandidateResponse> *tag)
|
||||||
{
|
{
|
||||||
switch (tag->state) {
|
switch (tag->state) {
|
||||||
case CREATE: {
|
case CREATE:
|
||||||
REQUEST_RPC(UpdateCandidate);
|
REQUEST_RPC(UpdateCandidate);
|
||||||
tag->state = PROCESS;
|
tag->state = PROCESS;
|
||||||
}
|
|
||||||
case PROCESS: {
|
case PROCESS: {
|
||||||
|
|
||||||
// Request: uint32 candidate_id = 1;
|
// Request: uint32 candidate_id = 1;
|
||||||
@ -438,10 +434,9 @@ class NorthboundImpl
|
|||||||
frr::EditCandidateResponse> *tag)
|
frr::EditCandidateResponse> *tag)
|
||||||
{
|
{
|
||||||
switch (tag->state) {
|
switch (tag->state) {
|
||||||
case CREATE: {
|
case CREATE:
|
||||||
REQUEST_RPC(EditCandidate);
|
REQUEST_RPC(EditCandidate);
|
||||||
tag->state = PROCESS;
|
tag->state = PROCESS;
|
||||||
}
|
|
||||||
case PROCESS: {
|
case PROCESS: {
|
||||||
|
|
||||||
// Request: uint32 candidate_id = 1;
|
// Request: uint32 candidate_id = 1;
|
||||||
@ -531,12 +526,10 @@ class NorthboundImpl
|
|||||||
frr::LoadToCandidateResponse> *tag)
|
frr::LoadToCandidateResponse> *tag)
|
||||||
{
|
{
|
||||||
switch (tag->state) {
|
switch (tag->state) {
|
||||||
case CREATE: {
|
case CREATE:
|
||||||
REQUEST_RPC(LoadToCandidate);
|
REQUEST_RPC(LoadToCandidate);
|
||||||
tag->state = PROCESS;
|
tag->state = PROCESS;
|
||||||
}
|
|
||||||
case PROCESS: {
|
case PROCESS: {
|
||||||
|
|
||||||
// Request: uint32 candidate_id = 1;
|
// Request: uint32 candidate_id = 1;
|
||||||
uint32_t candidate_id = tag->request.candidate_id();
|
uint32_t candidate_id = tag->request.candidate_id();
|
||||||
|
|
||||||
@ -610,12 +603,10 @@ class NorthboundImpl
|
|||||||
HandleCommit(RpcState<frr::CommitRequest, frr::CommitResponse> *tag)
|
HandleCommit(RpcState<frr::CommitRequest, frr::CommitResponse> *tag)
|
||||||
{
|
{
|
||||||
switch (tag->state) {
|
switch (tag->state) {
|
||||||
case CREATE: {
|
case CREATE:
|
||||||
REQUEST_RPC(Commit);
|
REQUEST_RPC(Commit);
|
||||||
tag->state = PROCESS;
|
tag->state = PROCESS;
|
||||||
}
|
|
||||||
case PROCESS: {
|
case PROCESS: {
|
||||||
|
|
||||||
// Request: uint32 candidate_id = 1;
|
// Request: uint32 candidate_id = 1;
|
||||||
uint32_t candidate_id = tag->request.candidate_id();
|
uint32_t candidate_id = tag->request.candidate_id();
|
||||||
if (nb_dbg_client_grpc)
|
if (nb_dbg_client_grpc)
|
||||||
@ -782,14 +773,13 @@ class NorthboundImpl
|
|||||||
zlog_debug("received RPC ListTransactions()");
|
zlog_debug("received RPC ListTransactions()");
|
||||||
|
|
||||||
switch (tag->state) {
|
switch (tag->state) {
|
||||||
case CREATE: {
|
case CREATE:
|
||||||
REQUEST_RPC_STREAMING(ListTransactions);
|
REQUEST_RPC_STREAMING(ListTransactions);
|
||||||
tag->context = new std::list<std::tuple<
|
tag->context = new std::list<std::tuple<
|
||||||
int, std::string, std::string, std::string>>();
|
int, std::string, std::string, std::string>>();
|
||||||
nb_db_transactions_iterate(list_transactions_cb,
|
nb_db_transactions_iterate(list_transactions_cb,
|
||||||
tag->context);
|
tag->context);
|
||||||
tag->state = PROCESS;
|
tag->state = PROCESS;
|
||||||
}
|
|
||||||
case PROCESS: {
|
case PROCESS: {
|
||||||
auto list = static_cast<std::list<std::tuple<
|
auto list = static_cast<std::list<std::tuple<
|
||||||
int, std::string, std::string, std::string>> *>(
|
int, std::string, std::string, std::string>> *>(
|
||||||
@ -834,10 +824,9 @@ class NorthboundImpl
|
|||||||
frr::GetTransactionResponse> *tag)
|
frr::GetTransactionResponse> *tag)
|
||||||
{
|
{
|
||||||
switch (tag->state) {
|
switch (tag->state) {
|
||||||
case CREATE: {
|
case CREATE:
|
||||||
REQUEST_RPC(GetTransaction);
|
REQUEST_RPC(GetTransaction);
|
||||||
tag->state = PROCESS;
|
tag->state = PROCESS;
|
||||||
}
|
|
||||||
case PROCESS: {
|
case PROCESS: {
|
||||||
// Request: uint32 transaction_id = 1;
|
// Request: uint32 transaction_id = 1;
|
||||||
uint32_t transaction_id = tag->request.transaction_id();
|
uint32_t transaction_id = tag->request.transaction_id();
|
||||||
@ -900,22 +889,14 @@ class NorthboundImpl
|
|||||||
void HandleLockConfig(
|
void HandleLockConfig(
|
||||||
RpcState<frr::LockConfigRequest, frr::LockConfigResponse> *tag)
|
RpcState<frr::LockConfigRequest, frr::LockConfigResponse> *tag)
|
||||||
{
|
{
|
||||||
|
if (nb_dbg_client_grpc)
|
||||||
|
zlog_debug("received RPC LockConfig()");
|
||||||
|
|
||||||
switch (tag->state) {
|
switch (tag->state) {
|
||||||
case CREATE: {
|
case CREATE:
|
||||||
REQUEST_RPC(LockConfig);
|
REQUEST_RPC(LockConfig);
|
||||||
tag->state = PROCESS;
|
tag->state = PROCESS;
|
||||||
}
|
|
||||||
case PROCESS: {
|
case PROCESS: {
|
||||||
auto rpcState = new RpcState<frr::LockConfigRequest,
|
|
||||||
frr::LockConfigResponse>(
|
|
||||||
this, &NorthboundImpl::HandleLockConfig);
|
|
||||||
_service->RequestLockConfig(
|
|
||||||
&rpcState->ctx, &rpcState->request,
|
|
||||||
&rpcState->responder, _cq, _cq, rpcState);
|
|
||||||
|
|
||||||
if (nb_dbg_client_grpc)
|
|
||||||
zlog_debug("received RPC LockConfig()");
|
|
||||||
|
|
||||||
if (nb_running_lock(NB_CLIENT_GRPC, NULL)) {
|
if (nb_running_lock(NB_CLIENT_GRPC, NULL)) {
|
||||||
tag->responder.Finish(
|
tag->responder.Finish(
|
||||||
tag->response,
|
tag->response,
|
||||||
@ -941,16 +922,14 @@ class NorthboundImpl
|
|||||||
void HandleUnlockConfig(RpcState<frr::UnlockConfigRequest,
|
void HandleUnlockConfig(RpcState<frr::UnlockConfigRequest,
|
||||||
frr::UnlockConfigResponse> *tag)
|
frr::UnlockConfigResponse> *tag)
|
||||||
{
|
{
|
||||||
|
if (nb_dbg_client_grpc)
|
||||||
|
zlog_debug("received RPC UnlockConfig()");
|
||||||
|
|
||||||
switch (tag->state) {
|
switch (tag->state) {
|
||||||
case CREATE: {
|
case CREATE:
|
||||||
REQUEST_RPC(UnlockConfig);
|
REQUEST_RPC(UnlockConfig);
|
||||||
tag->state = PROCESS;
|
tag->state = PROCESS;
|
||||||
}
|
|
||||||
case PROCESS: {
|
case PROCESS: {
|
||||||
|
|
||||||
if (nb_dbg_client_grpc)
|
|
||||||
zlog_debug("received RPC UnlockConfig()");
|
|
||||||
|
|
||||||
if (nb_running_unlock(NB_CLIENT_GRPC, NULL)) {
|
if (nb_running_unlock(NB_CLIENT_GRPC, NULL)) {
|
||||||
tag->responder.Finish(
|
tag->responder.Finish(
|
||||||
tag->response,
|
tag->response,
|
||||||
@ -984,12 +963,10 @@ class NorthboundImpl
|
|||||||
const char *xpath;
|
const char *xpath;
|
||||||
|
|
||||||
switch (tag->state) {
|
switch (tag->state) {
|
||||||
case CREATE: {
|
case CREATE:
|
||||||
REQUEST_RPC(Execute);
|
REQUEST_RPC(Execute);
|
||||||
tag->state = PROCESS;
|
tag->state = PROCESS;
|
||||||
}
|
|
||||||
case PROCESS: {
|
case PROCESS: {
|
||||||
|
|
||||||
// Request: string path = 1;
|
// Request: string path = 1;
|
||||||
xpath = tag->request.path().c_str();
|
xpath = tag->request.path().c_str();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user