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

Go to the source code of this file.

Typedefs

typedef struct JDBSchemaIndex JDBSchemaIndex
 
typedef struct JDBSchema JDBSchema
 

Functions

G_END_DECLS G_BEGIN_DECLS JDBSchemaj_db_schema_new (gchar const *namespace_, gchar const *name, GError **error)
 
JDBSchemaj_db_schema_ref (JDBSchema *schema)
 
void j_db_schema_unref (JDBSchema *schema)
 
gboolean j_db_schema_add_field (JDBSchema *schema, gchar const *name, JDBType type, GError **error)
 
gboolean j_db_schema_get_field (JDBSchema *schema, gchar const *name, JDBType *type, GError **error)
 
guint32 j_db_schema_get_all_fields (JDBSchema *schema, gchar ***names, JDBType **types, GError **error)
 
gboolean j_db_schema_add_index (JDBSchema *schema, gchar const **names, GError **error)
 
gboolean j_db_schema_create (JDBSchema *schema, JBatch *batch, GError **error)
 
gboolean j_db_schema_get (JDBSchema *schema, JBatch *batch, GError **error)
 
gboolean j_db_schema_delete (JDBSchema *schema, JBatch *batch, GError **error)
 
gboolean j_db_schema_equals (JDBSchema *schema1, JDBSchema *schema2, gboolean *equal, GError **error)
 

Typedef Documentation

◆ JDBSchema

typedef struct JDBSchema JDBSchema

◆ JDBSchemaIndex

Function Documentation

◆ j_db_schema_add_field()

gboolean j_db_schema_add_field ( JDBSchema schema,
gchar const *  name,
JDBType  type,
GError **  error 
)

Add a field to the schema.

Parameters
[in]schemathe schema to add a field to
[in]namethe name of the variable to add
[in]typethe type of the variable to add
[out]errorA GError pointer. Will point to a GError object in case of failure.
Precondition
schema != NULL
name != NULL
schema does not contain a variable with the given name
Returns
TRUE on success, FALSE otherwise

◆ j_db_schema_add_index()

gboolean j_db_schema_add_index ( JDBSchema schema,
gchar const **  names,
GError **  error 
)

adds an index to the given schema.

Parameters
[in]schemathe schema to add a index to
[in]namesthe names of the variables to put into an index group
[out]errorA GError pointer. Will point to a GError object in case of failure.
Precondition
schema != NULL
names != NULL
names is a zero-terminated array of char
each **names is an previously defined variable-name
Postcondition
*names could be freed - or modified imediately by the caller
Returns
TRUE on success, FALSE otherwise

◆ j_db_schema_create()

gboolean j_db_schema_create ( JDBSchema schema,
JBatch batch,
GError **  error 
)

stores a schema in the backend.

Parameters
[in]schemathe schema to store
[in]batchthe batch to add this operation to
[out]errorA GError pointer. Will point to a GError object in case of failure.
Precondition
schema != NULL
schema contains at least 1 variable
batch != NULL
Returns
TRUE on success, FALSE otherwise

◆ j_db_schema_delete()

gboolean j_db_schema_delete ( JDBSchema schema,
JBatch batch,
GError **  error 
)

deletes a schema structure from the backend.

Parameters
[in]schemathe schema to delete
[in]batchthe batch to add this operation to
[out]errorA GError pointer. Will point to a GError object in case of failure.
Precondition
schema != NULL
schema exists in the backend
batch != NULL
Returns
TRUE on success, FALSE otherwise

◆ j_db_schema_equals()

gboolean j_db_schema_equals ( JDBSchema schema1,
JDBSchema schema2,
gboolean *  equal,
GError **  error 
)

compares two schema with each other.

Parameters
[in]schema1
[in]schema2the schema to compare with each other
[out]equalTRUE if schema1 and schema2 equals
[out]errorA GError pointer. Will point to a GError object in case of failure.
Precondition
schema1 != NULL
schema2 != NULL
equal != NULL
Returns
TRUE on success, FALSE otherwise

◆ j_db_schema_get()

gboolean j_db_schema_get ( JDBSchema schema,
JBatch batch,
GError **  error 
)

querys a schema structure from the backend.

Parameters
[in]schemathe schema to query
[in]batchthe batch to add this operation to
[out]errorA GError pointer. Will point to a GError object in case of failure.
Precondition
schema != NULL
schema exists in the backend
batch != NULL
Returns
TRUE on success, FALSE otherwise

◆ j_db_schema_get_all_fields()

guint32 j_db_schema_get_all_fields ( JDBSchema schema,
gchar ***  names,
JDBType **  types,
GError **  error 
)

query all variables from the schema.

Parameters
[in]schemathe schema to query
[out]namesthe names of all variables in the schema
[out]typesthe types of all variables in the schema
[out]errorA GError pointer. Will point to a GError object in case of failure.
Precondition
schema != NULL
names != NULL
*names is not initialized
types != NULL
*types is not initialized
Postcondition
names is an initialized array of char. The array must be freed by the caller.
*types is an initialized array of JDBType. The array has the same length as *names.
Returns
Number of variables on success, 0 otherwise

◆ j_db_schema_get_field()

gboolean j_db_schema_get_field ( JDBSchema schema,
gchar const *  name,
JDBType type,
GError **  error 
)

query a variable from the schema.

Parameters
[in]schemathe schema to query
[in]namethe name of the variable to query
[out]typethe type of the queried variable
[out]errorA GError pointer. Will point to a GError object in case of failure.
Precondition
schema != NULL
name != NULL
type != NULL
schema contains a variable of the given type
Returns
TRUE on success, FALSE otherwise

◆ j_db_schema_new()

G_END_DECLS G_BEGIN_DECLS JDBSchema* j_db_schema_new ( gchar const *  namespace_,
gchar const *  name,
GError **  error 
)

Allocates a new schema.

Parameters
[in]namespace_the namespace of the schema
[in]namethe name of the schema
[out]errorA GError pointer. Will point to a GError object in case of failure.
Precondition
namespace != NULL
name != NULL
Returns
the new schema or NULL on failure
Todo:
since schema->bson is used as the out_param in j_db_internal_schema_get, the schema passed to the backend's schema_get is initialized if and only if the backend runs on the client

◆ j_db_schema_ref()

JDBSchema* j_db_schema_ref ( JDBSchema schema)

Increase the ref_count of the given schema.

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

◆ j_db_schema_unref()

void j_db_schema_unref ( JDBSchema schema)

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

Parameters
[in]schemathe schema to decrease the ref_count