JULEA
Typedefs | Functions
jdb-entry.h File Reference
#include <glib.h>
#include <julea.h>
#include <db/jdb-schema.h>
#include <db/jdb-selector.h>

Go to the source code of this file.

Typedefs

typedef struct JDBEntry JDBEntry
 

Functions

G_END_DECLS G_BEGIN_DECLS JDBEntryj_db_entry_new (JDBSchema *schema, GError **error)
 
JDBEntryj_db_entry_ref (JDBEntry *entry)
 
void j_db_entry_unref (JDBEntry *entry)
 
gboolean j_db_entry_get_id (JDBEntry *entry, gpointer *value, guint64 *length, GError **error)
 
gboolean j_db_entry_set_field (JDBEntry *entry, gchar const *name, gconstpointer value, guint64 length, GError **error)
 
gboolean j_db_entry_insert (JDBEntry *entry, JBatch *batch, GError **error)
 
gboolean j_db_entry_update (JDBEntry *entry, JDBSelector *selector, JBatch *batch, GError **error)
 
gboolean j_db_entry_delete (JDBEntry *entry, JDBSelector *selector, JBatch *batch, GError **error)
 

Typedef Documentation

◆ JDBEntry

typedef struct JDBEntry JDBEntry

Function Documentation

◆ j_db_entry_delete()

gboolean j_db_entry_delete ( JDBEntry entry,
JDBSelector selector,
JBatch batch,
GError **  error 
)

Delete the entry from the backend.

The entry must not be modified until the batch is executed. The selector must not be modified until the batch is executed.

Parameters
[in]entryspecifies the schema to use
[in]selectorthe selector defines what should be deleted
[in]batchthe batch to append this operation to
[out]errorA GError pointer. Will point to a GError object in case of failure.
Precondition
entry != NULL
batch != NULL
Returns
TRUE on success, FALSE otherwise

◆ j_db_entry_get_id()

gboolean j_db_entry_get_id ( JDBEntry entry,
gpointer *  value,
guint64 *  length,
GError **  error 
)

returns the id of the entry, after j_db_entry_insert has been called

Parameters
[in]entryA JDBEntry.
[out]valueThe id of entry. Should be freed using g_free().
[out]lengthThe length of the id in byte.
[out]errorA GError pointer. Will point to a GError object in case of failure.
Returns
TRUE on success, FALSE otherwise

◆ j_db_entry_insert()

gboolean j_db_entry_insert ( JDBEntry entry,
JBatch batch,
GError **  error 
)

Save the entry in the backend. All variables defined in the schema, which are not explicitily set, are initialized to NULL.

The entry must not be modified until the batch is executed.

Parameters
[in]entrythe entry to save
[in]batchthe batch to append this operation to
[out]errorA GError pointer. Will point to a GError object in case of failure.
Precondition
entry != NULL
entry has a least 1 value set to not NULL
batch != NULL
Returns
TRUE on success, FALSE otherwise

◆ j_db_entry_new()

G_END_DECLS G_BEGIN_DECLS JDBEntry* j_db_entry_new ( JDBSchema schema,
GError **  error 
)

Allocates a new entry.

Parameters
[in]schemaThe schema defines the structure of the entity
[out]errorA GError pointer. Will point to a GError object in case of failure.
Precondition
schema != NULL
schema is initialized
Returns
the new entry or NULL on failure

◆ j_db_entry_ref()

JDBEntry* j_db_entry_ref ( JDBEntry entry)

Increase the ref_count of the given entry.

Parameters
[in]entrythe entry to increase the ref_count
Precondition
entry != NULL
Returns
the entry or NULL on failure

◆ j_db_entry_set_field()

gboolean j_db_entry_set_field ( JDBEntry entry,
gchar const *  name,
gconstpointer  value,
guint64  length,
GError **  error 
)

Set a field in the given entry

Parameters
[in]entrythe entry to set a value
[in]namethe name to set a value
[in]valuethe value to set
[in]lengththe length of the value. Only used if the value-type defined in the Schema is binary.
[out]errorA GError pointer. Will point to a GError object in case of failure.
Precondition
entry != NULL
name != NULL
value != NULL
Returns
TRUE on success, FALSE otherwise

◆ j_db_entry_unref()

void j_db_entry_unref ( JDBEntry entry)

Decrease the ref_count of the given entry - and automatically call free if ref_count is 0. This is a noop if entry == NULL.

Parameters
[in]entrythe entry to decrease the ref_count

◆ j_db_entry_update()

gboolean j_db_entry_update ( JDBEntry entry,
JDBSelector selector,
JBatch batch,
GError **  error 
)

Replayes all entrys attributes with the given entrys attributes in the backend where the selector matches.

The entry must not be modified until the batch is executed. The selector must not be modified until the batch is executed.

Parameters
[in]entrythe entry defining the final values of all matched entrys
[in]selectorthe selector defines which entrys should be modifies
[in]batchthe batch to append this operation to
[out]errorA GError pointer. Will point to a GError object in case of failure.
Precondition
entry != NULL
entry has a least 1 value set to not NULL
selector != NULL
selector matches at least 1 entry
batch != NULL
Returns
TRUE on success, FALSE otherwise