|
static std::mutex & | getDbMutex () noexcept |
| Returns Database mutex to be used by multiple threads for writing/reading into/from the database.
More...
|
|
static auto & | getStorage () |
| Returns create database storage. It creates it if not already created, also syncs the db schema.
More...
|
|
static void | backup () |
| Call this periodically to backup the database in res/DbBackups/ periodically. More...
|
|
static bool | userExists (const models::UserId userId) |
| Returns true if User with id exists in the database. More...
|
|
static models::User | getUser (const models::UserId userId) |
| Returns User object by id. More...
|
|
static void | addUser (const models::User &newUser) |
| Adds a new user to the database. More...
|
|
static models::UserStatus | getUserStatus (const models::UserId userId) |
| Returns UserStatus by id. More...
|
|
static void | updateUserStatus (const models::UserId userId, const models::UserStatus newStatus) |
| Update User's status by id. More...
|
|
static void | updateUser (const models::User &updatedUser) |
| Updates existing user changed properties. More...
|
|
static int | userReposCount (const models::UserId userId) |
| Returns the count of repositories this user is watching. More...
|
|
static bool | repoExists (const models::RepositoryId repoId) |
| Returns true if a Repository exists with same id. More...
|
|
static bool | repoExistsByFullName (const std::string &full_name) |
| Returns true if Repository exists with same full_name (example: "torvalds/linux") More...
|
|
static void | addRepo (const models::Repository &newRepo) |
| Adds a new Repository object to the database. More...
|
|
static void | updateRepo (const models::Repository &updatedRepo) |
| Updates existing repository changed properties. More...
|
|
static void | removeUserRepo (const models::UserId watcherId, const models::RepositoryId repoId) |
| Removes Repository from User's watch list. More...
|
|
static void | iterateRepos (const std::function< void(const models::Repository &)> &callback) |
| Lock secure iterate over repositories to not hold the db mutex for a long time. More...
|
|
static std::vector< std::string > | getUserReposFullnames (const models::UserId watcherId) |
| Returns full names of all repositories that a User is watching. More...
|
|
static std::vector< models::Repository > | getUserRepos (const models::UserId watcherId) |
| Returns all Repositories objects that a User is watching. More...
|
|
static std::int64_t | addLog (const models::Log &newLog) |
| Adds a new Log object to the database. More...
|
|