22 #include "opensync_internals.h" 79 osync_assert_msg(change->
conv_env,
"The conv env of the change must be set by calling member_set or conv_env_set");
161 g_free(change->
hash);
186 return osync_db_save_change(change, save_format, error);
198 return osync_db_delete_change(change, error);
215 return osync_db_open_changes(group, changes, error);
225 osync_db_close_changes(group);
250 change->
conv_env = member->group->conv_env;
282 change->
objtype = format->objtype;
283 return format->objtype;
286 osync_assert_msg(change->
conv_env,
"The conv env of the change must be set by calling member_set or conv_env_set");
344 osync_assert_msg(change->
conv_env,
"The conv env of the change must be set by calling member_set or conv_env_set");
360 change->
format = objformat;
362 change->
objtype = objformat->objtype;
423 g_free(change->
hash);
424 change->
hash = g_strdup(hash);
450 change->
uid = g_strdup(uid);
594 target->
uid = g_strdup(source->
uid);
595 target->
hash = g_strdup(source->
hash);
void osync_change_update(OSyncChange *source, OSyncChange *target)
Updated one change from another change.
OSyncChangeType osync_change_get_changetype(OSyncChange *change)
Gets the changetype of a change.
char * initial_format_name
void osync_change_set_objformat(OSyncChange *change, OSyncObjFormat *objformat)
Sets the object format of a change.
void osync_change_free(OSyncChange *change)
Frees a change.
void osync_change_set_mappingid(OSyncChange *change, long long int mappingid)
Sets the mappingid of a change.
void osync_change_set_data(OSyncChange *change, char *data, int size, osync_bool has_data)
Sets the data of a change.
int osync_change_get_datasize(OSyncChange *change)
Gets the size of the data of a change.
void osync_changes_close(OSyncGroup *group)
Closes the change database.
void osync_change_ref(OSyncChange *change)
void osync_change_free_data(OSyncChange *change)
Frees the data of a change.
void osync_change_set_uid(OSyncChange *change, const char *uid)
Sets the uid of a change.
OSyncObjFormat * osync_conv_find_objformat(OSyncFormatEnv *env, const char *name)
Finds the object format with the given name.
OSyncObjFormat * osync_change_get_initial_objformat(OSyncChange *change)
long long int osync_change_get_mappingid(OSyncChange *change)
Gets the mappingid of a change.
void osync_change_decref(OSyncChange *change)
Represent a group of members that should be synchronized.
OSyncChange * osync_change_new(void)
Spawns a new change object.
void osync_change_set_engine_data(OSyncChange *change, void *engine_data)
Sets the data of the engine.
OSyncFormatEnv * conv_env
osync_bool osync_changes_load(OSyncGroup *group, OSyncChange ***changes, OSyncError **error)
This will load the changes from the database.
const char * osync_change_get_uid(OSyncChange *change)
Gets the uid of a change.
void osync_error_free(OSyncError **error)
Frees the error so it can be reused.
osync_bool osync_change_has_data(OSyncChange *change)
Returns wether the complete data already has been set.
A member of a group which represent a single device.
OSyncObjFormat * osync_change_get_objformat(OSyncChange *change)
Gets the object format of a change.
osync_bool osync_change_copy_data(OSyncChange *source, OSyncChange *target, OSyncError **error)
Copies the data from one change to another change.
void osync_change_set_changetype(OSyncChange *change, OSyncChangeType type)
Sets the changetype of a change.
OSyncObjType * osync_conv_find_objtype(OSyncFormatEnv *env, const char *name)
Finds the object type with the given name.
const char * osync_change_get_hash(OSyncChange *change)
Gets the hash of a change.
void osync_debug(const char *subpart, int level, const char *message,...)
Used for debugging.
long long int osync_change_get_id(OSyncChange *change)
Gets the id of the change which is always unique.
void osync_change_set_conv_env(OSyncChange *change, OSyncFormatEnv *env)
Sets the conversion environment of a change.
void osync_change_set_objformat_string(OSyncChange *change, const char *name)
Sets the object format of a change from the name.
OSyncMember * osync_change_get_member(OSyncChange *change)
Gets the member which reported a change.
void osync_change_reset(OSyncChange *change)
Resets a change.
void osync_change_set_hash(OSyncChange *change, const char *hash)
Sets the hash of a change that is used to decide wether a change is new, modifed etc.
void osync_change_set_objtype(OSyncChange *change, OSyncObjType *type)
Sets the object type of a change.
void osync_change_set_member(OSyncChange *change, OSyncMember *member)
Sets the member of a change.
const char * osync_change_get_sourceobjtype(OSyncChange *change)
const char * osync_error_print(OSyncError **error)
Returns the message of the error.
void osync_trace(OSyncTraceType type, const char *message,...)
Used for tracing the application.
OSyncObjType * osync_change_get_objtype(OSyncChange *change)
Gets the object type of a change.
Represent a abstract object type (like "contact")
OSyncObjFormat * initial_format
osync_bool osync_change_delete(OSyncChange *change, OSyncError **error)
This will delete a change from the database.
void osync_change_set_objtype_string(OSyncChange *change, const char *name)
Sets the object type of a change from the name.
OSyncChangeType
The changetypes of a change object.
void * osync_change_get_engine_data(OSyncChange *change)
Gets data that can be used privately by the engine.
OSyncChangeType changetype
char * osync_change_get_data(OSyncChange *change)
Gets the data of a change.
osync_bool osync_change_save(OSyncChange *change, osync_bool save_format, OSyncError **error)
This will save a change into the database.