libostree: Rename ostree-traverse.h into OstreeRepo namespace

This operates on the repo, it might as well be methods on it.
This commit is contained in:
Colin Walters 2013-07-09 19:59:39 -04:00
parent cb6b69616c
commit 2aa0251b1b
8 changed files with 43 additions and 73 deletions

View File

@ -34,6 +34,7 @@ libostree_la_SOURCES = src/libostree/ostree.h \
src/libostree/ostree-repo-checkout.c \
src/libostree/ostree-repo-libarchive.c \
src/libostree/ostree-repo-refs.c \
src/libostree/ostree-repo-traverse.c \
src/libostree/ostree-repo.h \
src/libostree/ostree-repo-private.h \
src/libostree/ostree-repo-file.c \
@ -41,8 +42,6 @@ libostree_la_SOURCES = src/libostree/ostree.h \
src/libostree/ostree-repo-file-enumerator.c \
src/libostree/ostree-repo-file-enumerator.h \
src/libostree/ostree-types.h \
src/libostree/ostree-traverse.c \
src/libostree/ostree-traverse.h \
$(NULL)
if USE_LIBARCHIVE
libostree_la_SOURCES += src/libostree/ostree-libarchive-input-stream.h \

View File

@ -28,7 +28,7 @@
#include "otutil.h"
GHashTable *
ostree_traverse_new_reachable (void)
ostree_repo_traverse_new_reachable (void)
{
return g_hash_table_new_full (ostree_hash_object_name, g_variant_equal,
(GDestroyNotify)g_variant_unref, NULL);
@ -119,11 +119,11 @@ traverse_dirtree_internal (OstreeRepo *repo,
}
gboolean
ostree_traverse_dirtree (OstreeRepo *repo,
const char *dirtree_checksum,
GHashTable *inout_reachable,
GCancellable *cancellable,
GError **error)
ostree_repo_traverse_dirtree (OstreeRepo *repo,
const char *dirtree_checksum,
GHashTable *inout_reachable,
GCancellable *cancellable,
GError **error)
{
return traverse_dirtree_internal (repo, dirtree_checksum, 0,
inout_reachable, cancellable, error);
@ -136,12 +136,12 @@ ostree_traverse_dirtree (OstreeRepo *repo,
* @commit_checksum, traversing @maxdepth parent commits.
*/
gboolean
ostree_traverse_commit (OstreeRepo *repo,
const char *commit_checksum,
int maxdepth,
GHashTable *inout_reachable,
GCancellable *cancellable,
GError **error)
ostree_repo_traverse_commit (OstreeRepo *repo,
const char *commit_checksum,
int maxdepth,
GHashTable *inout_reachable,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
gs_free char*tmp_checksum = NULL;
@ -199,7 +199,7 @@ ostree_traverse_commit (OstreeRepo *repo,
}
tmp_checksum = ostree_checksum_from_bytes_v (content_csum_bytes);
if (!ostree_traverse_dirtree (repo, tmp_checksum, inout_reachable, cancellable, error))
if (!ostree_repo_traverse_dirtree (repo, tmp_checksum, inout_reachable, cancellable, error))
goto out;
if (maxdepth == -1 || maxdepth > 0)

View File

@ -317,5 +317,21 @@ gboolean ostree_repo_list_objects (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
GHashTable *ostree_repo_traverse_new_reachable (void);
gboolean ostree_repo_traverse_dirtree (OstreeRepo *repo,
const char *commit_checksum,
GHashTable *inout_reachable,
GCancellable *cancellable,
GError **error);
gboolean ostree_repo_traverse_commit (OstreeRepo *repo,
const char *commit_checksum,
int maxdepth,
GHashTable *inout_reachable,
GCancellable *cancellable,
GError **error);
G_END_DECLS

View File

@ -1,46 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Colin Walters <walters@verbum.org>
*/
#pragma once
#include "ostree-core.h"
#include "ostree-types.h"
G_BEGIN_DECLS
GHashTable *ostree_traverse_new_reachable (void);
gboolean ostree_traverse_dirtree (OstreeRepo *repo,
const char *commit_checksum,
GHashTable *inout_reachable,
GCancellable *cancellable,
GError **error);
gboolean ostree_traverse_commit (OstreeRepo *repo,
const char *commit_checksum,
int maxdepth,
GHashTable *inout_reachable,
GCancellable *cancellable,
GError **error);
G_END_DECLS

View File

@ -28,5 +28,4 @@
#include <ostree-repo.h>
#include <ostree-mutable-tree.h>
#include <ostree-repo-file.h>
#include <ostree-traverse.h>
#include <ostree-diff.h>

View File

@ -106,7 +106,7 @@ ostree_prune (OstreeRepo *repo,
memset (&data, 0, sizeof (data));
data.repo = repo;
data.reachable = ostree_traverse_new_reachable ();
data.reachable = ostree_repo_traverse_new_reachable ();
if (refs_only)
{
@ -120,8 +120,8 @@ ostree_prune (OstreeRepo *repo,
{
const char *checksum = value;
if (!ostree_traverse_commit (repo, checksum, depth, data.reachable,
cancellable, error))
if (!ostree_repo_traverse_commit (repo, checksum, depth, data.reachable,
cancellable, error))
goto out;
}
}
@ -144,8 +144,8 @@ ostree_prune (OstreeRepo *repo,
if (objtype != OSTREE_OBJECT_TYPE_COMMIT)
continue;
if (!ostree_traverse_commit (repo, checksum, depth, data.reachable,
cancellable, error))
if (!ostree_repo_traverse_commit (repo, checksum, depth, data.reachable,
cancellable, error))
goto out;
}
}

View File

@ -58,7 +58,7 @@ fsck_reachable_objects_from_commits (OtFsckData *data,
gs_free guchar *computed_csum = NULL;
gs_free char *tmp_checksum = NULL;
reachable_objects = ostree_traverse_new_reachable ();
reachable_objects = ostree_repo_traverse_new_reachable ();
g_hash_table_iter_init (&hash_iter, commits);
while (g_hash_table_iter_next (&hash_iter, &key, &value))
@ -71,8 +71,8 @@ fsck_reachable_objects_from_commits (OtFsckData *data,
g_assert (objtype == OSTREE_OBJECT_TYPE_COMMIT);
if (!ostree_traverse_commit (data->repo, checksum, 0, reachable_objects,
cancellable, error))
if (!ostree_repo_traverse_commit (data->repo, checksum, 0, reachable_objects,
cancellable, error))
goto out;
}

View File

@ -254,7 +254,7 @@ ostree_builtin_pull_local (int argc, char **argv, GFile *repo_path, GError **err
g_print ("Enumerating objects...\n");
source_objects = ostree_traverse_new_reachable ();
source_objects = ostree_repo_traverse_new_reachable ();
if (refs_to_clone)
{
@ -263,7 +263,8 @@ ostree_builtin_pull_local (int argc, char **argv, GFile *repo_path, GError **err
{
const char *checksum = value;
if (!ostree_traverse_commit (data->src_repo, checksum, 0, source_objects, cancellable, error))
if (!ostree_repo_traverse_commit (data->src_repo, checksum, 0, source_objects,
cancellable, error))
goto out;
}
}
@ -275,7 +276,8 @@ ostree_builtin_pull_local (int argc, char **argv, GFile *repo_path, GError **err
{
const char *checksum = key;
if (!ostree_traverse_commit (data->src_repo, checksum, 0, source_objects, cancellable, error))
if (!ostree_repo_traverse_commit (data->src_repo, checksum, 0, source_objects,
cancellable, error))
goto out;
}
}