summaryrefslogtreecommitdiff
path: root/builder/builder-cache.h
blob: 171f27dfd123ac15a88f67a1bc04cc184459800c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
 * Copyright © 2015 Red Hat, Inc
 *
 * This program 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, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *       Alexander Larsson <alexl@redhat.com>
 */

#ifndef __BUILDER_CACHE_H__
#define __BUILDER_CACHE_H__

#include <gio/gio.h>
#include <libglnx/libglnx.h>

G_BEGIN_DECLS

typedef struct BuilderCache BuilderCache;

#define BUILDER_TYPE_CACHE (builder_cache_get_type())
#define BUILDER_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_CACHE, BuilderCache))
#define BUILDER_IS_CACHE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_CACHE))

GType builder_cache_get_type (void);

BuilderCache *builder_cache_new             (GFile         *cache_dir,
                                             GFile         *app_dir,
                                             const char    *branch);
void          builder_cache_disable_lookups (BuilderCache  *self);
gboolean      builder_cache_open            (BuilderCache  *self,
                                             GError       **error);
GChecksum *   builder_cache_get_checksum    (BuilderCache  *self);
gboolean      builder_cache_lookup          (BuilderCache  *self,
                                             const char    *stage);
void          builder_cache_ensure_checkout (BuilderCache *self);
gboolean      builder_cache_has_checkout    (BuilderCache *self);
gboolean      builder_cache_commit          (BuilderCache  *self,
                                             const char    *body,
                                             GError       **error);
gboolean      builder_cache_get_outstanding_changes (BuilderCache  *self,
                                                     GPtrArray    **added_out,
                                                     GPtrArray    **modified_out,
                                                     GPtrArray    **removed_out,
                                                     GError       **error);
GPtrArray   *builder_cache_get_changes      (BuilderCache  *self,
                                             GError       **error);
GPtrArray   *builder_cache_get_all_changes  (BuilderCache  *self,
                                             GError       **error);
gboolean      builder_gc                    (BuilderCache  *self,
                                             GError       **error);

void builder_cache_checksum_str     (BuilderCache  *self,
                                     const char    *str);
void builder_cache_checksum_strv    (BuilderCache  *self,
                                     char         **strv);
void builder_cache_checksum_boolean (BuilderCache  *self,
                                     gboolean       val);
void builder_cache_checksum_uint32  (BuilderCache  *self,
                                     guint32        val);
void builder_cache_checksum_data    (BuilderCache  *self,
                                     guint8        *data,
                                     gsize          len);

G_DEFINE_AUTOPTR_CLEANUP_FUNC(BuilderCache, g_object_unref)

G_END_DECLS

#endif /* __BUILDER_CACHE_H__ */