-
Notifications
You must be signed in to change notification settings - Fork 553
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
Dir lock #885
base: master
Are you sure you want to change the base?
Dir lock #885
Conversation
StatusCode status = namespace_->GetDirLockStatus(path); | ||
std::string parent_path(path, 0, path.find_last_of("/")); | ||
FileInfo info; | ||
if (!namespace_->CheckDirLockPermission(parent_path, request->uuid(), &info)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这info是干啥的啊,而且为啥是在外面剥掉一层才传进去。。
} | ||
*info = root_path_; | ||
return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果path不是/,就不检查根目录的状态了?
if (status == kDirUnlock) { | ||
namespace_->SetDirLockStatus(path, kDirLocked, request->uuid()); | ||
namespace_->SetDirLockStatus(path, kDirLocked, request->uuid(), &log); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个if的嵌套我没太懂啊。。。为啥不能是if(locked)() else if (cleaning) else if (unlock)?
status = kOK; | ||
need_log_remote = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log.entries_size()是不是就行了。而且LogRemote检查是不是更好
if (block_mapping_manager_->CheckBlocksClosed(blocks)) { | ||
NameServerLog log; | ||
if (request->force_unlock()) { | ||
namespace_->SetDirLockStatus(path, kDirUnlock, "", &log); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这块价格注释解释下为啥有这么个选项吧
FileInfo info; | ||
for (size_t i = 0; i < paths.size() - 1; i++) { | ||
EncodingStoreKey(entry_id, paths[i], &file_key); | ||
bool r = GetFromStore(file_key, &info); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这r是干嘛的。。。
entry_id = info.entry_id(); | ||
} | ||
EncodingStoreKey(entry_id, paths[paths.size() - 1], &file_key); | ||
bool r = GetFromStore(file_key, &info); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
还有这个r。。。
if (!LookUp(path, &info)) { | ||
return; | ||
} | ||
if (GetFileType(info.type()) == kDefault) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
话说kDefault这个很奇特啊。。为啥一个file的type是default==
leveldb::Iterator* it = db_->NewIterator(leveldb::ReadOptions()); | ||
for (it->Seek(key_start); it->Valid(); it->Next()) { | ||
leveldb::Slice key = it->key(); | ||
if (key.compare(key_end)>=0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
少空格
return true; | ||
} | ||
|
||
bool NameSpace::CheckDirLockPermission(const FileInfo& file_info, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这和上面那个啥关系啊。。为啥不是互相调用?
(#527)