JULEA
Data Structures | Typedefs | Enumerations | Functions
Message

Data Structures

struct  JMessageData
 
struct  JMessageHeader
 
struct  JMessage
 

Typedefs

typedef enum JMessageType JMessageType
 
typedef struct JMessage JMessage
 
typedef enum JMessageSemantics JMessageSemantics
 
typedef struct JMessageData JMessageData
 
typedef struct JMessageHeader JMessageHeader
 

Enumerations

enum  JMessageType {
  J_MESSAGE_NONE , J_MESSAGE_PING , J_MESSAGE_STATISTICS , J_MESSAGE_OBJECT_CREATE ,
  J_MESSAGE_OBJECT_DELETE , J_MESSAGE_OBJECT_GET_ALL , J_MESSAGE_OBJECT_GET_BY_PREFIX , J_MESSAGE_OBJECT_READ ,
  J_MESSAGE_OBJECT_STATUS , J_MESSAGE_OBJECT_SYNC , J_MESSAGE_OBJECT_WRITE , J_MESSAGE_KV_PUT ,
  J_MESSAGE_KV_DELETE , J_MESSAGE_KV_GET , J_MESSAGE_KV_GET_ALL , J_MESSAGE_KV_GET_BY_PREFIX ,
  J_MESSAGE_DB_SCHEMA_CREATE , J_MESSAGE_DB_SCHEMA_GET , J_MESSAGE_DB_SCHEMA_DELETE , J_MESSAGE_DB_INSERT ,
  J_MESSAGE_DB_UPDATE , J_MESSAGE_DB_DELETE , J_MESSAGE_DB_QUERY
}
 
enum  JMessageSemantics {
  J_MESSAGE_SEMANTICS_ATOMICITY_BATCH = 1 << 0 , J_MESSAGE_SEMANTICS_ATOMICITY_OPERATION = 1 << 1 , J_MESSAGE_SEMANTICS_ATOMICITY_NONE = 1 << 2 , J_MESSAGE_SEMANTICS_CONSISTENCY_IMMEDIATE = 1 << 3 ,
  J_MESSAGE_SEMANTICS_CONSISTENCY_SESSION = 1 << 4 , J_MESSAGE_SEMANTICS_CONSISTENCY_EVENTUAL = 1 << 5 , J_MESSAGE_SEMANTICS_PERSISTENCY_STORAGE = 1 << 6 , J_MESSAGE_SEMANTICS_PERSISTENCY_NETWORK = 1 << 7 ,
  J_MESSAGE_SEMANTICS_PERSISTENCY_NONE = 1 << 8 , J_MESSAGE_SEMANTICS_SECURITY_STRICT = 1 << 9 , J_MESSAGE_SEMANTICS_SECURITY_NONE = 1 << 10
}
 

Functions

G_END_DECLS G_BEGIN_DECLS JMessagej_message_new (JMessageType op_type, gsize length)
 
JMessagej_message_new_reply (JMessage *message)
 
JMessagej_message_ref (JMessage *message)
 
void j_message_unref (JMessage *message)
 
JMessageType j_message_get_type (JMessage const *message)
 
guint32 j_message_get_count (JMessage const *message)
 
gboolean j_message_append_1 (JMessage *message, gconstpointer data)
 
gboolean j_message_append_4 (JMessage *message, gconstpointer data)
 
gboolean j_message_append_8 (JMessage *message, gconstpointer data)
 
gboolean j_message_append_n (JMessage *message, gconstpointer data, gsize length)
 
gboolean j_message_append_string (JMessage *message, gchar const *str)
 
gchar j_message_get_1 (JMessage *message)
 
gint32 j_message_get_4 (JMessage *message)
 
gint64 j_message_get_8 (JMessage *message)
 
gpointer j_message_get_n (JMessage *message, gsize length)
 
gchar const * j_message_get_string (JMessage *message)
 
gboolean j_message_send (JMessage *message, gpointer stream)
 
gboolean j_message_receive (JMessage *message, gpointer stream)
 
gboolean j_message_read (JMessage *message, GInputStream *stream)
 
gboolean j_message_write (JMessage *message, GOutputStream *stream)
 
void j_message_add_send (JMessage *message, gconstpointer data, guint64 length)
 
void j_message_add_operation (JMessage *message, gsize length)
 
void j_message_set_semantics (JMessage *message, JSemantics *semantics)
 
JSemanticsj_message_get_semantics (JMessage *message)
 
 G_STATIC_ASSERT (sizeof(JMessageHeader)==5 *sizeof(guint32))
 

Detailed Description

Typedef Documentation

◆ JMessage

typedef struct JMessage JMessage

◆ JMessageData

typedef struct JMessageData JMessageData

◆ JMessageHeader

◆ JMessageSemantics

◆ JMessageType

typedef enum JMessageType JMessageType

Enumeration Type Documentation

◆ JMessageSemantics

Enumerator
J_MESSAGE_SEMANTICS_ATOMICITY_BATCH 
J_MESSAGE_SEMANTICS_ATOMICITY_OPERATION 
J_MESSAGE_SEMANTICS_ATOMICITY_NONE 
J_MESSAGE_SEMANTICS_CONSISTENCY_IMMEDIATE 
J_MESSAGE_SEMANTICS_CONSISTENCY_SESSION 
J_MESSAGE_SEMANTICS_CONSISTENCY_EVENTUAL 
J_MESSAGE_SEMANTICS_PERSISTENCY_STORAGE 
J_MESSAGE_SEMANTICS_PERSISTENCY_NETWORK 
J_MESSAGE_SEMANTICS_PERSISTENCY_NONE 
J_MESSAGE_SEMANTICS_SECURITY_STRICT 
J_MESSAGE_SEMANTICS_SECURITY_NONE 

◆ JMessageType

Enumerator
J_MESSAGE_NONE 
J_MESSAGE_PING 
J_MESSAGE_STATISTICS 
J_MESSAGE_OBJECT_CREATE 
J_MESSAGE_OBJECT_DELETE 
J_MESSAGE_OBJECT_GET_ALL 
J_MESSAGE_OBJECT_GET_BY_PREFIX 
J_MESSAGE_OBJECT_READ 
J_MESSAGE_OBJECT_STATUS 
J_MESSAGE_OBJECT_SYNC 
J_MESSAGE_OBJECT_WRITE 
J_MESSAGE_KV_PUT 
J_MESSAGE_KV_DELETE 
J_MESSAGE_KV_GET 
J_MESSAGE_KV_GET_ALL 
J_MESSAGE_KV_GET_BY_PREFIX 
J_MESSAGE_DB_SCHEMA_CREATE 
J_MESSAGE_DB_SCHEMA_GET 
J_MESSAGE_DB_SCHEMA_DELETE 
J_MESSAGE_DB_INSERT 
J_MESSAGE_DB_UPDATE 
J_MESSAGE_DB_DELETE 
J_MESSAGE_DB_QUERY 

Function Documentation

◆ G_STATIC_ASSERT()

G_STATIC_ASSERT ( sizeof(JMessageHeader = =5 *sizeof(guint32))

◆ j_message_add_operation()

void j_message_add_operation ( JMessage message,
gsize  length 
)

Adds a new operation to a message.

Parameters
messageA message.
lengthA length.

◆ j_message_add_send()

void j_message_add_send ( JMessage message,
gconstpointer  data,
guint64  length 
)

Adds new data to send to a message.

Parameters
messageA message.
dataData.
lengthA length.

◆ j_message_append_1()

gboolean j_message_append_1 ( JMessage message,
gconstpointer  data 
)

Appends 1 byte to a message.

Parameters
messageA message.
dataData to append.
Returns
TRUE on success, FALSE if an error occurred.

◆ j_message_append_4()

gboolean j_message_append_4 ( JMessage message,
gconstpointer  data 
)

Appends 4 bytes to a message. The bytes are converted to little endian automatically.

Parameters
messageA message.
dataData to append.
Returns
TRUE on success, FALSE if an error occurred.

◆ j_message_append_8()

gboolean j_message_append_8 ( JMessage message,
gconstpointer  data 
)

Appends 8 bytes to a message. The bytes are converted to little endian automatically.

Parameters
messageA message.
dataData to append.
Returns
TRUE on success, FALSE if an error occurred.

◆ j_message_append_n()

gboolean j_message_append_n ( JMessage message,
gconstpointer  data,
gsize  length 
)

Appends a number of bytes to a message.

gchar* str = "Hello world!";
...
j_message_append_n(message, str, strlen(str) + 1);
Parameters
messageA message.
dataData to append.
lengthLength of data.
Returns
TRUE on success, FALSE if an error occurred.

◆ j_message_append_string()

gboolean j_message_append_string ( JMessage message,
gchar const *  str 
)

Appends a string to a message.

gchar* str = "Hello world!";
...
j_message_append_string(message, str);
Parameters
messageA message.
strString to append.
Returns
TRUE on success, FALSE if an error occurred.

◆ j_message_get_1()

gchar j_message_get_1 ( JMessage message)

Gets 1 byte from a message.

Parameters
messageA message.
Returns
A character.

◆ j_message_get_4()

gint32 j_message_get_4 ( JMessage message)

Gets 4 bytes from a message. The bytes are converted from little endian automatically.

Parameters
messageA message.
Returns
A 4-bytes integer.

◆ j_message_get_8()

gint64 j_message_get_8 ( JMessage message)

Gets 8 bytes from a message. The bytes are converted from little endian automatically.

Parameters
messageA message.
Returns
An 8-bytes integer.

◆ j_message_get_count()

guint32 j_message_get_count ( JMessage const *  message)

Returns a message's count.

Parameters
messageA message.
Returns
The message's operation count.

◆ j_message_get_n()

gpointer j_message_get_n ( JMessage message,
gsize  length 
)

Gets n bytes from a message.

Parameters
messageA message.
lengthNumber of bytes to get.
Returns
A pointer to the data.

◆ j_message_get_semantics()

JSemantics * j_message_get_semantics ( JMessage message)

get the semantics of a message.

Parameters
messageA message.
Returns
A semantics object.

◆ j_message_get_string()

gchar const * j_message_get_string ( JMessage message)

Gets a string from a message.

Parameters
messageA message.
Returns
A string.

◆ j_message_get_type()

JMessageType j_message_get_type ( JMessage const *  message)

Returns a message's type.

Parameters
messageA message.
Returns
The message's operation type.

◆ j_message_new()

JMessage * j_message_new ( JMessageType  op_type,
gsize  length 
)

Creates a new message.

Parameters
op_typeAn operation type.
lengthA length.
Returns
A new message. Should be freed with j_message_unref().

◆ j_message_new_reply()

JMessage * j_message_new_reply ( JMessage message)

Creates a new reply message.

Parameters
messageA message.
Returns
A new reply message. Should be freed with j_message_unref().

◆ j_message_read()

gboolean j_message_read ( JMessage message,
GInputStream *  stream 
)

Reads a message from the network.

Parameters
messageA message.
streamA network stream.
Returns
TRUE on success, FALSE if an error occurred.

◆ j_message_receive()

gboolean j_message_receive ( JMessage message,
gpointer  stream 
)

Reads a message from the network.

Parameters
messageA message.
streamA network stream.
Returns
TRUE on success, FALSE if an error occurred.

◆ j_message_ref()

JMessage * j_message_ref ( JMessage message)

Increases a message's reference count.

JMessage * j_message_ref(JMessage *message)
Definition: jmessage.c:346
Definition: jmessage.c:121
Parameters
messageA message.
Returns
message.

◆ j_message_send()

gboolean j_message_send ( JMessage message,
gpointer  stream 
)

Writes a message to the network.

Parameters
messageA message.
streamA network stream.
Returns
TRUE on success, FALSE if an error occurred.

◆ j_message_set_semantics()

void j_message_set_semantics ( JMessage message,
JSemantics semantics 
)

Set the semantics of a message.

Parameters
messageA message.
semanticsA semantics object.

◆ j_message_unref()

void j_message_unref ( JMessage message)

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

Parameters
messageA message.

◆ j_message_write()

gboolean j_message_write ( JMessage message,
GOutputStream *  stream 
)

Writes a message to the network.

Parameters
messageA message.
streamA network stream.
Returns
TRUE on success, FALSE if an error occurred.