diff options
author | Eliot Horowitz <eliot@10gen.com> | 2012-03-30 18:47:25 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2012-03-30 18:47:25 -0400 |
commit | bed1efe7769b9c0eb3be4cbe9e623998b137593e (patch) | |
tree | c997b4dfa2c782bb986f39660aa978363be11dbd /src/mongo/db/pdfile.h | |
parent | 41100feec23f2030db1fd3fc5dc99d4ef10096ad (diff) | |
download | mongo-bed1efe7769b9c0eb3be4cbe9e623998b137593e.tar.gz |
make records in DeletedRecord private
nextDeleted is ugly because of const issues right now
Diffstat (limited to 'src/mongo/db/pdfile.h')
-rw-r--r-- | src/mongo/db/pdfile.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/mongo/db/pdfile.h b/src/mongo/db/pdfile.h index 6d2da3f2aca..b0b927eb15f 100644 --- a/src/mongo/db/pdfile.h +++ b/src/mongo/db/pdfile.h @@ -165,15 +165,31 @@ namespace mongo { class DeletedRecord { public: - int lengthWithHeaders; - int extentOfs; - DiskLoc nextDeleted; + + int lengthWithHeaders() const { _accessing(); return _lengthWithHeaders; } + int& lengthWithHeaders() { _accessing(); return _lengthWithHeaders; } + + int extentOfs() const { _accessing(); return _extentOfs; } + int& extentOfs() { _accessing(); return _extentOfs; } + + // TODO: we need to not const_cast here but problem is DiskLoc::writing + DiskLoc& nextDeleted() const { _accessing(); return const_cast<DiskLoc&>(_nextDeleted); } + DiskLoc myExtentLoc(const DiskLoc& myLoc) const { - return DiskLoc(myLoc.a(), extentOfs); + _accessing(); + return DiskLoc(myLoc.a(), _extentOfs); } Extent* myExtent(const DiskLoc& myLoc) { - return DataFileMgr::getExtent(DiskLoc(myLoc.a(), extentOfs)); + _accessing(); + return DataFileMgr::getExtent(DiskLoc(myLoc.a(), _extentOfs)); } + private: + + void _accessing() const; + + int _lengthWithHeaders; + int _extentOfs; + DiskLoc _nextDeleted; }; /* Record is a record in a datafile. DeletedRecord is similar but for deleted space. |