OpenSync  0.22
Enumerations | Functions
OpenSync Change

The public API of the OSyncChange. More...

Enumerations

enum  OSyncChangeType {
  CHANGE_UNKNOWN = 0, CHANGE_ADDED = 1, CHANGE_UNMODIFIED = 2, CHANGE_DELETED = 3,
  CHANGE_MODIFIED = 4
}
 The changetypes of a change object. More...
 

Functions

OSyncChangeosync_change_new (void)
 Spawns a new change object. More...
 
void osync_change_free (OSyncChange *change)
 Frees a change. More...
 
void osync_change_free_data (OSyncChange *change)
 Frees the data of a change. More...
 
void osync_change_reset (OSyncChange *change)
 Resets a change. More...
 
osync_bool osync_change_save (OSyncChange *change, osync_bool save_format, OSyncError **error)
 This will save a change into the database. More...
 
osync_bool osync_change_delete (OSyncChange *change, OSyncError **error)
 This will delete a change from the database. More...
 
osync_bool osync_changes_load (OSyncGroup *group, OSyncChange ***changes, OSyncError **error)
 This will load the changes from the database. More...
 
void osync_changes_close (OSyncGroup *group)
 Closes the change database. More...
 
OSyncMemberosync_change_get_member (OSyncChange *change)
 Gets the member which reported a change. More...
 
void osync_change_set_member (OSyncChange *change, OSyncMember *member)
 Sets the member of a change. More...
 
void osync_change_set_conv_env (OSyncChange *change, OSyncFormatEnv *env)
 Sets the conversion environment of a change. More...
 
OSyncObjTypeosync_change_get_objtype (OSyncChange *change)
 Gets the object type of a change. More...
 
void osync_change_set_objtype (OSyncChange *change, OSyncObjType *type)
 Sets the object type of a change. More...
 
void osync_change_set_objtype_string (OSyncChange *change, const char *name)
 Sets the object type of a change from the name. More...
 
OSyncObjFormatosync_change_get_objformat (OSyncChange *change)
 Gets the object format of a change. More...
 
void osync_change_set_objformat (OSyncChange *change, OSyncObjFormat *objformat)
 Sets the object format of a change. More...
 
void osync_change_set_objformat_string (OSyncChange *change, const char *name)
 Sets the object format of a change from the name. More...
 
OSyncChangeType osync_change_get_changetype (OSyncChange *change)
 Gets the changetype of a change. More...
 
void osync_change_set_changetype (OSyncChange *change, OSyncChangeType type)
 Sets the changetype of a change. More...
 
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. More...
 
const char * osync_change_get_hash (OSyncChange *change)
 Gets the hash of a change. More...
 
void osync_change_set_uid (OSyncChange *change, const char *uid)
 Sets the uid of a change. More...
 
const char * osync_change_get_uid (OSyncChange *change)
 Gets the uid of a change. More...
 
void osync_change_set_data (OSyncChange *change, char *data, int size, osync_bool has_data)
 Sets the data of a change. More...
 
osync_bool osync_change_has_data (OSyncChange *change)
 Returns wether the complete data already has been set. More...
 
char * osync_change_get_data (OSyncChange *change)
 Gets the data of a change. More...
 
int osync_change_get_datasize (OSyncChange *change)
 Gets the size of the data of a change. More...
 
long long int osync_change_get_mappingid (OSyncChange *change)
 Gets the mappingid of a change. More...
 
void osync_change_set_mappingid (OSyncChange *change, long long int mappingid)
 Sets the mappingid of a change. More...
 
void * osync_change_get_engine_data (OSyncChange *change)
 Gets data that can be used privately by the engine. More...
 
void osync_change_set_engine_data (OSyncChange *change, void *engine_data)
 Sets the data of the engine. More...
 
long long int osync_change_get_id (OSyncChange *change)
 Gets the id of the change which is always unique. More...
 
void osync_change_update (OSyncChange *source, OSyncChange *target)
 Updated one change from another change. More...
 

Detailed Description

The public API of the OSyncChange.

Enumeration Type Documentation

The changetypes of a change object.

Enumerator
CHANGE_UNKNOWN 

Unknown changetype

CHANGE_ADDED 

Object was added

CHANGE_UNMODIFIED 

Object is unmodifed

CHANGE_DELETED 

Object is deleted

CHANGE_MODIFIED 

Object has been modified

Definition at line 28 of file opensync.h.

Function Documentation

OSyncChange* osync_change_new ( void  )

Spawns a new change object.

Returns
Newly allocated change object

Definition at line 99 of file opensync_change.c.

Referenced by osync_change_copy(), osync_hashtable_report_deleted(), and osync_member_add_random_data().

void osync_change_free ( OSyncChange change)

Frees a change.

Parameters
changeThe change to free

Definition at line 115 of file opensync_change.c.

Referenced by osync_change_copy(), and osync_change_decref().

void osync_change_free_data ( OSyncChange change)

Frees the data of a change.

This frees the data of a change but does not free the change itself

Parameters
changeThe change of which to free the data

Definition at line 134 of file opensync_change.c.

Referenced by osync_change_copy_data().

void osync_change_reset ( OSyncChange change)

Resets a change.

Resets the information about changetype, hash, data etc.

Parameters
changeThe change to reset

Definition at line 156 of file opensync_change.c.

osync_bool osync_change_save ( OSyncChange change,
osync_bool  save_format,
OSyncError **  error 
)

This will save a change into the database.

Parameters
changeThe change to save
save_formatWether to save the format or not.
errorA pointer to a error struct
Returns
TRUE if save was successfull, FALSE otherwise

Definition at line 182 of file opensync_change.c.

Referenced by _new_change_receiver(), and osengine_mapping_duplicate().

osync_bool osync_change_delete ( OSyncChange change,
OSyncError **  error 
)

This will delete a change from the database.

Parameters
changeThe change to delete
errorA pointer to a error struct
Returns
TRUE if deletion was successfull, FALSE otherwise

Definition at line 196 of file opensync_change.c.

Referenced by osengine_mapping_duplicate().

osync_bool osync_changes_load ( OSyncGroup group,
OSyncChange ***  changes,
OSyncError **  error 
)

This will load the changes from the database.

This opens the change database and returns an array with the changes. The changes have to be freed later. The database has to be closed with a call to osync_changes_close()

Parameters
groupThe group for which to load the changes
changesAn pointer to an array in which to store the changes
errorA pointer to a error struct
Returns
TRUE if load was successfull, FALSE otherwise

Definition at line 213 of file opensync_change.c.

void osync_changes_close ( OSyncGroup group)

Closes the change database.

Parameters
groupThe group for which to close the database

Definition at line 223 of file opensync_change.c.

OSyncMember* osync_change_get_member ( OSyncChange change)

Gets the member which reported a change.

Parameters
changeThe change
Returns
The member of the change

Definition at line 234 of file opensync_change.c.

Referenced by osengine_mapping_ignore_supported().

void osync_change_set_member ( OSyncChange change,
OSyncMember member 
)

Sets the member of a change.

Parameters
changeThe change
memberThe member of the change

Definition at line 246 of file opensync_change.c.

Referenced by _new_change_receiver().

void osync_change_set_conv_env ( OSyncChange change,
OSyncFormatEnv env 
)

Sets the conversion environment of a change.

Parameters
changeThe change
envThe conversion environment

Definition at line 259 of file opensync_change.c.

OSyncObjType* osync_change_get_objtype ( OSyncChange change)
void osync_change_set_objtype ( OSyncChange change,
OSyncObjType type 
)

Sets the object type of a change.

Parameters
changeThe change
typeThe object type

Definition at line 297 of file opensync_change.c.

Referenced by _new_change_receiver(), and osync_member_make_random_data().

void osync_change_set_objtype_string ( OSyncChange change,
const char *  name 
)

Sets the object type of a change from the name.

Parameters
changeThe change
nameThe object type name

Definition at line 309 of file opensync_change.c.

Referenced by osync_hashtable_report_deleted().

OSyncObjFormat* osync_change_get_objformat ( OSyncChange change)
void osync_change_set_objformat ( OSyncChange change,
OSyncObjFormat objformat 
)

Sets the object format of a change.

Parameters
changeThe change
objformatThe object format

Definition at line 357 of file opensync_change.c.

Referenced by osync_member_make_random_data().

void osync_change_set_objformat_string ( OSyncChange change,
const char *  name 
)

Sets the object format of a change from the name.

Parameters
changeThe change
nameThe object format name

Definition at line 373 of file opensync_change.c.

OSyncChangeType osync_change_get_changetype ( OSyncChange change)

Gets the changetype of a change.

Parameters
changeThe change
Returns
The changetype

Definition at line 393 of file opensync_change.c.

Referenced by _new_change_receiver(), osengine_mapping_check_timestamps(), osengine_mapping_duplicate(), osengine_mapping_ignore_conflict(), osengine_mapping_solve_latest(), and osync_hashtable_update_hash().

void osync_change_set_changetype ( OSyncChange change,
OSyncChangeType  type 
)

Sets the changetype of a change.

Parameters
changeThe change
typeThe changetype to set

Definition at line 407 of file opensync_change.c.

Referenced by _new_change_receiver(), and osengine_mapping_duplicate().

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.

Parameters
changeThe change
hashThe hash to set

Definition at line 419 of file opensync_change.c.

Referenced by osync_hashtable_get_hash().

const char* osync_change_get_hash ( OSyncChange change)

Gets the hash of a change.

Parameters
changeThe change
Returns
The hash

Definition at line 433 of file opensync_change.c.

void osync_change_set_uid ( OSyncChange change,
const char *  uid 
)

Sets the uid of a change.

Parameters
changeThe change
uidThe uid to set

Definition at line 445 of file opensync_change.c.

Referenced by osync_hashtable_report_deleted(), and osync_member_modify_random_data().

const char* osync_change_get_uid ( OSyncChange change)

Gets the uid of a change.

Parameters
changeThe change
Returns
The uid

Definition at line 459 of file opensync_change.c.

Referenced by _new_change_receiver(), and osync_member_modify_random_data().

void osync_change_set_data ( OSyncChange change,
char *  data,
int  size,
osync_bool  has_data 
)

Sets the data of a change.

Parameters
changeThe change
dataThe data to set
sizeThe size of the data to set
has_dataSet this to TRUE of this already is the complete data

Definition at line 473 of file opensync_change.c.

osync_bool osync_change_has_data ( OSyncChange change)

Returns wether the complete data already has been set.

Parameters
changeThe change
Returns
TRUE if the change has the complete data set

Definition at line 486 of file opensync_change.c.

Referenced by _new_change_receiver().

char* osync_change_get_data ( OSyncChange change)

Gets the data of a change.

Parameters
changeThe change
Returns
The data

Definition at line 498 of file opensync_change.c.

Referenced by _new_change_receiver().

int osync_change_get_datasize ( OSyncChange change)

Gets the size of the data of a change.

Parameters
changeThe change
Returns
The size of the data

Definition at line 510 of file opensync_change.c.

Referenced by _new_change_receiver().

long long int osync_change_get_mappingid ( OSyncChange change)

Gets the mappingid of a change.

Parameters
changeThe change
Returns
The mappingid of the data

Definition at line 522 of file opensync_change.c.

void osync_change_set_mappingid ( OSyncChange change,
long long int  mappingid 
)

Sets the mappingid of a change.

Parameters
changeThe change
mappingidThe mappingid to set

Definition at line 534 of file opensync_change.c.

void* osync_change_get_engine_data ( OSyncChange change)

Gets data that can be used privately by the engine.

Parameters
changeThe change
Returns
The data of the engine

Definition at line 546 of file opensync_change.c.

void osync_change_set_engine_data ( OSyncChange change,
void *  engine_data 
)

Sets the data of the engine.

Parameters
changeThe change
engine_dataThe data

Definition at line 558 of file opensync_change.c.

long long int osync_change_get_id ( OSyncChange change)

Gets the id of the change which is always unique.

Parameters
changeThe change
Returns
The id

Definition at line 570 of file opensync_change.c.

void osync_change_update ( OSyncChange source,
OSyncChange target 
)

Updated one change from another change.

This function can be used to "merge" the information from 2 changes into one. The uid, hash, data of the target change are overwriten by those of the source change if they are not set already on the target. The data of the source change is copied.

Parameters
sourceThe source change
targetThe target change

Definition at line 587 of file opensync_change.c.