Skip to content

Commit

Permalink
ctdb-protocol: Add marshalling for new control VACUUM_FETCH
Browse files Browse the repository at this point in the history
Signed-off-by: Amitay Isaacs <[email protected]>
Reviewed-by: Martin Schwenke <[email protected]>
  • Loading branch information
amitay authored and Amitay Isaacs committed Oct 24, 2019
1 parent 0872c52 commit b71d8cd
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ctdb/protocol/protocol_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,10 @@ void ctdb_req_control_tunnel_deregister(struct ctdb_req_control *request,
uint64_t tunnel_id);
int ctdb_reply_control_tunnel_deregister(struct ctdb_reply_control *reply);

void ctdb_req_control_vacuum_fetch(struct ctdb_req_control *request,
struct ctdb_rec_buffer *recbuf);
int ctdb_reply_control_vacuum_fetch(struct ctdb_reply_control *reply);

/* From protocol/protocol_debug.c */

void ctdb_packet_print(uint8_t *buf, size_t buflen, FILE *fp);
Expand Down
24 changes: 24 additions & 0 deletions ctdb/protocol/protocol_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -2337,3 +2337,27 @@ int ctdb_reply_control_tunnel_deregister(struct ctdb_reply_control *reply)

return reply->status;
}

/* CTDB_CONTROL_VACUUM_FETCH */

void ctdb_req_control_vacuum_fetch(struct ctdb_req_control *request,
struct ctdb_rec_buffer *recbuf)
{
request->opcode = CTDB_CONTROL_VACUUM_FETCH;
request->pad = 0;
request->srvid = 0;
request->client_id = 0;
request->flags = 0;

request->rdata.opcode = CTDB_CONTROL_VACUUM_FETCH;
request->rdata.data.recbuf = recbuf;
}

int ctdb_reply_control_vacuum_fetch(struct ctdb_reply_control *reply)
{
if (reply->rdata.opcode != CTDB_CONTROL_VACUUM_FETCH) {
return EPROTO;
}

return reply->status;
}
22 changes: 22 additions & 0 deletions ctdb/protocol/protocol_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,10 @@ static size_t ctdb_req_control_data_len(struct ctdb_req_control_data *cd)

case CTDB_CONTROL_TUNNEL_DEREGISTER:
break;

case CTDB_CONTROL_VACUUM_FETCH:
len = ctdb_rec_buffer_len(cd->data.recbuf);
break;
}

return len;
Expand Down Expand Up @@ -682,6 +686,10 @@ static void ctdb_req_control_data_push(struct ctdb_req_control_data *cd,
case CTDB_CONTROL_CHECK_PID_SRVID:
ctdb_pid_srvid_push(cd->data.pid_srvid, buf, &np);
break;

case CTDB_CONTROL_VACUUM_FETCH:
ctdb_rec_buffer_push(cd->data.recbuf, buf, &np);
break;
}

*npush = np;
Expand Down Expand Up @@ -1006,6 +1014,11 @@ static int ctdb_req_control_data_pull(uint8_t *buf, size_t buflen,
ret = ctdb_pid_srvid_pull(buf, buflen, mem_ctx,
&cd->data.pid_srvid, &np);
break;

case CTDB_CONTROL_VACUUM_FETCH:
ret = ctdb_rec_buffer_pull(buf, buflen, mem_ctx,
&cd->data.recbuf, &np);
break;
}

if (ret != 0) {
Expand Down Expand Up @@ -1363,6 +1376,9 @@ static size_t ctdb_reply_control_data_len(struct ctdb_reply_control_data *cd)

case CTDB_CONTROL_TUNNEL_DEREGISTER:
break;

case CTDB_CONTROL_VACUUM_FETCH:
break;
}

return len;
Expand Down Expand Up @@ -1517,6 +1533,9 @@ static void ctdb_reply_control_data_push(struct ctdb_reply_control_data *cd,

case CTDB_CONTROL_CHECK_PID_SRVID:
break;

case CTDB_CONTROL_VACUUM_FETCH:
break;
}

*npush = np;
Expand Down Expand Up @@ -1701,6 +1720,9 @@ static int ctdb_reply_control_data_pull(uint8_t *buf, size_t buflen,

case CTDB_CONTROL_CHECK_PID_SRVID:
break;

case CTDB_CONTROL_VACUUM_FETCH:
break;
}

if (ret != 0) {
Expand Down
1 change: 1 addition & 0 deletions ctdb/protocol/protocol_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ static void ctdb_opcode_print(uint32_t opcode, FILE *fp)
{ CTDB_CONTROL_CHECK_PID_SRVID, "CHECK_PID_SRVID" },
{ CTDB_CONTROL_TUNNEL_REGISTER, "TUNNEL_REGISTER" },
{ CTDB_CONTROL_TUNNEL_DEREGISTER, "TUNNEL_DEREGISTER" },
{ CTDB_CONTROL_VACUUM_FETCH, "VACUUM_FETCH" },
{ MAP_END, "" },
};

Expand Down

0 comments on commit b71d8cd

Please sign in to comment.