Open
Conversation
added 29 commits
March 10, 2017 13:28
lylei
reviewed
Mar 27, 2017
| 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)) { |
Collaborator
There was a problem hiding this comment.
这info是干啥的啊,而且为啥是在外面剥掉一层才传进去。。
| } | ||
| *info = root_path_; | ||
| return true; | ||
| } |
| //TODO log remote? | ||
| if (status == kDirUnlock) { | ||
| namespace_->SetDirLockStatus(path, kDirLocked, request->uuid()); | ||
| namespace_->SetDirLockStatus(path, kDirLocked, request->uuid(), &log); |
Collaborator
There was a problem hiding this comment.
这个if的嵌套我没太懂啊。。。为啥不能是if(locked)() else if (cleaning) else if (unlock)?
| namespace_->SetDirLockStatus(path, kDirLocked, request->uuid(), &log); | ||
| LOG(INFO, "%s lock dir %s", request->uuid().c_str(), path.c_str()); | ||
| status = kOK; | ||
| need_log_remote = true; |
Collaborator
There was a problem hiding this comment.
log.entries_size()是不是就行了。而且LogRemote检查是不是更好
| if (block_mapping_manager_->CheckBlocksClosed(blocks)) { | ||
| NameServerLog log; | ||
| if (request->force_unlock()) { | ||
| namespace_->SetDirLockStatus(path, kDirUnlock, "", &log); |
| 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); |
| entry_id = info.entry_id(); | ||
| } | ||
| EncodingStoreKey(entry_id, paths[paths.size() - 1], &file_key); | ||
| bool r = GetFromStore(file_key, &info); |
| if (!LookUp(path, &info)) { | ||
| return; | ||
| } | ||
| if (GetFileType(info.type()) == kDefault) { |
Collaborator
There was a problem hiding this comment.
话说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) { |
| return true; | ||
| } | ||
|
|
||
| bool NameSpace::CheckDirLockPermission(const FileInfo& file_info, |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(#527)