Commit 7529bca3 authored by Libor Peltan's avatar Libor Peltan

journal: renamed functions to be starting with journal_*

parent b6fcaf89
......@@ -1014,7 +1014,7 @@ static int zone_purge(zone_t *zone, ctl_args_t *args)
// Purge the zone journal.
if (journal_open(zone->journal, zone->journal_db, zone->name) == KNOT_EOK) {
(void)scrape_journal(zone->journal);
(void)journal_scrape(zone->journal);
}
return KNOT_EOK;
......
......@@ -1533,7 +1533,7 @@ static int open_journal_db_unsafe(journal_db_t **db)
return KNOT_EOK;
}
int open_journal_db(journal_db_t **db)
int journal_open_db(journal_db_t **db)
{
if (*db == NULL) return KNOT_EINVAL;
pthread_mutex_lock(&(*db)->db_mutex);
......@@ -1554,7 +1554,7 @@ int journal_open(journal_t *j, journal_db_t **db, const knot_dname_t *zone_name)
// open shared journal DB if not already
if ((*db)->db == NULL) {
ret = open_journal_db(db);
ret = journal_open_db(db);
}
if (ret != KNOT_EOK) {
return ret;
......@@ -1655,7 +1655,7 @@ bool journal_exists(journal_db_t **db, knot_dname_t *zone_name)
if (stat((*db)->path, &st) != 0 || st.st_size == 0) {
return false;
}
int ret = open_journal_db(db);
int ret = journal_open_db(db);
if (ret != KNOT_EOK) {
return false;
}
......@@ -1682,7 +1682,7 @@ static knot_db_val_t *dbval_copy(const knot_db_val_t *from)
return to;
} // TODO think of moving this fun into different place/lib
int scrape_journal(journal_t *j)
int journal_scrape(journal_t *j)
{
if (j->db == NULL) return KNOT_EINVAL;
local_txn_t(txn, j);
......@@ -1766,7 +1766,7 @@ int journal_db_list_zones(journal_db_t **db, list_t *zones)
}
if ((*db)->db == NULL) {
int ret = open_journal_db(db);
int ret = journal_open_db(db);
if (ret != KNOT_EOK) {
return ret;
}
......
......@@ -178,7 +178,7 @@ int journal_store_changeset(journal_t *journal, changeset_t *change);
* \param db Journal to be opened.
* \return KNOT_E*
*/
int open_journal_db(journal_db_t **db);
int journal_open_db(journal_db_t **db);
/*!
* \brief Check if this (zone's) journal is present in shared journal DB.
......@@ -206,7 +206,7 @@ int journal_flush(journal_t *journal);
*
* \return KNOT_E*
*/
int scrape_journal(journal_t *j);
int journal_scrape(journal_t *j);
/*! \brief Obtain public information from journal metadata
*
......
......@@ -85,7 +85,7 @@ int print_journal(char *path, knot_dname_t *name, uint32_t limit, bool color)
return ret;
}
ret = open_journal_db(&jdb);
ret = journal_open_db(&jdb);
if (ret != KNOT_EOK) {
return ret;
}
......@@ -188,7 +188,7 @@ int list_zones(char *path)
return ret;
}
ret = open_journal_db(&jdb);
ret = journal_open_db(&jdb);
if (ret != KNOT_EOK) {
return ret;
}
......
......@@ -249,19 +249,19 @@ static void test_journal_db(void)
ret = journal_db_init(&db, test_dir_name, 2 * 1024 * 1024, JOURNAL_MODE_ASYNC);
is_int(KNOT_EOK, ret, "journal: init db (%d)", ret);
ret = open_journal_db(&db);
ret = journal_open_db(&db);
is_int(KNOT_EOK, ret, "journal: open db (%d)", ret);
journal_db_close(&db);
ok(db == NULL, "journal: close and destroy db");
ret = journal_db_init(&db, test_dir_name, 4 * 1024 * 1024, JOURNAL_MODE_ASYNC);
if (ret == KNOT_EOK) ret2 = open_journal_db(&db);
if (ret == KNOT_EOK) ret2 = journal_open_db(&db);
ok(ret == KNOT_EOK && ret2 == KNOT_EOK, "journal: open with bigger mapsize (%d, %d)", ret, ret2);
journal_db_close(&db);
ret = journal_db_init(&db, test_dir_name, 1024 * 1024, JOURNAL_MODE_ASYNC);
if (ret == KNOT_EOK) ret2 = open_journal_db(&db);
if (ret == KNOT_EOK) ret2 = journal_open_db(&db);
ok(ret == KNOT_EOK && ret2 == KNOT_EOK, "journal: open with smaller mapsize (%d, %d)", ret, ret2);
journal_db_close(&db);
}
......@@ -660,7 +660,7 @@ static void test_stress_base(journal_t *j, size_t update_size, size_t file_size)
db = NULL;
ret = journal_db_init(&db, test_dir_name, file_size, JOURNAL_MODE_ASYNC);
assert(ret == KNOT_EOK);
ret = open_journal_db(&db);
ret = journal_open_db(&db);
assert(ret == KNOT_EOK);
ret = journal_open(j, &db, apex);
assert(ret == KNOT_EOK);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment