Storage Engine API
extent.h
Go to the documentation of this file.
1 // extent.h
2 
31 #pragma once
32 
33 #include <iosfwd>
34 #include <string>
35 #include <vector>
36 
39 
40 namespace mongo {
41 
42 /* extents are datafile regions where all the records within the region
43  belong to the same namespace.
44 
45 (11:12:35 AM) dm10gen: when the extent is allocated, all its empty space is stuck into one big
46  DeletedRecord
47 (11:12:55 AM) dm10gen: and that is placed on the free list
48 */
49 #pragma pack(1)
50 struct Extent {
51  enum { extentSignature = 0x41424344 };
52  unsigned magic;
54 
55  /* next/prev extent for this namespace */
58 
59  /* which namespace this extent is for. this is just for troubleshooting really
60  and won't even be correct if the collection were renamed!
61  */
63 
64  int length; /* size of the extent, including these fields */
67  char _extentData[4];
68 
69  // -----
70 
71  bool validates(const DiskLoc diskLoc, std::vector<std::string>* errors = NULL) const;
72 
73  BSONObj dump() const;
74 
75  void dump(std::iostream& s) const;
76 
77  bool isOk() const {
78  return magic == extentSignature;
79  }
80  void assertOk() const {
81  verify(isOk());
82  }
83 
84  static int HeaderSize() {
85  return sizeof(Extent) - 4;
86  }
87 };
88 #pragma pack()
89 }
Definition: extent.h:51
BSONObj dump() const
Definition: extent.cpp:46
Definition: extent.h:50
bool isOk() const
Definition: extent.h:77
Copyright (C) 2014 MongoDB Inc.
Definition: bson_collection_catalog_entry.cpp:38
bool validates(const DiskLoc diskLoc, std::vector< std::string > *errors=NULL) const
Definition: extent.cpp:67
represents a disk location/offset on disk in a database.
Definition: diskloc.h:53
char _extentData[4]
Definition: extent.h:67
static int HeaderSize()
Definition: extent.h:84
DiskLoc xnext
Definition: extent.h:56
DiskLoc myLoc
Definition: extent.h:53
unsigned magic
Definition: extent.h:52
DiskLoc lastRecord
Definition: extent.h:66
This is used for storing a namespace on disk in a fixed witdh form and should only be used for that...
Definition: namespace.h:49
void assertOk() const
Definition: extent.h:80
int length
Definition: extent.h:64
DiskLoc firstRecord
Definition: extent.h:65
Namespace nsDiagnostic
Definition: extent.h:62
DiskLoc xprev
Definition: extent.h:57