Commit 14f92f57 authored by Alexander Larsson's avatar Alexander Larsson

Implement unset key in MetaTree

parent 57e0344d
......@@ -869,6 +869,19 @@ meta_journal_entry_new_setv (guint64 mtime,
return meta_journal_entry_finish (out);
static GString *
meta_journal_entry_new_unset (guint64 mtime,
const char *path,
const char *key)
GString *out;
out = meta_journal_entry_init (JOURNAL_OP_UNSET_KEY, mtime, path);
append_string (out, key);
return meta_journal_entry_finish (out);
/* Call with writer lock held */
static gboolean
meta_journal_add_entry (MetaJournal *journal,
......@@ -2140,8 +2153,38 @@ meta_tree_unset (MetaTree *tree,
const char *path,
const char *key)
/* TODO */
return FALSE;
GString *entry;
guint64 mtime;
gboolean res;
g_static_rw_lock_writer_lock (&metatree_lock);
if (tree->journal == NULL ||
res = FALSE;
goto out;
mtime = time (NULL);
entry = meta_journal_entry_new_unset (mtime, path, key);
res = TRUE;
if (!meta_journal_add_entry (tree->journal, entry))
if (meta_tree_flush_locked (tree))
goto retry;
res = FALSE;
g_string_free (entry, TRUE);
g_static_rw_lock_writer_unlock (&metatree_lock);
return res;
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