-
Notifications
You must be signed in to change notification settings - Fork 141
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
Lookup by appId #309
Lookup by appId #309
Conversation
d8cdd77
to
33b870e
Compare
Signed-off-by: dorjesinpo <[email protected]>
33b870e
to
11a7645
Compare
@@ -58,8 +61,9 @@ class VirtualStorageCatalog { | |||
typedef bsl::shared_ptr<VirtualStorage> VirtualStorageSp; | |||
|
|||
/// appKey -> virtualStorage |
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.
Need to update the comment here.
/// Any(appId, appKey) -> virtualStorage
if (appKey) { | ||
*appKey = it->first; | ||
} | ||
VirtualStoragesConstIter cit = d_virtualStorages.findByKey1(appId); |
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.
Good improvement
} | ||
|
||
// Add guid to all virtual storages. | ||
|
||
for (VirtualStoragesIter it = d_virtualStorages.begin(); | ||
it != d_virtualStorages.end(); | ||
++it) { | ||
it->second->put(msgGUID, msgSize, rdaInfo, subScriptionId); | ||
it->value()->put(msgGUID, msgSize, rdaInfo, subScriptionId); |
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.
We don't check for return codes here, what if one or few put
fails?
Currently, VirtualStorage::put
might fail if GUID is not unique
On comparison, we might return e_GUID_NOT_UNIQUE
on line 67
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.
Looks like this codepath (appKey.isNull()
) is for unique GUIDs only. The callers do not even check the return code.
We can add error code without affecting anything, I guess
Signed-off-by: dorjesinpo <[email protected]>
* Lookup by appId Signed-off-by: dorjesinpo <[email protected]> * VirtualStorageCatalog::put returns error Signed-off-by: dorjesinpo <[email protected]> --------- Signed-off-by: dorjesinpo <[email protected]>
* Lookup by appId Signed-off-by: dorjesinpo <[email protected]> * VirtualStorageCatalog::put returns error Signed-off-by: dorjesinpo <[email protected]> --------- Signed-off-by: dorjesinpo <[email protected]>
* Lookup by appId Signed-off-by: dorjesinpo <[email protected]> * VirtualStorageCatalog::put returns error Signed-off-by: dorjesinpo <[email protected]> --------- Signed-off-by: dorjesinpo <[email protected]>
Avoid iteration in
VirtualStorageCatalog::hasVirtualStorage(const bsl::string& appId
by switching toTwoKeyHashMap
Preparatory step for Reliable Broadcast