Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bfs_status() SDK API,activate FSImpl::ChangeReplicaNum() #930

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ thirdparty
output
.build
src/version.cc
.DS_Store
23 changes: 21 additions & 2 deletions src/sdk/bfs_c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ int bfs_du(bfs_fs_t* fs, const char* path) {
int bfs_rm_dir(bfs_fs_t* fs, const char* path, bool recursive) {
return fs->bfs_fs->DeleteDirectory(path, recursive);
}

int bfs_change_bfs_fslica_num(bfs_fs_t* fs, const char* path,
int bfs_change_replica_num(bfs_fs_t* fs, const char* path,
const char* bfs_fslica_num) {
if (!isdigit(*bfs_fslica_num)) {
return -1;
Expand Down Expand Up @@ -374,5 +374,24 @@ int bfs_location(bfs_fs_t* fs, const char* path) {
return 0;
}

int bfs_status(bfs_fs_t* fs, 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;
}
if(result.length()>0){
if(status != NULL)
delete []status;
status=new char[result.length()+1];
strcpy(status,result.c_str());
return 0;
}else{
return -9;
}

}

}
/* 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, 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