CatapultServer
v0.5.0.1 (Elephant)
|
Error policy for checking mongo operation results. More...
Public Types | |
enum | Mode { Mode::Strict, Mode::Idempotent } |
Error policy modes. More... | |
Public Member Functions | |
MongoErrorPolicy (const std::string &collectionName, Mode mode) | |
Creates an error policy around collectionName using error policy mode. More... | |
Mode | mode () const |
Gets the error policy mode. More... | |
void | checkDeleted (uint64_t numExpected, const BulkWriteResult &result, const std::string &itemsDescription) const |
Checks that result indicates exactly numExpected deletions occurred given itemsDescription. More... | |
void | checkDeletedAtLeast (uint64_t numExpected, const BulkWriteResult &result, const std::string &itemsDescription) const |
Checks that result indicates at least numExpected deletions occurred given itemsDescription. More... | |
void | checkInserted (uint64_t numExpected, const BulkWriteResult &result, const std::string &itemsDescription) const |
Checks that result indicates exactly numExpected insertions occurred given itemsDescription. More... | |
void | checkUpserted (uint64_t numExpected, const BulkWriteResult &result, const std::string &itemsDescription) const |
Checks that result indicates exactly numExpected upsertions occurred given itemsDescription. More... | |
Private Member Functions | |
void | formatMessageAndThrow (const char *operation, uint64_t numExpected, uint64_t numActual, const std::string &itemsDescription) const |
Private Member Functions inherited from catapult::utils::MoveOnly | |
constexpr | MoveOnly ()=default |
Default constructor. More... | |
~MoveOnly ()=default | |
Default destructor. More... | |
MoveOnly (const NonCopyable &)=delete | |
Disabled copy constructor. More... | |
MoveOnly (MoveOnly &&)=default | |
Default move constructor. More... | |
MoveOnly & | operator= (const MoveOnly &)=delete |
Disabled assignment operator. More... | |
MoveOnly & | operator= (MoveOnly &&)=default |
Default move assignment operator. More... | |
Private Attributes | |
std::string | m_collectionName |
Mode | m_mode |
Error policy for checking mongo operation results.
|
strong |
|
explicit |
Creates an error policy around collectionName using error policy mode.
void catapult::mongo::MongoErrorPolicy::checkDeleted | ( | uint64_t | numExpected, |
const BulkWriteResult & | result, | ||
const std::string & | itemsDescription | ||
) | const |
Checks that result indicates exactly numExpected deletions occurred given itemsDescription.
void catapult::mongo::MongoErrorPolicy::checkDeletedAtLeast | ( | uint64_t | numExpected, |
const BulkWriteResult & | result, | ||
const std::string & | itemsDescription | ||
) | const |
Checks that result indicates at least numExpected deletions occurred given itemsDescription.
void catapult::mongo::MongoErrorPolicy::checkInserted | ( | uint64_t | numExpected, |
const BulkWriteResult & | result, | ||
const std::string & | itemsDescription | ||
) | const |
Checks that result indicates exactly numExpected insertions occurred given itemsDescription.
void catapult::mongo::MongoErrorPolicy::checkUpserted | ( | uint64_t | numExpected, |
const BulkWriteResult & | result, | ||
const std::string & | itemsDescription | ||
) | const |
Checks that result indicates exactly numExpected upsertions occurred given itemsDescription.
|
private |
MongoErrorPolicy::Mode catapult::mongo::MongoErrorPolicy::mode | ( | ) | const |
Gets the error policy mode.
|
private |
|
private |