JULEA
jdistribution.h
Go to the documentation of this file.
1 /*
2  * JULEA - Flexible storage framework
3  * Copyright (C) 2010-2024 Michael Kuhn
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
23 #ifndef JULEA_DISTRIBUTION_H
24 #define JULEA_DISTRIBUTION_H
25 
26 #if !defined(JULEA_H) && !defined(JULEA_COMPILATION)
27 #error "Only <julea.h> can be included directly."
28 #endif
29 
30 #include <glib.h>
31 
32 #include <bson.h>
33 
34 G_BEGIN_DECLS
35 
45 {
49 };
50 
52 
53 struct JDistribution;
54 
55 typedef struct JDistribution JDistribution;
56 
57 G_END_DECLS
58 
59 #include <core/jconfiguration.h>
60 
61 G_BEGIN_DECLS
62 
77 
93 
105 
115 
126 
127 G_DEFINE_AUTOPTR_CLEANUP_FUNC(JDistribution, j_distribution_unref)
128 
129 
140 
151 
161 void j_distribution_set_block_size(JDistribution* distribution, guint64 block_size);
162 
173 void j_distribution_set(JDistribution* distribution, gchar const* key, guint64 value);
174 
186 void j_distribution_set2(JDistribution* distribution, gchar const* key, guint64 value1, guint64 value2);
187 
203 void j_distribution_reset(JDistribution* distribution, guint64 length, guint64 offset);
204 
219 gboolean j_distribution_distribute(JDistribution* distribution, guint* index, guint64* new_length, guint64* new_offset, guint64* block_id);
220 
225 G_END_DECLS
226 
227 #endif
JDistributionType
Definition: jdistribution.h:45
void j_distribution_set(JDistribution *distribution, gchar const *key, guint64 value)
Definition: jdistribution.c:141
JDistribution * j_distribution_new_for_configuration(JDistributionType type, JConfiguration *configuration)
Definition: jdistribution.c:286
JDistribution * j_distribution_ref(JDistribution *distribution)
Definition: jdistribution.c:100
gboolean j_distribution_distribute(JDistribution *distribution, guint *index, guint64 *new_length, guint64 *new_offset, guint64 *block_id)
Definition: jdistribution.c:179
void j_distribution_set_block_size(JDistribution *distribution, guint64 block_size)
Definition: jdistribution.c:127
void j_distribution_reset(JDistribution *distribution, guint64 length, guint64 offset)
Definition: jdistribution.c:169
G_END_DECLS G_BEGIN_DECLS JDistribution * j_distribution_new(JDistributionType type)
Definition: jdistribution.c:88
void j_distribution_deserialize(JDistribution *distribution, bson_t const *b)
Definition: jdistribution.c:213
void j_distribution_set2(JDistribution *distribution, gchar const *key, guint64 value1, guint64 value2)
Definition: jdistribution.c:155
bson_t * j_distribution_serialize(JDistribution *distribution)
Definition: jdistribution.c:192
void j_distribution_unref(JDistribution *distribution)
Definition: jdistribution.c:112
JDistribution * j_distribution_new_from_bson(bson_t const *b)
Definition: jdistribution.c:272
@ J_DISTRIBUTION_ROUND_ROBIN
Definition: jdistribution.h:46
@ J_DISTRIBUTION_WEIGHTED
Definition: jdistribution.h:48
@ J_DISTRIBUTION_SINGLE_SERVER
Definition: jdistribution.h:47
Definition: jconfiguration.c:46
Definition: jdistribution.c:48
gpointer distribution
Definition: jdistribution.c:57
JDistributionType type
Definition: jdistribution.c:52