summaryrefslogtreecommitdiff
path: root/src/mongo/db/sessions_collection_mock.h
diff options
context:
space:
mode:
authorsamantharitter <samantha.ritter@10gen.com>2017-06-02 15:38:06 -0400
committersamantharitter <samantha.ritter@10gen.com>2017-06-07 17:14:56 -0400
commit4c3337abe512a37c8e4cb22e16eafcd04bc5bd3a (patch)
tree14e7ec8f979dcde59a77b48bdde9c607fb19e5fe /src/mongo/db/sessions_collection_mock.h
parentcb187547d18723d1b4e18ffdb069c8cdc53769a8 (diff)
downloadmongo-4c3337abe512a37c8e4cb22e16eafcd04bc5bd3a.tar.gz
SERVER-28346 Add more unit tests for the logical session cache
Diffstat (limited to 'src/mongo/db/sessions_collection_mock.h')
-rw-r--r--src/mongo/db/sessions_collection_mock.h19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/mongo/db/sessions_collection_mock.h b/src/mongo/db/sessions_collection_mock.h
index 05acb1f256f..64e2a76fc7b 100644
--- a/src/mongo/db/sessions_collection_mock.h
+++ b/src/mongo/db/sessions_collection_mock.h
@@ -54,7 +54,6 @@ namespace mongo {
*/
class MockSessionsCollectionImpl {
public:
- using SessionList = std::list<LogicalSessionId>;
using SessionMap =
stdx::unordered_map<LogicalSessionId, LogicalSessionRecord, LogicalSessionId::Hash>;
@@ -62,8 +61,8 @@ public:
using FetchHook = stdx::function<StatusWith<LogicalSessionRecord>(LogicalSessionId)>;
using InsertHook = stdx::function<Status(LogicalSessionRecord)>;
- using RefreshHook = stdx::function<SessionList(SessionList)>;
- using RemoveHook = stdx::function<void(SessionList)>;
+ using RefreshHook = stdx::function<LogicalSessionIdSet(LogicalSessionIdSet)>;
+ using RemoveHook = stdx::function<void(LogicalSessionIdSet)>;
// Set custom hooks to override default behavior
void setFetchHook(FetchHook hook);
@@ -77,8 +76,8 @@ public:
// Forwarding methods from the MockSessionsCollection
StatusWith<LogicalSessionRecord> fetchRecord(LogicalSessionId lsid);
Status insertRecord(LogicalSessionRecord record);
- SessionList refreshSessions(SessionList sessions);
- void removeRecords(SessionList sessions);
+ LogicalSessionIdSet refreshSessions(LogicalSessionIdSet sessions);
+ void removeRecords(LogicalSessionIdSet sessions);
// Test-side methods that operate on the _sessions map
void add(LogicalSessionRecord record);
@@ -91,8 +90,8 @@ private:
// Default implementations, may be overridden with custom hooks.
StatusWith<LogicalSessionRecord> _fetchRecord(LogicalSessionId lsid);
Status _insertRecord(LogicalSessionRecord record);
- SessionList _refreshSessions(SessionList sessions);
- void _removeRecords(SessionList sessions);
+ LogicalSessionIdSet _refreshSessions(LogicalSessionIdSet sessions);
+ void _removeRecords(LogicalSessionIdSet sessions);
stdx::mutex _mutex;
SessionMap _sessions;
@@ -110,8 +109,6 @@ private:
*/
class MockSessionsCollection : public SessionsCollection {
public:
- using SessionList = std::list<LogicalSessionId>;
-
explicit MockSessionsCollection(std::shared_ptr<MockSessionsCollectionImpl> impl)
: _impl(std::move(impl)) {}
@@ -123,11 +120,11 @@ public:
return _impl->insertRecord(std::move(record));
}
- SessionList refreshSessions(SessionList sessions) override {
+ LogicalSessionIdSet refreshSessions(LogicalSessionIdSet sessions) override {
return _impl->refreshSessions(std::move(sessions));
}
- void removeRecords(SessionList sessions) override {
+ void removeRecords(LogicalSessionIdSet sessions) override {
return _impl->removeRecords(std::move(sessions));
}