Skip to content

Commit

Permalink
增加SDK API
Browse files Browse the repository at this point in the history
开放bfs_change_replica_num();
增加bfs_status() API;
  • Loading branch information
apady committed Nov 30, 2018
1 parent 4e79773 commit 83cde50
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
12 changes: 12 additions & 0 deletions src/sdk/bfs_c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -374,5 +374,17 @@ int bfs_location(bfs_fs_t* fs, const char* path) {
return 0;
}

int bfs_status(bfs_fs_t* fs, const char* &status){
std::string stat_name("StatAll");
std::string result;
int32_t ret = fs->bfs_fs->SysStat(stat_name, &result);
if (ret != 0) {
return ret;
}
status=result.c_str();
return ret;

}

}
/* vim: set expandtab ts=4 sw=4 sts=4 tw=100: */
1 change: 1 addition & 0 deletions src/sdk/bfs_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ int bfs_rm_dir(bfs_fs_t* fs, const char* path, bool recursive);
int bfs_change_replica_num(bfs_fs_t* fs, const char* path, const char* replica_num);
int bfs_chmod(bfs_fs_t* fs, const char* str_mode, const char* path);
int bfs_location(bfs_fs_t* fs, const char* path);
int bfs_status(bfs_fs_t* fs, const char* &status);

#ifdef __cplusplus
}/*end extern "C" */
Expand Down
6 changes: 3 additions & 3 deletions src/sdk/fs_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ int32_t FSImpl::Rename(const char* oldpath, const char* newpath) {
return OK;
}
int32_t FSImpl::ChangeReplicaNum(const char* file_name, int32_t replica_num) {
/*

ChangeReplicaNumRequest request;
ChangeReplicaNumResponse response;
request.set_file_name(file_name);
Expand All @@ -471,8 +471,8 @@ int32_t FSImpl::ChangeReplicaNum(const char* file_name, int32_t replica_num) {
file_name, replica_num, StatusCode_Name(response.status()).c_str());
return GetErrorCode(response.status());
}
*/
return PERMISSION_DENIED;

return OK;
}

int32_t FSImpl::Symlink(const char* src, const char* dst)
Expand Down

0 comments on commit 83cde50

Please sign in to comment.