JULEA
Data Structures | Typedefs | Enumerations | Functions
Distribution

Data Structures

struct  JDistributionRoundRobin
 
struct  JDistributionSingleServer
 
struct  JDistributionWeighted
 
struct  JDistribution
 

Typedefs

typedef enum JDistributionType JDistributionType
 
typedef struct JDistribution JDistribution
 
typedef struct JDistributionRoundRobin JDistributionRoundRobin
 
typedef struct JDistributionSingleServer JDistributionSingleServer
 
typedef struct JDistributionWeighted JDistributionWeighted
 

Enumerations

enum  JDistributionType { J_DISTRIBUTION_ROUND_ROBIN , J_DISTRIBUTION_SINGLE_SERVER , J_DISTRIBUTION_WEIGHTED }
 

Functions

G_END_DECLS G_BEGIN_DECLS JDistributionj_distribution_new (JDistributionType type)
 
JDistributionj_distribution_new_for_configuration (JDistributionType type, JConfiguration *configuration)
 
JDistributionj_distribution_new_from_bson (bson_t const *b)
 
JDistributionj_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)
 

Detailed Description

Data structures and functions for managing distributions.

Typedef Documentation

◆ JDistribution

typedef struct JDistribution JDistribution

◆ JDistributionRoundRobin

◆ JDistributionSingleServer

◆ JDistributionType

◆ JDistributionWeighted

Enumeration Type Documentation

◆ JDistributionType

Enumerator
J_DISTRIBUTION_ROUND_ROBIN 
J_DISTRIBUTION_SINGLE_SERVER 
J_DISTRIBUTION_WEIGHTED 

Function Documentation

◆ j_distribution_deserialize()

void j_distribution_deserialize ( JDistribution distribution,
bson_t const *  b 
)

Deserializes distribution.

Parameters
distributionA JDistribution.
bA BSON object.

◆ 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
distributionA distribution.
indexA server index.
new_lengthA new length.
new_offsetA new offset.
block_idA block ID.
Returns
TRUE on success, FALSE if the distribution is finished.

◆ j_distribution_init()

void j_distribution_init ( void  )

◆ j_distribution_new()

JDistribution * j_distribution_new ( JDistributionType  type)

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
typeA distribution type.
Returns
A new distribution. Should be freed with j_distribution_unref().

◆ j_distribution_new_for_configuration()

JDistribution * j_distribution_new_for_configuration ( JDistributionType  type,
JConfiguration configuration 
)

Creates a new distribution for a given configuration.

Parameters
typeA distribution type.
configurationA JConfiguration.
Returns
A new distribution. Should be freed with j_distribution_unref().

◆ j_distribution_new_from_bson()

JDistribution * j_distribution_new_from_bson ( bson_t const *  b)

Creates a new distribution from a BSON object.

Parameters
bA BSON object.
Returns
A new distribution. Should be freed with j_distribution_unref().

◆ j_distribution_ref()

JDistribution * j_distribution_ref ( JDistribution distribution)

Increases a distribution's reference count.

Parameters
distributionA 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
distributionA JDistribution.
lengthA length.
offsetAn offset.
Returns
A new distribution. Should be freed with j_distribution_unref().

◆ j_distribution_round_robin_get_vtable()

void j_distribution_round_robin_get_vtable ( JDistributionVTable vtable)

◆ j_distribution_serialize()

bson_t * j_distribution_serialize ( JDistribution distribution)

Serializes distribution.

Parameters
distributionA JDistribution.
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
distributionA distribution.
keyName of the property to set.
valueValue 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
distributionA distribution.
keyName of the property to set.
value1Value to be set for the property.
value2Value 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
distributionA distribution.
block_sizeA block size.

◆ j_distribution_single_server_get_vtable()

void j_distribution_single_server_get_vtable ( JDistributionVTable vtable)

◆ j_distribution_unref()

void j_distribution_unref ( JDistribution distribution)

Decreases a distribution's reference count. When the reference count reaches zero, frees the memory allocated for the distribution.

Parameters
distributionA distribution.

◆ j_distribution_weighted_get_vtable()

void j_distribution_weighted_get_vtable ( JDistributionVTable vtable)