-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
325 additions
and
331 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,49 @@ | ||
// RPC stubs for clients to talk to extent_server | ||
|
||
#include "extent_client.h" | ||
#include <sstream> | ||
#include <iostream> | ||
#include <stdio.h> | ||
#include <unistd.h> | ||
#include <time.h> | ||
#include <jsl_log.h> | ||
|
||
// The calls assume that the caller holds a lock on the extent | ||
|
||
extent_client::extent_client(std::string dst) | ||
{ | ||
extent_client::extent_client(const std::string &dst) { | ||
sockaddr_in dstsock; | ||
make_sockaddr(dst.c_str(), &dstsock); | ||
cl = new rpcc(dstsock); | ||
if (cl->bind() != 0) { | ||
printf("extent_client: bind failed\n"); | ||
} | ||
cl = std::unique_ptr<rpcc>(new rpcc(dstsock)); | ||
VERIFY(cl->bind() == 0); | ||
} | ||
|
||
extent_protocol::status | ||
extent_client::get(extent_protocol::extentid_t eid, std::string &buf) | ||
{ | ||
extent_protocol::status extent_client::get(extent_protocol::extentid_t eid, | ||
std::string &buf) { | ||
jsl_log(JSL_DBG_ME, "extent_client: get %llu\n", eid); | ||
extent_protocol::status ret = extent_protocol::OK; | ||
ret = cl->call(extent_protocol::get, eid, buf); | ||
jsl_log(JSL_DBG_ME, "extent_client: get %llu buf = %s\n", eid, buf.c_str()); | ||
return ret; | ||
} | ||
|
||
extent_protocol::status | ||
extent_client::getattr(extent_protocol::extentid_t eid, | ||
extent_protocol::attr &attr) | ||
{ | ||
extent_protocol::status extent_client::getattr(extent_protocol::extentid_t eid, | ||
extent_protocol::attr &attr) { | ||
jsl_log(JSL_DBG_ME, "extent_client: getattr %llu\n", eid); | ||
extent_protocol::status ret = extent_protocol::OK; | ||
ret = cl->call(extent_protocol::getattr, eid, attr); | ||
return ret; | ||
} | ||
|
||
extent_protocol::status | ||
extent_client::put(extent_protocol::extentid_t eid, std::string buf) | ||
{ | ||
extent_protocol::status extent_client::put(extent_protocol::extentid_t eid, | ||
std::string buf) { | ||
jsl_log(JSL_DBG_ME, "extent_client: put %llu %s\n", eid, buf.c_str()); | ||
extent_protocol::status ret = extent_protocol::OK; | ||
int r; | ||
ret = cl->call(extent_protocol::put, eid, buf, r); | ||
return ret; | ||
} | ||
|
||
extent_protocol::status | ||
extent_client::remove(extent_protocol::extentid_t eid) | ||
extent_protocol::status extent_client::remove(extent_protocol::extentid_t eid) | ||
{ | ||
jsl_log(JSL_DBG_ME, "extent_client: remove %llu\n", eid); | ||
extent_protocol::status ret = extent_protocol::OK; | ||
int r; | ||
ret = cl->call(extent_protocol::remove, eid, r); | ||
return ret; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.