summaryrefslogtreecommitdiff
path: root/s/cursors.cpp
diff options
context:
space:
mode:
Diffstat (limited to 's/cursors.cpp')
-rw-r--r--s/cursors.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/s/cursors.cpp b/s/cursors.cpp
index c28832ca60d..903d588f77a 100644
--- a/s/cursors.cpp
+++ b/s/cursors.cpp
@@ -139,9 +139,9 @@ namespace mongo {
<< endl;
}
- ShardedClientCursorPtr CursorCache::get( long long id ) {
+ ShardedClientCursorPtr CursorCache::get( long long id ) const {
scoped_lock lk( _mutex );
- MapSharded::iterator i = _cursors.find( id );
+ MapSharded::const_iterator i = _cursors.find( id );
if ( i == _cursors.end() ) {
OCCASIONALLY log() << "Sharded CursorCache missing cursor id: " << id << endl;
return ShardedClientCursorPtr();
@@ -168,6 +168,16 @@ namespace mongo {
_refs[id] = server;
}
+ string CursorCache::getRef( long long id ) const {
+ assert( id );
+ scoped_lock lk( _mutex );
+ MapNormal::const_iterator i = _refs.find( id );
+ if ( i == _refs.end() )
+ return "";
+ return i->second;
+ }
+
+
long long CursorCache::genId() {
while ( true ) {
long long x = security.getNonce();
@@ -236,7 +246,7 @@ namespace mongo {
}
}
- void CursorCache::appendInfo( BSONObjBuilder& result ) {
+ void CursorCache::appendInfo( BSONObjBuilder& result ) const {
scoped_lock lk( _mutex );
result.append( "sharded" , (int)_cursors.size() );
result.appendNumber( "shardedEver" , _shardedTotal );