|
MongoDB
2.4.4-pre-
|
Copyright (C) 2013 10gen Inc. More...
Classes | |
| struct | Auth |
| class | PoolForHost |
| not thread safe thread safety is handled by DBConnectionPool More... | |
| class | DBConnectionHook |
| class | DBConnectionPool |
| Database connection pool. More... | |
| class | AScopedConnection |
| class | ScopedDbConnection |
| Use to get a connection from the pool. More... | |
| class | ReplicaSetMonitor |
| manages state about a replica set for client keeps tabs on whose master and what slaves are up can hand a slave to someone for SLAVE_OK one instance per process per replica set TODO: we might be able to use a regular Node * to avoid _lock More... | |
| class | DBClientReplicaSet |
| Use this class to connect to a replica set of servers. More... | |
| class | TagSet |
| A simple object for representing the list of tags. More... | |
| struct | ReadPreferenceSetting |
| class | DBClientCursorInterface |
| for mock purposes only – do not create variants of DBClientCursor, nor hang code here More... | |
| class | DBClientCursor |
| Queries return a cursor object. More... | |
| class | DBClientCursorBatchIterator |
| iterate over objects in current batch only - will not cause a network call More... | |
| class | ConnectionString |
| ConnectionString handles parsing different ways to connect to mongo and determining method samples: server server:port foo/server:port,server:port SET server,server,server SYNC Warning - you usually don't want "SYNC", it's used for some special things such as sharding config servers. More... | |
| class | Query |
| Represents a Mongo query expression. More... | |
| class | QuerySpec |
| Represents a full query description, including all options required for the query to be passed on to other hosts. More... | |
| class | DBConnector |
| interface that handles communication with the db More... | |
| class | DBClientInterface |
| The interface that any db connection should implement. More... | |
| class | DBClientWithCommands |
| DB "commands" Basically just invocations of connection. More... | |
| class | DBClientBase |
| abstract class that implements the core db operations More... | |
| class | ConnectException |
| class | DBClientConnection |
| A basic connection to the database. More... | |
| class | DBClientMockCursor |
| class | LockException |
| Exception class to encapsulate exceptions while managing distributed locks. More... | |
| class | TimeNotFoundException |
| Indicates an error in retrieving time values from remote servers. More... | |
| class | DistributedLock |
| The distributed lock is a configdb backed way of synchronizing system-wide tasks. More... | |
| class | dist_lock_try |
| class | ScopedDistributedLock |
| Scoped wrapper for a distributed lock acquisition attempt. More... | |
| class | GridFSChunk |
| class | GridFS |
| GridFS is for storing large file-style objects in MongoDB. More... | |
| class | GridFile |
| wrapper for a file stored in the Mongo database More... | |
| class | Model |
| Model is a base class for defining objects which are serializable to the Mongo database via the database driver. More... | |
| class | ServerAndQuery |
| holder for a server address and a query to run More... | |
| class | ClusteredCursor |
| this is a cursor that works over a set of servers can be used in serial/parallel as controlled by sub classes More... | |
| class | FilteringClientCursor |
| class | Servers |
| class | SerialServerClusteredCursor |
| runs a query in serial across any number of servers returns all results from 1 server, then the next, etc... More... | |
| class | CommandInfo |
| class | ParallelConnectionState |
| class | ParallelConnectionMetadata |
| class | ParallelSortClusteredCursor |
| Runs a query in parallel across N servers. More... | |
| class | Future |
| tools for doing asynchronous operations right now uses underlying sync network ops and uses another thread should be changed to use non-blocking io More... | |
| class | SyncClusterConnection |
| This is a connection to a cluster of servers that operate as one for super high durability. More... | |
| class | UpdateNotTheSame |
| class | JParse |
| Parser class. More... | |
| struct | BSONElementFieldNameCmp |
| class | BSONBuilderBase |
| class | BSONFieldValue |
| A BSONField holds the name and the type intended for a given BSON element. More... | |
| class | BSONField |
| class | BSONElement |
| BSONElement represents an "element" in a BSONObj. More... | |
| struct | BSONElementCmpWithoutField |
| class | BSONObjCmp |
| struct | GENOIDLabeler |
| struct | DateNowLabeler |
| struct | NullLabeler |
| struct | UndefinedLabeler |
| struct | MinKeyLabeler |
| struct | MaxKeyLabeler |
| class | Labeler |
| struct | BSONSymbol |
| struct | BSONCode |
| struct | BSONCodeWScope |
| struct | BSONRegEx |
| struct | BSONBinData |
| struct | BSONDBRef |
| class | BSONObjBuilderValueStream |
| class | BSONSizeTracker |
| used in conjuction with BSONObjBuilder, allows for proper buffer size to prevent crazy memory usage More... | |
| class | BSONObj |
| C++ representation of a "BSON" object – that is, an extended JSON-style object in a binary representation. More... | |
| struct | BSONArray |
| class | BSONObjBuilder |
| Utility for creating a BSONObj. More... | |
| class | BSONArrayBuilder |
| class | BSONObjIterator |
| iterator for a BSONObj More... | |
| class | BSONIteratorSorted |
| Base class implementing ordered iteration through BSONElements. More... | |
| class | BSONObjIteratorSorted |
| Provides iteration of a BSONObj's BSONElements in lexical field order. More... | |
| class | BSONArrayIteratorSorted |
| Provides iteration of a BSONArray's BSONElements in numeric field order. More... | |
| class | OID |
| Object ID type. More... | |
| class | Ordering |
| A precomputation of a BSON index or sort key pattern. More... | |
| struct | PackedDouble |
| class | StringBuilderImpl |
| stringstream deals with locale so this is a lot faster than std::stringstream for UTF8 More... | |
| class | TrivialAllocator |
| class | StackAllocator |
| class | _BufBuilder |
| class | StackBufBuilder |
| The StackBufBuilder builds smaller datasets on the stack instead of using malloc. More... | |
| struct | Date_t |
| class | AdminAccess |
| class | NoAdminAccess |
| class | AlignedBuilder |
| a page-aligned BufBuilder. More... | |
| class | FastArray |
| class | AssertionCount |
| struct | ExceptionInfo |
| class | ErrorMsg |
| helper class that builds error strings. More... | |
| class | DBException |
| Most mongo exceptions inherit from this; this is commonly caught in most threads. More... | |
| class | AssertionException |
| class | UserException |
| class | MsgAssertionException |
| class | BackgroundJob |
| Background thread dispatching. More... | |
| class | PeriodicTask |
| these run "roughly" every minute instantiate statically class MyTask : public PeriodicTask { public: virtual std::string name() const { return "MyTask; " } virtual void doWork() { log() << "hi" << endl; } } myTask; More... | |
| class | BufReader |
| helper to read and parse a block of memory methods throw the eof exception if the operation would pass the end of the buffer with which we are working. More... | |
| struct | Checksum |
| a simple, rather dumb, but very fast checksum. More... | |
| class | List1 |
| struct | mapsf |
| Thread safe map. More... | |
| class | StaticObserver |
| class | mutex |
| On pthread systems, it is an error to destroy a mutex while held (boost mutex may use pthread). More... | |
| class | SimpleMutex |
| The concept with SimpleMutex is that it is a basic lock/unlock with no special functionality (such as try and try timeout). More... | |
| class | RecursiveMutex |
| This can be used instead of boost recursive mutex. More... | |
| class | MutexDebugger |
| only used on _DEBUG builds. More... | |
| class | MVar |
| class | QLock |
| "Quad Lock" we want to be able to do semi-granular locking now, and read/write style locking for that. More... | |
| class | RWLock |
| class | rwlock_try_write |
| throws on failure to acquire in the specified time period. More... | |
| class | rwlock_shared |
| class | rwlock |
| class | RWLockRecursive |
| recursive on shared locks is ok for this implementation More... | |
| class | RWLockRecursiveNongreedy |
| class | RWLockBase |
| class | SimpleRWLock |
| separated out as later the implementation of this may be different than RWLock, depending on OS, as there is no upgrade etc. More... | |
| class | SpinLock |
| The spinlock currently requires late GCC support routines to be efficient. More... | |
| class | scoped_spinlock |
| class | Notification |
| class | NotifyAll |
| establishes a synchronization point between threads. More... | |
| class | ThreadLocalValue |
| struct | TSP |
| class | TicketHolder |
| class | ScopedTicket |
| class | TicketHolderReleaser |
| class | Guarded |
| declare that a variable that is "guarded" by a mutex. More... | |
| class | DiagStr |
| there is now one mutex per DiagStr. More... | |
| class | BasicEstimators |
| Collects count, minimum and maximum, calculates mean and standard deviation. More... | |
| class | DistributionEstimators |
| Computes 'NumQuantiles' quantiles. More... | |
| class | SummaryEstimators |
| Provides the funcionality of both BasicEstimators and DistributionEstimators. More... | |
| class | ElapsedTracker |
| Keep track of elapsed time. More... | |
| class | EmbeddedBuilder |
| class | FailPoint |
| A simple thread-safe fail point implementation that can be activated and deactivated, as well as embed temporary data into it. More... | |
| class | ScopedFailPoint |
| Helper class for making sure that FailPoint::shouldFailCloseBlock is called when FailPoint::shouldFailOpenBlock was called. More... | |
| class | FailPointRegistry |
| Class for storing FailPoint instances. More... | |
| class | File |
| class | FileAllocator |
| class | ThreadSafeString |
| this is a thread safe string you will never get a bad pointer, though data may be mungedd More... | |
| struct | ptr |
| A generic pointer type for function arguments. More... | |
| class | GsaslSession |
| C++ wrapper around Gsasl_session. More... | |
| class | HashTable |
| class | Histogram |
| A histogram for a 32-bit integer range. More... | |
| class | IntrusiveCounter |
| class | IntrusiveCounterUnsigned |
| class | RefCountable |
| This is an alternative base class to the above ones (will replace them eventually) More... | |
| class | RCString |
| This is an immutable reference-counted string. More... | |
| class | LabeledLevel |
| class | LazyString |
| class | LazyStringImpl |
| class | Tee |
| class | Nullstream |
| class | Logstream |
| struct | LogIndentLevel |
| class | LogFile |
| class | LRUishMap |
| class | MAdvise |
| class | LockMongoFilesShared |
| class | LockMongoFilesExclusive |
| class | MongoFile |
| class | MongoFileFinder |
| look up a MMF by filename. More... | |
| class | MemoryMappedFile |
| struct | MoveableBuffer |
| this is a sort of smart pointer class where we can move where something is and all the pointers will adjust. More... | |
| struct | HostAndPort |
| helper for manipulating host:port connection endpoints. More... | |
| class | HttpClient |
| class | Listener |
| class | ListeningSockets |
| struct | MSGHEADER |
| struct | MsgData |
| class | Message |
| class | AbstractMessagingPort |
| class | MessagingPort |
| class | MessageHandler |
| class | MessageServer |
| class | MiniWebServer |
| struct | SockAddr |
| wrapped around os representation of network address More... | |
| class | SocketException |
| thrown by Socket and SockAddr More... | |
| class | Socket |
| thin wrapped around file descriptor and system calls todo: ssl More... | |
| struct | ClockSkewException |
| class | OpTime |
| struct | PasswordValue |
| struct | RelativePath |
| this is very much like a boost::path. More... | |
| class | ProcessInfo |
| class | ProgressMeter |
| class | ProgressMeterHolder |
| class | BlockingQueue |
| Simple blocking queue with optional max size (by count or custom sizing function). More... | |
| class | RamLog |
| class | SafeNum |
| SafeNum holds and does arithmetic on a number in a safe way, handling overflow and casting for the user. More... | |
| class | RefToValue |
| Transports a reference as a value Serves to implement the Colvin/Gibbons trick for SmartPtr/ScopeGuard. More... | |
| class | ScopeGuardImplBase |
| ScopeGuard. More... | |
| class | ScopeGuardImpl0 |
| class | ScopeGuardImpl1 |
| class | ScopeGuardImpl2 |
| class | ScopeGuardImpl3 |
| class | ObjScopeGuardImpl0 |
| class | ObjScopeGuardImpl1 |
| class | ObjScopeGuardImpl2 |
| class | StartupTest |
| struct | StringMapDefaultHash |
| struct | StringMapDefaultEqual |
| struct | StringMapDefaultConvertor |
| struct | StringMapDefaultConvertorOther |
| class | StringMap |
| class | StringWriter |
| class | LexNumCmp |
| Functor for combining lexical and numeric comparisons. More... | |
| class | SystemInfo |
| class | StringSplitter |
| class | Backoff |
| class | Timer |
| Time tracking object. More... | |
| class | Trace |
| struct | UnorderedFastKeyTable_LS_C |
| class | UnorderedFastKeyTable |
Typedefs | |
|
typedef shared_ptr < ReplicaSetMonitor > | ReplicaSetMonitorPtr |
|
typedef pair< set< string > , set< int > > | NodeDiff |
| typedef unsigned long long | gridfs_offset |
|
typedef shared_ptr < ShardConnection > | ShardConnectionPtr |
|
typedef shared_ptr < DBClientCursor > | DBClientCursorPtr |
| typedef ParallelConnectionState | PCState |
| typedef shared_ptr< PCState > | PCStatePtr |
| typedef ParallelConnectionMetadata | PCMData |
| typedef shared_ptr< PCMData > | PCMDataPtr |
|
typedef std::map< std::string, BSONElement > | BSONMap |
|
typedef std::set< BSONElement, BSONElementFieldNameCmp > | BSONSortedElements |
|
typedef std::set< BSONObj, BSONObjCmp > | BSONObjSet |
|
typedef std::set< BSONElement, BSONElementCmpWithoutField > | BSONElementSet |
|
typedef std::multiset < BSONElement, BSONElementCmpWithoutField > | BSONElementMSet |
|
typedef _BufBuilder < TrivialAllocator > | BufBuilder |
|
typedef StringBuilderImpl < TrivialAllocator > | StringBuilder |
|
typedef StringBuilderImpl < StackAllocator > | StackStringBuilder |
| typedef mongo::mutex::scoped_lock | scoped_lock |
| typedef uint64_t | fileofs |
| typedef int | HANDLE |
| typedef unsigned char | md5digest [16] |
| typedef MemoryMappedFile | MMF |
| typedef AtomicUInt | MSGID |
| typedef int | SOCKET |
| typedef unsigned long long | ReplTime |
| typedef long long | NumberVal |
| Get a sysctl string value by name. More... | |
| typedef const ScopeGuardImplBase & | ScopeGuard |
| See Andrei's and Petru Marginean's CUJ article http://www.cuj.com/documents/s=8000/cujcexp1812alexandr/alexandr.htm. More... | |
Enumerations | |
| enum | ResultFlagType { ResultFlag_CursorNotFound = 1, ResultFlag_ErrSet = 2, ResultFlag_ShardConfigStale = 4, ResultFlag_AwaitCapable = 8 } |
| enum | QueryOptions { QueryOption_CursorTailable = 1 << 1, QueryOption_SlaveOk = 1 << 2, QueryOption_OplogReplay = 1 << 3, QueryOption_NoCursorTimeout = 1 << 4, QueryOption_AwaitData = 1 << 5, QueryOption_Exhaust = 1 << 6, QueryOption_PartialResults = 1 << 7, QueryOption_AllSupported = QueryOption_CursorTailable | QueryOption_SlaveOk | QueryOption_OplogReplay | QueryOption_NoCursorTimeout | QueryOption_AwaitData | QueryOption_Exhaust | QueryOption_PartialResults } |
| the query field 'options' can have these bits set: More... | |
| enum | UpdateOptions { UpdateOption_Upsert = 1 << 0, UpdateOption_Multi = 1 << 1, UpdateOption_Broadcast = 1 << 2 } |
| enum | RemoveOptions { RemoveOption_JustOne = 1 << 0, RemoveOption_Broadcast = 1 << 1 } |
| enum | InsertOptions { InsertOption_ContinueOnError = 1 << 0 } |
| need to put in DbMesssage::ReservedOptions as well More... | |
| enum | WriteOptions { WriteOption_FromWriteback = 1 << 31 } |
| Start from top of bits, these are generic write options that apply to all. More... | |
| enum | ReservedOptions { Reserved_InsertOption_ContinueOnError = 1 << 0, Reserved_FromWriteback = 1 << 1 } |
| enum | ReadPreference { ReadPreference_PrimaryOnly = 0, ReadPreference_PrimaryPreferred, ReadPreference_SecondaryOnly, ReadPreference_SecondaryPreferred, ReadPreference_Nearest } |
| enum | WriteConcern { W_NONE = 0, W_NORMAL = 1 } |
| controls how much a clients cares about writes default is NORMAL | |
| enum | FieldCompareResult { LEFT_SUBFIELD = -2, LEFT_BEFORE = -1, SAME = 0, RIGHT_BEFORE = 1, RIGHT_SUBFIELD = 2 } |
| enum | BSONType { MinKey =-1, EOO =0, NumberDouble =1, String =2, Object =3, Array =4, BinData =5, Undefined =6, jstOID =7, Bool =8, Date =9, jstNULL =10, RegEx =11, DBRef =12, Code =13, Symbol =14, CodeWScope =15, NumberInt = 16, Timestamp = 17, NumberLong = 18, JSTypeMax =18, MaxKey =127 } |
| the complete list of valid BSON types see also bsonspec.org More... | |
| enum | BinDataType { BinDataGeneral =0, Function =1, ByteArrayDeprecated =2, bdtUUID = 3, newUUID =4, MD5Type =5, bdtCustom =128 } |
| enum | JsonStringFormat { Strict, TenGen, JS } |
| Formatting mode for generating JSON from BSON. More... | |
| enum | CommonErrorCodes { OkCode = 0, DatabaseDifferCaseCode = 13297, SendStaleConfigCode = 13388, RecvStaleConfigCode = 9996, PrepareConfigsFailedCode = 13104 } |
| enum | { ASSERT_ID_DUPKEY = 11000 } |
| enum | { DEBUG_BUILD = 0 } |
| enum | ExitCode { EXIT_CLEAN = 0, EXIT_BADOPTIONS = 2, EXIT_REPLICATION_ERROR = 3, EXIT_NEED_UPGRADE = 4, EXIT_SHARDING_ERROR = 5, EXIT_KILL = 12, EXIT_ABRUPT = 14, EXIT_NTSERVICE_ERROR = 20, EXIT_JAVA = 21, EXIT_OOM_MALLOC = 42, EXIT_OOM_REALLOC = 43, EXIT_FS = 45, EXIT_CLOCK_SKEW = 47, EXIT_NET_ERROR = 48, EXIT_WINDOWS_SERVICE_STOP = 49, EXIT_POSSIBLE_CORRUPTION = 60, EXIT_UNCAUGHT = 100, EXIT_TEST = 101 } |
| enum | LogLevel { LL_DEBUG =-1000, LL_INFO, LL_NOTICE, LL_WARNING, LL_ERROR, LL_SEVERE } |
| enum | Operations { opReply = 1, dbMsg = 1000, dbUpdate = 2001, dbInsert = 2002, dbQuery = 2004, dbGetMore = 2005, dbDelete = 2006, dbKillCursors = 2007 } |
Functions | |
| void | dbexit (ExitCode returnCode, const char *whyMsg) |
| bool | inShutdown () |
| string | getDbContext () |
| bool | haveLocalShardingInfo (const string &ns) |
| DBClientBase * | createDirectClient () |
| void | assembleRequest (const string &ns, BSONObj query, int nToReturn, int nToSkip, const BSONObj *fieldsToReturn, int queryOptions, Message &toSend) |
| BSONElement | getErrField (const BSONObj &o) |
| bool | hasErrField (const BSONObj &o) |
| bool | serverAlive (const string &uri) |
| pings server to check if it's up | |
| string | nsGetDB (const string &ns) |
| string | nsGetCollection (const string &ns) |
| bool | _isQueryOkToSecondary (const string &ns, int queryOptionFlags, const BSONObj &queryObj) |
| HostAndPort | _selectNode (const vector< ReplicaSetMonitor::Node > &nodes, const BSONObj &readPreferenceTag, bool secOnly, int localThresholdMillis, HostAndPort *lastHost, bool *isPrimarySelected) |
| Selects the right node given the nodes to pick from and the preference. More... | |
| ReadPreferenceSetting * | _extractReadPref (const BSONObj &query) |
| Extracts the read preference settings from the query document. More... | |
| shared_ptr< DBClientConnection > | _getConnWithRefresh (ReplicaSetMonitor::Node &node) |
| string | seedString (const vector< HostAndPort > &servers) |
| std::ostream & | operator<< (std::ostream &s, const Query &q) |
| string | getDistLockProcess () |
| string | getDistLockId () |
| bool | isLockPingerEnabled () |
| void | setLockPingerEnabled (bool enabled) |
| MONGO_INITIALIZER() | RegisterDistLockWithSyncCmd (InitializerContext *context) |
| MONGO_INITIALIZER() | RegisterDistLockWithSkewCmd (InitializerContext *context) |
| MONGO_INITIALIZER() | RegisterSkewClockCmd (InitializerContext *context) |
| void | printStackTrace (class std::basic_ostream< char, struct std::char_traits< char > > &) |
| void | mongo_breakpoint () |
| void | printStackAndExit (int signalNum) |
| Obtains the log file handler and writes the current thread's stack trace to it. More... | |
| Status | saslExtractPayload (const BSONObj &cmdObj, std::string *payload, BSONType *type) |
| Extracts the payload field from "cmdObj", and store it into "*payload". More... | |
| BSONObj | fromjson (const std::string &str) |
| Create a BSONObj from a JSON http://www.json.org, http://www.ietf.org/rfc/rfc4627.txt string. More... | |
| BSONObj | fromjson (const char *str, int *len=NULL) |
| int | compareElementValues (const BSONElement &l, const BSONElement &r) |
| void | nested2dotted (BSONObjBuilder &b, const BSONObj &obj, const std::string &base="") |
| BSONObj | nested2dotted (const BSONObj &obj) |
| void | dotted2nested (BSONObjBuilder &b, const BSONObj &obj) |
| BSONObj | dotted2nested (const BSONObj &obj) |
| BSONMap | bson2map (const BSONObj &obj) |
| BSONSortedElements | bson2set (const BSONObj &obj) |
| std::ostream & | operator<< (std::ostream &s, const BSONObj &o) |
| std::ostream & | operator<< (std::ostream &s, const BSONElement &e) |
| StringBuilder & | operator<< (StringBuilder &s, const BSONObj &o) |
| StringBuilder & | operator<< (StringBuilder &s, const BSONElement &e) |
| std::string | escape (const std::string &s, bool escape_slash=false) |
| template<> | |
| bool | BSONElement::coerce< std::string > (std::string *out) const |
| template<> | |
| bool | BSONElement::coerce< std::vector< std::string > > (std::vector< std::string > *out) const |
| void | verify (bool expr) |
| MONGO_COMPILER_NORETURN void | uasserted (int msgid, const std::string &s) |
| void | uassert (unsigned msgid, const std::string &msg, bool expr) |
| MONGO_COMPILER_NORETURN void | msgasserted (int msgid, const char *msg) |
| MONGO_COMPILER_NORETURN void | msgasserted (int msgid, const std::string &msg) |
| void | massert (int msgid, const std::string &msg, bool expr) |
| Status | validateBSON (const char *buf, uint64_t maxLength) |
| int | getGtLtOp (const BSONElement &e) |
| FieldCompareResult | compareDottedFieldNames (const std::string &l, const std::string &r, const LexNumCmp &cmp) |
| BSONObj | OR (const BSONObj &a, const BSONObj &b) |
| BSONObj | OR (const BSONObj &a, const BSONObj &b, const BSONObj &c) |
| BSONObj | OR (const BSONObj &a, const BSONObj &b, const BSONObj &c, const BSONObj &d) |
| BSONObj | OR (const BSONObj &a, const BSONObj &b, const BSONObj &c, const BSONObj &d, const BSONObj &e) |
| BSONObj | OR (const BSONObj &a, const BSONObj &b, const BSONObj &c, const BSONObj &d, const BSONObj &e, const BSONObj &f) |
| bool | fieldsMatch (const BSONObj &lhs, const BSONObj &rhs) |
| template<class L > | |
| BSONObjBuilder & | _appendIt (BSONObjBuilder &_this, const StringData &fieldName, const L &vals) |
| template<class L > | |
| BSONArrayBuilder & | _appendArrayIt (BSONArrayBuilder &_this, const L &vals) |
| const char * | typeName (BSONType type) |
| returns the name of the argument's type defined in jsobj.cpp | |
| int | canonicalizeBSONType (BSONType type) |
| Returns a number for where a given type falls in the sort order. More... | |
| void | prefetch (void *p) |
| ostream & | operator<< (ostream &s, const OID &o) |
| std::ostream & | operator<< (std::ostream &s, const OID &o) |
| StringBuilder & | operator<< (StringBuilder &s, const OID &o) |
| struct | MONGO_COMPILER_ALIGN_TYPE (4) AtomicUInt |
| An unsigned integer supporting atomic read-modify-write operations. More... | |
| Status | bsonExtractField (const BSONObj &object, const StringData &fieldName, BSONElement *outElement) |
| Finds an element named "fieldName" in "object". More... | |
| Status | bsonExtractTypedField (const BSONObj &object, const StringData &fieldName, BSONType type, BSONElement *outElement) |
| Finds an element named "fieldName" in "object". More... | |
| Status | bsonExtractBooleanFieldWithDefault (const BSONObj &object, const StringData &fieldName, bool defaultValue, bool *out) |
| Finds a bool-like element named "fieldName" in "object". More... | |
| Status | bsonExtractStringField (const BSONObj &object, const StringData &fieldName, std::string *out) |
| Finds a string-typed element named "fieldName" in "object" and stores its value in "out". More... | |
| Status | bsonExtractStringFieldWithDefault (const BSONObj &object, const StringData &fieldName, const StringData &defaultValue, std::string *out) |
| Finds a string element named "fieldName" in "object". More... | |
| TEST (Builder, String1) | |
| void | time_t_to_String (time_t t, char *buf) |
| std::string | time_t_to_String (time_t t=time(0)) |
| std::string | time_t_to_String_no_year (time_t t) |
| std::string | time_t_to_String_short (time_t t) |
| int | strnlen (const char *s, int n) |
| BOOST_STATIC_ASSERT (sizeof(void *)==sizeof(size_t)) | |
| void * | ourmalloc (size_t size) |
| void * | ourrealloc (void *ptr, size_t size) |
| NOINLINE_DECL void | wasserted (const char *msg, const char *file, unsigned line) |
| NOINLINE_DECL void | verifyFailed (const char *msg, const char *file, unsigned line) |
| NOINLINE_DECL void | fassertFailed (int msgid) |
| void | uasserted (int msgid, const string &msg) |
| NOINLINE_DECL void | uasserted (int msgid, const char *msg) |
| a "user assertion". More... | |
| void | msgasserted (int msgid, const string &msg) |
| NOINLINE_DECL void | msgassertedNoTrace (int msgid, const char *msg) |
| msgassert and massert are for errors that are internal but have a well defined error text std::string. More... | |
| NOINLINE_DECL void | streamNotGood (int code, const std::string &msg, std::ios &myios) |
| string | errnoWithPrefix (const char *prefix) |
| output the error # and error message with prefix. More... | |
| string | demangleName (const type_info &typeinfo) |
| std::string | causedBy (const DBException &e) |
| std::string | causedBy (const std::string &e) |
| MONGO_COMPILER_NORETURN void | msgassertedNoTrace (int msgid, const std::string &msg) |
| std::string | causedBy (const char *e) |
| std::string | causedBy (const std::exception &e) |
| std::string | causedBy (const std::string *e) |
| std::string | causedBy (const Status &e) |
| void | fassert (int msgid, bool testOK) |
| aborts on condition failure | |
| bool | debugCompare (bool inDebug, bool condition) |
| Allows to jump code during exeuction. More... | |
| void | assertStreamGood (unsigned msgid, const std::string &msg, std::ios &myios) |
| std::string | demangleName (const std::type_info &typeinfo) |
| template<typename T > | |
| void | bsonArrToNumVector (BSONElement el, vector< T > &results) |
| void | rawCompress (const char *input, size_t input_length, char *compressed, size_t *compressed_length) |
| size_t | maxCompressedLength (size_t source_len) |
| size_t | compress (const char *input, size_t input_length, std::string *output) |
| bool | uncompress (const char *compressed, size_t compressed_length, std::string *uncompressed) |
| boost::xtime | incxtimemillis (long long s) |
| void | setupSIGTRAPforGDB () |
| void | breakpoint () |
| void | setWindowsUnhandledExceptionFilter () |
| MONGO_FP_DECLARE (dummy) | |
| scoped_ptr< FailPointRegistry > | _fpRegistry (NULL) |
| MONGO_INITIALIZER() | FailPointRegistry (InitializerContext *context) |
| MONGO_INITIALIZER_GENERAL (AllFailPointsRegistered,(),())(InitializerContext *context) | |
| FailPointRegistry * | getGlobalFailPointRegistry () |
| boost::filesystem::path | ensureParentDirCreated (const boost::filesystem::path &p) |
| Aliases for Win32 CRT functions. | |
| string | hexdump (const char *data, unsigned len) |
| void | setThreadName (const char *name) |
| string | getThreadName () |
| template<class T > | |
| string | ToString (const T &t) |
| bool | isPrime (int n) |
| int | nextPrime (int n) |
| void | dumpmemory (const char *data, int len) |
| bool | startsWith (const char *str, const char *prefix) |
| bool | startsWith (const std::string &s, const std::string &p) |
| bool | endsWith (const char *p, const char *suffix) |
| unsigned long | swapEndian (unsigned long x) |
| void | strcpy_s (char *dst, unsigned len, const char *src) |
| ostream & | operator<< (ostream &s, const ThreadSafeString &o) |
| int | fromHex (char c) |
| char | fromHex (const char *c) |
| char | fromHex (const StringData &c) |
| std::string | toHex (const void *inRaw, int len) |
| std::string | toHexLower (const void *inRaw, int len) |
| const char * | default_getcurns () |
| TSP_DECLARE (Logstream, Logstream_tsp) | |
| TSP_DEFINE (Logstream, Logstream_tsp) | |
| Nullstream & | tlog (int level=0) |
| logging which we may not want during unit tests (dbtests) runs. More... | |
| bool | initLogging (const string &logpath, bool append) |
| log to a file rather than stdout defined in assert_util.cpp | |
| bool | rotateLogs () |
| string | errnoWithDescription (int x) |
| void | rawOut (const string &s) |
| void | logContext (const char *msg=NULL) |
| Write the current context (backtrace), along with the optional "msg". | |
| const char * | logLevelToString (LogLevel l) |
| const int | logLevelToSysLogLevel (LogLevel l) |
| bool | operator< (const LabeledLevel &ll, const int i) |
| bool | operator< (const int i, const LabeledLevel &ll) |
| bool | operator> (const LabeledLevel &ll, const int i) |
| bool | operator> (const int i, const LabeledLevel &ll) |
| bool | operator<= (const LabeledLevel &ll, const int i) |
| bool | operator<= (const int i, const LabeledLevel &ll) |
| bool | operator>= (const LabeledLevel &ll, const int i) |
| bool | operator>= (const int i, const LabeledLevel &ll) |
| bool | operator== (const LabeledLevel &ll, const int i) |
| bool | operator== (const int i, const LabeledLevel &ll) |
| Nullstream & | out (int level=0) |
| void | logflush (int level=0) |
| Nullstream & | _log (int level=0) |
| Nullstream & | dlog (int level) |
| Nullstream & | log () |
| Nullstream & | logWithLevel (int level) |
| Nullstream & | logWithLevel (LogLevel l) |
| Nullstream & | logWithLevel (const LabeledLevel &ll) |
| Nullstream & | error () |
| Nullstream & | warning () |
| Nullstream & | problem (int level=0) |
| std::string | toUtf8String (const std::wstring &wide) |
| template<typename M , typename K , typename V > | |
| V | mapFindWithDefault (const M &myMap, const K &key, const V &defaultValue) |
| void | md5 (const void *buf, int nbytes, md5digest digest) |
| void | md5 (const char *str, md5digest digest) |
| std::string | digestToString (md5digest digest) |
| std::string | md5simpledigest (const void *buf, int nbytes) |
| std::string | md5simpledigest (const std::string &s) |
| TEST (MD5, BuiltIn1) | |
| void | minOSPageSizeBytesTest (size_t minOSPageSizeBytes) |
| void | nullFunc () |
| void | printMemInfo (const char *where) |
| __declspec (noinline) void makeChunkWritable(size_t chunkno) | |
| vector< SockAddr > | ipToAddrs (const char *ips, int port, bool useUnixSockets) |
| int | getMaxConnections () |
| MSGID | nextMessageId () |
| bool | doesOpGetAResponse (int op) |
| const char * | opToString (int op) |
| bool | opIsWrite (int op) |
| MessageServer * | createServer (const MessageServer::Options &opts, MessageHandler *handler) |
| MONGO_FP_DECLARE (throwSockExcep) | |
| void | enableIPv6 (bool state) |
| bool | IPv6Enabled () |
| void | setSockTimeouts (int sock, double secs) |
| void | disableNagle (int sock) |
| string | getAddrInfoStrError (int code) |
| string | makeUnixSockPath (int port) |
| string | hostbyname (const char *hostname) |
| string | getHostName () |
| this is not cache and does a syscall | |
| string | getHostNameCached () |
| we store our host name once More... | |
| string | prettyHostName () |
| void | closesocket (int s) |
| void | exitCleanly (ExitCode ignored) |
| string | askPassword () |
| dev_t | getPartition (const string &path) |
| bool | onSamePartition (const string &path1, const string &path2) |
| void | flushMyDirectory (const boost::filesystem::path &file) |
| void | writePidFile (const string &path) |
| MONGO_INITIALIZER() | SystemInfo (InitializerContext *context) |
| void | writePidFile (const std::string &path) |
| template<typename Variant > | |
| Variant | getSysctlByName (const char *sysctlName) |
| template<> | |
| long long | getSysctlByName< NumberVal > (const char *sysctlName) |
| Get a sysctl integer value by name (specialization) | |
| template<typename T > | |
| int | getSysctlByNameWithDefault (const char *sysctlName, const T &defaultValue, T *result) |
| Get a sysctl string value by name. More... | |
| template<> | |
| int | getSysctlByNameWithDefault< uintptr_t > (const char *sysctlName, const uintptr_t &defaultValue, uintptr_t *result) |
| template<> | |
| int | getSysctlByNameWithDefault< string > (const char *sysctlName, const string &defaultValue, string *result) |
| int | _wconvertmtos (SIZE_T s) |
| template<typename T > | |
| size_t | _getSizeDefault (const T &t) |
| std::ostream & | operator<< (std::ostream &os, const SafeNum &snum) |
| SafeNum | addInt32Int32 (int lInt32, int rInt32) |
| SafeNum | addInt64Int64 (long long lInt64, long long rInt64) |
| SafeNum | addFloats (double lDouble, double rDouble) |
| template<class T > | |
| RefToValue< T > | ByRef (T &t) |
| RefToValue creator. | |
| template<typename F > | |
| ScopeGuardImpl0< F > | MakeGuard (F fun) |
| template<typename F , typename P1 > | |
| ScopeGuardImpl1< F, P1 > | MakeGuard (F fun, P1 p1) |
| template<typename F , typename P1 , typename P2 > | |
| ScopeGuardImpl2< F, P1, P2 > | MakeGuard (F fun, P1 p1, P2 p2) |
| template<typename F , typename P1 , typename P2 , typename P3 > | |
| ScopeGuardImpl3< F, P1, P2, P3 > | MakeGuard (F fun, P1 p1, P2 p2, P3 p3) |
| template<class Obj , typename MemFun > | |
| ObjScopeGuardImpl0< Obj, MemFun > | MakeObjGuard (Obj &obj, MemFun memFun) |
| template<typename Ret , class Obj1 , class Obj2 > | |
| ObjScopeGuardImpl0< Obj1, Ret(Obj2::*)()> | MakeGuard (Ret(Obj2::*memFun)(), Obj1 &obj) |
| template<typename Ret , class Obj1 , class Obj2 > | |
| ObjScopeGuardImpl0< Obj1, Ret(Obj2::*)()> | MakeGuard (Ret(Obj2::*memFun)(), Obj1 *obj) |
| template<class Obj , typename MemFun , typename P1 > | |
| ObjScopeGuardImpl1< Obj, MemFun, P1 > | MakeObjGuard (Obj &obj, MemFun memFun, P1 p1) |
| template<typename Ret , class Obj1 , class Obj2 , typename P1a , typename P1b > | |
| ObjScopeGuardImpl1< Obj1, Ret(Obj2::*)(P1a), P1b > | MakeGuard (Ret(Obj2::*memFun)(P1a), Obj1 &obj, P1b p1) |
| template<typename Ret , class Obj1 , class Obj2 , typename P1a , typename P1b > | |
| ObjScopeGuardImpl1< Obj1, Ret(Obj2::*)(P1a), P1b > | MakeGuard (Ret(Obj2::*memFun)(P1a), Obj1 *obj, P1b p1) |
| template<class Obj , typename MemFun , typename P1 , typename P2 > | |
| ObjScopeGuardImpl2< Obj, MemFun, P1, P2 > | MakeObjGuard (Obj &obj, MemFun memFun, P1 p1, P2 p2) |
| template<typename Ret , class Obj1 , class Obj2 , typename P1a , typename P1b , typename P2a , typename P2b > | |
| ObjScopeGuardImpl2< Obj1, Ret(Obj2::*)(P1a, P2a), P1b, P2b > | MakeGuard (Ret(Obj2::*memFun)(P1a, P2a), Obj1 &obj, P1b p1, P2b p2) |
| template<typename Ret , class Obj1 , class Obj2 , typename P1a , typename P1b , typename P2a , typename P2b > | |
| ObjScopeGuardImpl2< Obj1, Ret(Obj2::*)(P1a, P2a), P1b, P2b > | MakeGuard (Ret(Obj2::*memFun)(P1a, P2a), Obj1 *obj, P1b p1, P2b p2) |
| bool | inConstructorChain (bool printOffending=false) |
| checks up call tree if any method on top of me is a constructor, return true may do internal caching probably slow, use with care if not implemented for a platform, returns false | |
| bool | inConstructorChainSupported () |
| void | printStackTrace (std::ostream &os) |
| void | splitStringDelim (const string &str, vector< string > *res, char delim) |
| void | joinStringDelim (const vector< string > &strs, string *res, char delim) |
| int | versionCmp (const StringData rhs, const StringData lhs) |
| void | splitStringDelim (const std::string &str, std::vector< std::string > *res, char delim) |
| void | joinStringDelim (const std::vector< std::string > &strs, std::string *res, char delim) |
| std::string | tolowerString (StringData input) |
| TEST (Comparison, Basic) | |
| TEST (LexNumCmp, Simple1) | |
| void | assertCmp (int expected, const StringData &s1, const StringData &s2, bool lexOnly=false) |
| TEST (LexNumCmp, Simple2) | |
| TEST (LexNumCmp, LexOnly) | |
| TEST (LexNumCmp, Substring1) | |
| int | leadingOnes (unsigned char c) |
| bool | isValidUTF8 (const std::string &s) |
| bool | isValidUTF8 (const char *s) |
| long long | parseLL (const char *n) |
| std::string | constructUtf8WindowsCommandLine (const std::vector< std::string > &argv) |
| Construct a Windows command line string, UTF-8 encoded, from a vector of UTF-8 arguments, "argv". More... | |
| void | time_t_to_Struct (time_t t, struct tm *buf, bool local) |
| void | curTimeString (char *timeStr) |
| Gets the current time string (in fixed width) in UTC. More... | |
| string | terseCurrentTime (bool colonsOk) |
| string | timeToISOString (time_t time) |
| boost::gregorian::date | currentDate () |
| bool | toPointInTime (const string &str, boost::posix_time::ptime *timeOfDay) |
| void | sleepsecs (int s) |
| void | sleepmicros (long long s) |
| void | sleepmillis (long long s) |
| void | jsTimeVirtualSkew (long long skew) |
| long long | getJSTimeVirtualSkew () |
| void | jsTimeVirtualThreadSkew (long long skew) |
| long long | getJSTimeVirtualThreadSkew () |
| Date_t | jsTime () |
| Date_t is milliseconds since epoch. | |
| unsigned | curTimeMicros () |
| warning this will wrap | |
| unsigned long long | curTimeMicros64 () |
| unsigned long long | curTimeMillis64 () |
| bool | toPointInTime (const std::string &str, boost::posix_time::ptime *timeOfDay) |
| char * | asctime (const struct tm *tm) |
| char * | ctime (const time_t *timep) |
| struct tm * | gmtime (const time_t *timep) |
| struct tm * | localtime (const time_t *timep) |
| void | touchNs (const std::string &ns) |
| void | touch_pages (HANDLE fd, int offset, size_t length, const Extent *ext) |
| BSONArray | toVersionArray (const char *version) |
| bool | isSameMajorVersion (const char *version) |
| string | mongodVersion () |
| const char * | gitVersion () |
| const char * | compiledJSEngine () |
| const char * | allocator () |
| const char * | loaderFlags () |
| const char * | compilerFlags () |
| void | printGitVersion () |
| string | sysInfo () |
| void | printSysInfo () |
| void | printAllocator () |
| void | appendBuildInfo (BSONObjBuilder &result) |
| void | show_warnings () |
Variables | |
| CmdLine | cmdLine |
| const char * | curNs = "in client mode" |
| bool | dbexitCalled = false |
| DBConnectionPool | pool |
| const BSONObj | getpreverrorcmdobj = fromjson("{getpreverror:1}") |
| BSONObj | getnoncecmdobj = fromjson("{getnonce:1}") |
| BSONObj | ismastercmdobj = fromjson("{\"ismaster\":1}") |
| BSONObj | getprofilingcmdobj = fromjson("{\"profile\":-1}") |
| set< string > | _secOkCmdList |
|
class mongo::PopulateReadPrefSecOkCmdList | _populateReadPrefSecOkCmdList |
| mongo::ReplicaSetMonitorWatcher | replicaSetMonitorWatcher |
| ThreadLocalValue< string > | distLockIds ("") |
| class mongo::DistributedLockPinger | distLockPinger |
| const unsigned | DEFAULT_CHUNK_SIZE = 256 * 1024 |
| LabeledLevel | pc ("pcursor", 2) |
| Status(* | saslClientAuthenticate )(DBClientWithCommands *client, const BSONObj &saslParameters, void *sessionHook) = NULL |
| Attempts to authenticate "client" using the SASL protocol. More... | |
| const char *const | saslStartCommandName = "saslStart" |
| String name of the saslStart command. | |
| const char *const | saslContinueCommandName = "saslContinue" |
| String name of the saslContinue command. | |
| const char *const | saslCommandAutoAuthorizeFieldName = "autoAuthorize" |
| Name of the saslStart parameter indicating that the server should automatically grant the connection all privileges associated with the principal after successful authentication. More... | |
| const char *const | saslCommandCodeFieldName = "code" |
| Name of the field contain the status code in responses from the server. | |
| const char *const | saslCommandConversationIdFieldName = "conversationId" |
| Name of the field containing the conversation identifier in server respones and saslContinue commands. More... | |
| const char *const | saslCommandDoneFieldName = "done" |
| Name of the field that indicates whether or not the server believes authentication has completed successfully. More... | |
| const char *const | saslCommandErrmsgFieldName = "errmsg" |
| Field in which to store error messages associated with non-success return codes. | |
| const char *const | saslCommandMechanismFieldName = "mechanism" |
| Name of parameter to saslStart command indiciating the client's desired sasl mechanism. | |
| const char *const | saslCommandMechanismListFieldName = "supportedMechanisms" |
| In the event that saslStart supplies an unsupported mechanism, the server responds with a field by this name, with a list of supported mechanisms. More... | |
| const char *const | saslCommandPasswordFieldName = "pwd" |
| Field containing password information for saslClientAuthenticate(). | |
| const char *const | saslCommandPayloadFieldName = "payload" |
| Field containing sasl payloads passed to and from the server. | |
| const char *const | saslCommandPrincipalFieldName = "user" |
| Field containing the string identifier of the principal to authenticate in saslClientAuthenticate(). More... | |
| const char *const | saslCommandPrincipalSourceFieldName = "userSource" |
| Field containing the string identifier of the database containing credential information, or "$external" if the credential information is stored outside of the mongo cluster. More... | |
| const char *const | saslCommandServiceHostnameFieldName = "serviceHostname" |
| Field overriding the FQDN of the hostname hosting the mongodb srevice in saslClientAuthenticate(). More... | |
| const char *const | saslCommandServiceNameFieldName = "serviceName" |
| Field overriding the name of the mongodb service saslClientAuthenticate(). | |
| const char *const | saslCommandDigestPasswordFieldName = "digestPassword" |
| const char *const | saslDefaultDBName = "$external" |
| Default database against which sasl authentication commands should run. | |
| const char *const | saslDefaultServiceName = "mongodb" |
| Default sasl service name, "mongodb". | |
| struct mongo::GENOIDLabeler | GENOID |
| struct mongo::DateNowLabeler | DATENOW |
| struct mongo::NullLabeler | BSONNULL |
| struct mongo::UndefinedLabeler | BSONUndefined |
| struct mongo::MinKeyLabeler | MINKEY |
| struct mongo::MaxKeyLabeler | MAXKEY |
| Labeler::Label | GT |
| Labeler::Label | GTE |
| Labeler::Label | LT |
| Labeler::Label | LTE |
| Labeler::Label | NE |
| Labeler::Label | NIN |
| Labeler::Label | BSIZE |
| BSONObj | maxKey |
| BSONObj | minKey |
| struct mongo::PackedDouble | PACKED_DECL |
| const int | BSONObjMaxUserSize = 16 * 1024 * 1024 |
| const int | BSONObjMaxInternalSize = BSONObjMaxUserSize + ( 16 * 1024 ) |
| const int | BufferMaxSize = 64 * 1024 * 1024 |
| AssertionCount | assertionCount |
| MutexDebugger & | mutexDebugger |
| const bool | debug =false |
| int | tlogLevel = 0 |
| int | logLevel = 0 |
| const char *(* | getcurns )()=default_getcurns |
| Nullstream | nullstream |
| class mongo::LoggingManager | loggingManager |
| Tee *const | warnings = new RamLog("warnings") |
| Tee *const | startupWarningsLog = new RamLog("startupWarnings") |
| mongo::LogfileTest | __test |
| const size_t | g_minOSPageSizeBytes = fetchMinOSPageSizeBytes() |
| mutex | mapViewMutex ("mapView") |
| ourbitset | writable |
| unsigned long long | mapped = 0 |
| SimpleMutex | globalFlushMutex ("globalFlushMutex") |
| const int | DEFAULT_MAX_CONN = 20000 |
| const int | MAX_MAX_CONN = 20000 |
| MSGID | NextMsgId |
| const int | MaxMessageSizeBytes = 48 * 1000 * 1000 |
| Maximum accepted message size on the wire protocol. | |
| const int | MsgDataHeaderSize = sizeof(MsgData) - 4 |
| Ports & | ports = *(new Ports()) |
| SockAddr | unknownAddress ("0.0.0.0", 0) |
| DiagStr & | _hostNameCached = *(new DiagStr) |
| const int | portSendFlags = 0 |
| const int | portRecvFlags = 0 |
| const int | SOCK_FAMILY_UNKNOWN_ERROR =13078 |
| const int | INVALID_SOCKET = -1 |
| string | dbpath |
| class mongo::PidFileWiper | pidFileWiper |
| struct mongo::PsApiInit | psapiGlobal |
| mongo::TextUnitTest | textUnitTest |
| long long | jsTime_virtual_skew = 0 |
|
boost::thread_specific_ptr < long long > | jsTime_virtual_thread_skew |
| char | _touch_pages_char_reader |
|
boost::thread_specific_ptr < string > | _threadName |
| mongo::UtilTest | utilTest |
| const char | versionString [] = "2.4.4-pre-" |
| const BSONArray | versionArray = toVersionArray(versionString) |
| mongo::VersionArrayTest | versionArrayTest |
Copyright (C) 2013 10gen Inc.
Copyright (c) 2012 10gen Inc.
Copyright 2011 (c) 10gen Inc.
Tools for working with in-process stack traces.
posix
Copyright (c) 2011 10gen Inc.
Copyright 2009 10gen Inc.
Should NOT be included by other header files.
These classes provide online descriptive statistics estimator capable of computing the mean, standard deviation and quantiles.
Copyright (C) 2011 10gen Inc.
Copyright (C) 2012 10gen Inc.
Copyright (C) 2009 10gen Inc.
Copyright (C) 2010 10gen Inc.
Copyright (C) 2008 10gen Inc.
tools for working in parallel/sharded/clustered environment
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/. This file contains tests for DBClientReplicaSet. The tests mocks the servers the DBClientReplicaSet talks to, so the tests only covers the client side logic.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,b but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Exactness is traded for the ability to obtain reasonable estimates without the need to store all the samples or perform multiple passes over the data.
NOTEs on the estimator accessors provide information about accuracy of the approximation.
The implementation of the estimators is heavily inspired by the algorithms used in boost.accumulators (www.boost.org/libs/accumulators/). It differs by being tailored for typical descriptive statistics use cases thus providing a simpler (even though less flexible) interface.
Include only in source files.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
| typedef long long mongo::NumberVal |
Get a sysctl string value by name.
Use string specialization by default.
| typedef const ScopeGuardImplBase & mongo::ScopeGuard |
See Andrei's and Petru Marginean's CUJ article http://www.cuj.com/documents/s=8000/cujcexp1812alexandr/alexandr.htm.
Changes to the original code by Joshua Lehrer: http://www.lehrerfamily.com/scopeguard.html
| enum mongo::BSONType |
the complete list of valid BSON types see also bsonspec.org
| Enumerator | |
|---|---|
| MinKey |
smaller than all other types |
| EOO |
end of object |
| NumberDouble |
double precision floating point value |
| String |
character string, stored in utf8 |
| Object |
an embedded object |
| Array |
an embedded array |
| BinData |
binary data |
| Undefined |
Undefined type. |
| jstOID |
ObjectId. |
| Bool |
boolean type |
| Date |
date type |
| jstNULL |
null type |
| RegEx |
regular expression, a pattern with options |
| DBRef |
deprecated / will be redesigned |
| Code |
deprecated / use CodeWScope |
| Symbol |
a programming language (e.g., Python) symbol |
| CodeWScope |
javascript code that can execute on the database server, with SavedContext |
| NumberInt |
32 bit signed integer |
| Timestamp |
Updated to a Date with value next OpTime on insert. |
| NumberLong |
64 bit integer |
| JSTypeMax |
max type that is not MaxKey |
| MaxKey |
larger than all other types |
| enum mongo::InsertOptions |
Formatting mode for generating JSON from BSON.
See http://dochub.mongodb.org/core/mongodbextendedjson for details.
| enum mongo::QueryOptions |
the query field 'options' can have these bits set:
| enum mongo::RemoveOptions |
| enum mongo::UpdateOptions |
| enum mongo::WriteOptions |
| ReadPreferenceSetting* mongo::_extractReadPref | ( | const BSONObj & | query | ) |
Extracts the read preference settings from the query document.
Note that this method assumes that the query is ok for secondaries so it defaults to ReadPreference_SecondaryPreferred when nothing is specified. Supports the following format:
Format A (official format): { query: <actual query>="">, $readPreference: <read pref="" obj>=""> }
Format B (unofficial internal format from mongos): { <actual query>="">,
readPreference: <read pref="" obj>=""> }}
| query | the raw query document |
| AssertionException | if the read preference object is malformed |
| shared_ptr<DBClientConnection> mongo::_getConnWithRefresh | ( | ReplicaSetMonitor::Node & | node | ) |
| bool mongo::_isQueryOkToSecondary | ( | const string & | ns, |
| int | queryOptionFlags, | ||
| const BSONObj & | queryObj | ||
| ) |
| ns | the namespace of the query. |
| queryOptionFlags | the flags for the query. |
| queryObj | the query object to check. |
| HostAndPort mongo::_selectNode | ( | const vector< ReplicaSetMonitor::Node > & | nodes, |
| const BSONObj & | readPreferenceTag, | ||
| bool | secOnly, | ||
| int | localThresholdMillis, | ||
| HostAndPort * | lastHost, | ||
| bool * | isPrimarySelected | ||
| ) |
Selects the right node given the nodes to pick from and the preference.
This method does strict tag matching, and will not implicitly fallback to matching anything.
| nodes | the nodes to select from |
| readPreferenceTag | the tags to use for choosing the right node |
| secOnly | never select a primary if true |
| localThresholdMillis | the exclusive upper bound of ping time to be considered as a local node. Local nodes are favored over non-local nodes if multiple nodes matches the other criteria. |
| lastHost | the last host returned (mainly used for doing round-robin). Will be overwritten with the newly returned host if not empty. Should never be NULL. |
| isPrimarySelected | out parameter that is set to true if the returned host is a primary. |
| Status mongo::bsonExtractBooleanFieldWithDefault | ( | const BSONObj & | object, |
| const StringData & | fieldName, | ||
| bool | defaultValue, | ||
| bool * | out | ||
| ) |
Finds a bool-like element named "fieldName" in "object".
If a field named "fieldName" is present, and is either a number or boolean type, stores the truth value of the field into "*out". If no field named "fieldName" is present, sets "*out" to "defaultValue". In these cases, returns Status::OK().
If "fieldName" is present more than once, behavior is undefined. If the found field is not a boolean or number, returns ErrorCodes::TypeMismatch.
| Status mongo::bsonExtractField | ( | const BSONObj & | object, |
| const StringData & | fieldName, | ||
| BSONElement * | outElement | ||
| ) |
Finds an element named "fieldName" in "object".
Returns Status::OK() and sets "*outElement" to the found element on success. Returns ErrorCodes::NoSuchKey if there are no matches.
| Status mongo::bsonExtractStringField | ( | const BSONObj & | object, |
| const StringData & | fieldName, | ||
| std::string * | out | ||
| ) |
Finds a string-typed element named "fieldName" in "object" and stores its value in "out".
Returns Status::OK() and sets *out to the found element's string value on success. Returns ErrorCodes::NoSuchKey if there are no matches for "fieldName", and ErrorCodes::TypeMismatch if the type of the matching element is not String. For return values other than Status::OK(), the resulting value of "*out" is undefined.
| Status mongo::bsonExtractStringFieldWithDefault | ( | const BSONObj & | object, |
| const StringData & | fieldName, | ||
| const StringData & | defaultValue, | ||
| std::string * | out | ||
| ) |
Finds a string element named "fieldName" in "object".
If a field named "fieldName" is present, and is a string, stores the value of the field into "*out". If no field named fieldName is present, sets "*out" to "defaultValue". In these cases, returns Status::OK().
If "fieldName" is present more than once, behavior is undefined. If the found field is not a string, returns ErrorCodes::TypeMismatch.
| Status mongo::bsonExtractTypedField | ( | const BSONObj & | object, |
| const StringData & | fieldName, | ||
| BSONType | type, | ||
| BSONElement * | outElement | ||
| ) |
Finds an element named "fieldName" in "object".
Returns Status::OK() and sets *outElement to the found element on success. Returns ErrorCodes::NoSuchKey if there are no matches for "fieldName", and ErrorCodes::TypeMismatch if the type of the matching element is not "type". For return values other than Status::OK(), the resulting value of "*outElement" is undefined.
|
inline |
Returns a number for where a given type falls in the sort order.
Elements with the same return value should be compared for value equality. The return value is not a BSONType and should not be treated as one. Note: if the order changes, indexes have to be re-built or than can be corruption
| std::string mongo::constructUtf8WindowsCommandLine | ( | const std::vector< std::string > & | argv | ) |
Construct a Windows command line string, UTF-8 encoded, from a vector of UTF-8 arguments, "argv".
See "Parsing C++ Command-Line Arguments (C++)" http://msdn.microsoft.com/en-us/library/windows/desktop/17w5ykft(v=vs.85).aspx
| void mongo::curTimeString | ( | char * | timeStr | ) |
Gets the current time string (in fixed width) in UTC.
Sample format:
Wed Oct 31 13:34:47.996
| timeStr | pointer to the buffer to set the string - should at least be 24 bytes big. |
|
inline |
Allows to jump code during exeuction.
| string mongo::errnoWithPrefix | ( | const char * | prefix | ) |
output the error # and error message with prefix.
handy for use as parm in uassert/massert.
| BSONObj mongo::fromjson | ( | const std::string & | str | ) |
Create a BSONObj from a JSON http://www.json.org, http://www.ietf.org/rfc/rfc4627.txt string.
In addition to the JSON extensions extensions described here http://dochub.mongodb.org/core/mongodbextendedjson, this function accepts unquoted field names and allows single quotes to optionally be used when specifying field names and string values instead of double quotes. JSON unicode escape sequences (of the form ) are converted to utf8.
| MsgAssertionException | if parsing fails. The message included with this assertion includes the character offset where parsing failed. |
| BSONObj mongo::fromjson | ( | const char * | str, |
| int * | len = NULL |
||
| ) |
| len | will be size of JSON object in text chars. |
| FailPointRegistry * mongo::getGlobalFailPointRegistry | ( | ) |
| string mongo::getHostNameCached | ( | ) |
we store our host name once
this is cached, so if changes during the process lifetime will be stale
| int mongo::getSysctlByNameWithDefault | ( | const char * | sysctlName, |
| const T & | defaultValue, | ||
| T * | result | ||
| ) |
Get a sysctl string value by name.
Use string specialization by default.
| bool mongo::inConstructorChainSupported | ( | ) |
|
read |
An unsigned integer supporting atomic read-modify-write operations.
Many operations on these types depend on natural alignment (4 byte alignment for 4-byte words, i.e.).
| MONGO_COMPILER_NORETURN void mongo::msgassertedNoTrace | ( | int | msgid, |
| const char * | msg | ||
| ) |
msgassert and massert are for errors that are internal but have a well defined error text std::string.
a stack trace is logged.
| string mongo::nsGetCollection | ( | const string & | ns | ) |
| string mongo::nsGetDB | ( | const string & | ns | ) |
| void mongo::printStackAndExit | ( | int | signalNum | ) |
Obtains the log file handler and writes the current thread's stack trace to it.
This call issues an exit(). The function can safely be called from within a signal handler.
| signal | that this hadler is called for |
| Status mongo::saslExtractPayload | ( | const BSONObj & | cmdObj, |
| std::string * | payload, | ||
| BSONType * | type | ||
| ) |
Extracts the payload field from "cmdObj", and store it into "*payload".
Sets "*type" to the BSONType of the payload field in cmdObj.
If the type of the payload field is String, the contents base64 decodes and stores into "*payload". If the type is BinData, the contents are stored directly into "*payload". In all other cases, returns
| Nullstream & mongo::tlog | ( | int | level = 0 | ) |
logging which we may not want during unit tests (dbtests) runs.
set tlogLevel to -1 to suppress tlog() output in a test program.
| MONGO_COMPILER_NORETURN void mongo::uasserted | ( | int | msgid, |
| const char * | msg | ||
| ) |
a "user assertion".
throws UserAssertion. logs. typically used for errors that a user could cause, such as duplicate key, disk full, etc.
| Status mongo::validateBSON | ( | const char * | buf, |
| uint64_t | maxLength | ||
| ) |
| buf | - bson data |
| maxLength | - maxLength of buffer this is NOT the bson size, but how far we know the buffer is valid |
| Status(* mongo::saslClientAuthenticate)(DBClientWithCommands *client, const BSONObj &saslParameters, void *sessionHook) = NULL |
Attempts to authenticate "client" using the SASL protocol.
Do not use directly in client code. Use the DBClientWithCommands::auth(const BSONObj&) method, instead.
Test against NULL for availability. Client driver must be compiled with SASL support and client application must have successfully executed mongo::runGlobalInitializersOrDie() or its ilk to make this functionality available.
The "saslParameters" BSONObj should be initialized with zero or more of the fields below. Which fields are required depends on the mechanism. Consult the libgsasl documentation.
"mechanism": The string name of the sasl mechanism to use. Mandatory.
"autoAuthorize": Truthy values tell the server to automatically acquire privileges on
all resources after successful authentication, which is the default. Falsey values
instruct the server to await separate privilege-acquisition commands.
"user": The string name of the principal to authenticate, GSASL_AUTHID.
"userSource": The database target of the auth command, which identifies the location
of the credential information for the principal. May be "$external" if credential
information is stored outside of the mongo cluster.
"pwd": The password data, GSASL_PASSWORD.
"serviceName": The GSSAPI service name to use. Defaults to "mongodb".
"serviceHostname": The GSSAPI hostname to use. Defaults to the name of the remote host.
Other fields in saslParameters are silently ignored.
"sessionHook" is a pointer to optional data, which may be used by the gsasl_callback previously set on "gsasl". The session hook is set on an underlying Gsasl_session using gsasl_session_hook_set, and may be accessed by callbacks using gsasl_session_hook_get. See the gsasl documentation.
Returns an OK status on success, and ErrorCodes::AuthenticationFailed if authentication is rejected. Other failures, all of which are tantamount to authentication failure, may also be returned.
| const char *const mongo::saslCommandAutoAuthorizeFieldName = "autoAuthorize" |
Name of the saslStart parameter indicating that the server should automatically grant the connection all privileges associated with the principal after successful authentication.
| const char *const mongo::saslCommandConversationIdFieldName = "conversationId" |
Name of the field containing the conversation identifier in server respones and saslContinue commands.
| const char *const mongo::saslCommandDoneFieldName = "done" |
Name of the field that indicates whether or not the server believes authentication has completed successfully.
| const char *const mongo::saslCommandMechanismListFieldName = "supportedMechanisms" |
In the event that saslStart supplies an unsupported mechanism, the server responds with a field by this name, with a list of supported mechanisms.
| const char *const mongo::saslCommandPrincipalFieldName = "user" |
Field containing the string identifier of the principal to authenticate in saslClientAuthenticate().
| const char *const mongo::saslCommandPrincipalSourceFieldName = "userSource" |
Field containing the string identifier of the database containing credential information, or "$external" if the credential information is stored outside of the mongo cluster.
| const char *const mongo::saslCommandServiceHostnameFieldName = "serviceHostname" |
Field overriding the FQDN of the hostname hosting the mongodb srevice in saslClientAuthenticate().
1.8.3.1