|
G_END_DECLS G_BEGIN_DECLS JDistribution * | j_distribution_new (JDistributionType type) |
|
JDistribution * | j_distribution_new_for_configuration (JDistributionType type, JConfiguration *configuration) |
|
JDistribution * | j_distribution_new_from_bson (bson_t const *b) |
|
JDistribution * | j_distribution_ref (JDistribution *distribution) |
|
void | j_distribution_unref (JDistribution *distribution) |
|
bson_t * | j_distribution_serialize (JDistribution *distribution) |
|
void | j_distribution_deserialize (JDistribution *distribution, bson_t const *b) |
|
void | j_distribution_set_block_size (JDistribution *distribution, guint64 block_size) |
|
void | j_distribution_set (JDistribution *distribution, gchar const *key, guint64 value) |
|
void | j_distribution_set2 (JDistribution *distribution, gchar const *key, guint64 value1, guint64 value2) |
|
void | j_distribution_reset (JDistribution *distribution, guint64 length, guint64 offset) |
|
gboolean | j_distribution_distribute (JDistribution *distribution, guint *index, guint64 *new_length, guint64 *new_offset, guint64 *block_id) |
|
void | j_distribution_round_robin_get_vtable (JDistributionVTable *vtable) |
|
void | j_distribution_single_server_get_vtable (JDistributionVTable *vtable) |
|
void | j_distribution_weighted_get_vtable (JDistributionVTable *vtable) |
|
void | j_distribution_init (void) |
|
Data structures and functions for managing distributions.
◆ JDistribution
◆ JDistributionRoundRobin
◆ JDistributionSingleServer
◆ JDistributionType
◆ JDistributionWeighted
◆ JDistributionType
Enumerator |
---|
J_DISTRIBUTION_ROUND_ROBIN | |
J_DISTRIBUTION_SINGLE_SERVER | |
J_DISTRIBUTION_WEIGHTED | |
◆ j_distribution_deserialize()
void j_distribution_deserialize |
( |
JDistribution * |
distribution, |
|
|
bson_t const * |
b |
|
) |
| |
Deserializes distribution.
- Parameters
-
◆ j_distribution_distribute()
gboolean j_distribution_distribute |
( |
JDistribution * |
distribution, |
|
|
guint * |
index, |
|
|
guint64 * |
new_length, |
|
|
guint64 * |
new_offset, |
|
|
guint64 * |
block_id |
|
) |
| |
Calculates a new length and a new offset based on a distribution.
- Parameters
-
distribution | A distribution. |
index | A server index. |
new_length | A new length. |
new_offset | A new offset. |
block_id | A block ID. |
- Returns
- TRUE on success, FALSE if the distribution is finished.
◆ j_distribution_init()
void j_distribution_init |
( |
void |
| ) |
|
◆ j_distribution_new()
Creates a new distribution.
G_END_DECLS G_BEGIN_DECLS JDistribution * j_distribution_new(JDistributionType type)
Definition: jdistribution.c:88
@ J_DISTRIBUTION_ROUND_ROBIN
Definition: jdistribution.h:46
Definition: jdistribution.c:48
- Parameters
-
- Returns
- A new distribution. Should be freed with j_distribution_unref().
◆ j_distribution_new_for_configuration()
Creates a new distribution for a given configuration.
- Parameters
-
- Returns
- A new distribution. Should be freed with j_distribution_unref().
◆ j_distribution_new_from_bson()
Creates a new distribution from a BSON object.
- Parameters
-
- Returns
- A new distribution. Should be freed with j_distribution_unref().
◆ j_distribution_ref()
Increases a distribution's reference count.
- Parameters
-
distribution | A distribution. |
◆ j_distribution_reset()
void j_distribution_reset |
( |
JDistribution * |
distribution, |
|
|
guint64 |
length, |
|
|
guint64 |
offset |
|
) |
| |
Resets a distribution.
void j_distribution_reset(JDistribution *distribution, guint64 length, guint64 offset)
Definition: jdistribution.c:169
- Parameters
-
- Returns
- A new distribution. Should be freed with j_distribution_unref().
◆ j_distribution_round_robin_get_vtable()
◆ j_distribution_serialize()
bson_t * j_distribution_serialize |
( |
JDistribution * |
distribution | ) |
|
Serializes distribution.
- Parameters
-
- Returns
- A new BSON object. Should be freed with bson_destroy().
◆ j_distribution_set()
void j_distribution_set |
( |
JDistribution * |
distribution, |
|
|
gchar const * |
key, |
|
|
guint64 |
value |
|
) |
| |
Set a property of the distribution. Settings depend on the distribution type.
- Parameters
-
distribution | A distribution. |
key | Name of the property to set. |
value | Value to be set for the property. |
◆ j_distribution_set2()
void j_distribution_set2 |
( |
JDistribution * |
distribution, |
|
|
gchar const * |
key, |
|
|
guint64 |
value1, |
|
|
guint64 |
value2 |
|
) |
| |
Set a property of the distribution which needs to values. Settings depend on the distribution type.
- Parameters
-
distribution | A distribution. |
key | Name of the property to set. |
value1 | Value to be set for the property. |
value2 | Value to be set for the property. |
◆ j_distribution_set_block_size()
void j_distribution_set_block_size |
( |
JDistribution * |
distribution, |
|
|
guint64 |
block_size |
|
) |
| |
Sets the block size for the distribution.
- Parameters
-
distribution | A distribution. |
block_size | A block size. |
◆ j_distribution_single_server_get_vtable()
◆ j_distribution_unref()
Decreases a distribution's reference count. When the reference count reaches zero, frees the memory allocated for the distribution.
- Parameters
-
distribution | A distribution. |
◆ j_distribution_weighted_get_vtable()