31 #include <boost/filesystem/path.hpp> 35 #include "mongo/base/string_data.h" 36 #include "mongo/db/namespace_string.h" 37 #include "mongo/util/assert_util.h" 38 #include "mongo/util/mongoutils/str.h" 64 memset(
buf, 0,
sizeof(
buf));
66 str::stream() <<
"ns name " << ns <<
" (size: " << ns.size()
67 <<
") too long, max size is 127 bytes",
70 17380,
"ns name can't contain embedded '\0' byte", ns.find(
'\0') == std::string::npos);
80 return strcmp(
buf, r) == 0;
83 return strcmp(
buf, r.
buf) == 0;
86 return strcmp(
buf, r) != 0;
89 return strcmp(
buf, r.
buf) != 0;
93 return strchr(
buf,
'$') != NULL;
106 return (x & 0x7fffffff) | 0x8000000;
116 operator std::string()
const {
126 char ex[] =
"$extra";
128 const std::string s = std::string(
buf) + ex;
129 massert(10348,
"$extra: ns name too long", s.size() <=
MaxNsLen);
138 const char* p = strstr(
buf,
"$extr");
bool operator!=(const Namespace &r) const
Definition: namespace.h:88
Collection *const const NamespaceString & ns
Definition: collection_info_cache_impl.cpp:53
Copyright (C) 2014 MongoDB Inc.
Definition: bson_collection_catalog_entry.cpp:38
void kill()
Definition: namespace.h:75
Namespace(StringData ns)
Definition: namespace.h:51
bool operator==(const Namespace &r) const
Definition: namespace.h:82
MONGO_STATIC_ASSERT(sizeof(void *)==sizeof(size_t))
std::string toString() const
Definition: namespace.h:113
Definition: namespace.h:153
size_t size() const
Definition: namespace.h:109
Definition: namespace.h:146
int hash() const
Value returned is always > 0.
Definition: namespace.h:99
MaxNsLenValue
Definition: namespace.h:143
bool operator!=(const char *r) const
Definition: namespace.h:85
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
std::string extraName(int i) const
NamespaceDetails::Extra was added after fact to allow chaining of data blocks to support more than 10...
Definition: namespace.h:125
bool hasDollarSign() const
Definition: namespace.h:92
char buf[MaxNsLenWithNUL]
Definition: namespace.h:157
Namespace & operator=(StringData ns)
Definition: namespace.h:55
Definition: namespace.h:149
bool operator==(const char *r) const
Definition: namespace.h:79
bool isExtra() const
Returns whether the namespace ends with "$extr...".
Definition: namespace.h:137