OpenSync  0.22
Enumerations | Functions
OpenSync Change Commands

High level functions to manipulate changes. More...

Enumerations

enum  OSyncConvCmpResult { CONV_DATA_UNKNOWN = 0, CONV_DATA_MISMATCH = 1, CONV_DATA_SIMILAR = 2, CONV_DATA_SAME = 3 }
 The possible returns of a change comparison. More...
 

Functions

char * osync_change_get_printable (OSyncChange *change)
 Returns a string describing a change object. More...
 
time_t osync_change_get_revision (OSyncChange *change, OSyncError **error)
 Returns the revision of the object. More...
 
OSyncConvCmpResult osync_change_compare_data (OSyncChange *leftchange, OSyncChange *rightchange)
 Compares the data of 2 changes. More...
 
OSyncConvCmpResult osync_change_compare (OSyncChange *leftchange, OSyncChange *rightchange)
 Compares 2 changes. More...
 
osync_bool osync_change_copy_data (OSyncChange *source, OSyncChange *target, OSyncError **error)
 Copies the data from one change to another change. More...
 
OSyncChangeosync_change_copy (OSyncChange *source, OSyncError **error)
 Makes a exact copy of change. More...
 
osync_bool osync_change_duplicate (OSyncChange *change)
 Duplicates the uid of the change. More...
 
osync_bool osync_change_convert_extension (OSyncFormatEnv *env, OSyncChange *change, OSyncObjFormat *targetformat, const char *extension_name, OSyncError **error)
 Convert a change to a specific format with a specific extension. More...
 
osync_bool osync_change_convert (OSyncFormatEnv *env, OSyncChange *change, OSyncObjFormat *targetformat, OSyncError **error)
 Convert a change to a specific format. More...
 
osync_bool osync_change_convert_to_common (OSyncChange *change, OSyncError **error)
 Convert a change to the specified common format. More...
 
osync_bool osync_change_convert_fmtname (OSyncFormatEnv *env, OSyncChange *change, const char *targetname, OSyncError **error)
 Convert a change to a specific format with the given name. More...
 
osync_bool osync_change_convert_fmtnames (OSyncFormatEnv *env, OSyncChange *change, const char **targetnames, OSyncError **error)
 Convert a change to some formats. More...
 
osync_bool osync_change_convert_member_sink (OSyncFormatEnv *env, OSyncChange *change, OSyncMember *member, OSyncError **error)
 Convert a change to the nearest sink on a member. More...
 
OSyncObjTypeosync_change_detect_objtype (OSyncFormatEnv *env, OSyncChange *change, OSyncError **error)
 Tries to detect the object type of the given change. More...
 
OSyncObjTypeosync_change_detect_objtype_full (OSyncFormatEnv *env, OSyncChange *change, OSyncError **error)
 Tries to detect the encapsulated object type of the given change. More...
 
OSyncObjFormatosync_change_detect_objformat (OSyncFormatEnv *env, OSyncChange *change, OSyncError **error)
 Tries to detect the format of the given change. More...
 
OSyncObjFormatosync_change_detect_objformat_full (OSyncFormatEnv *env, OSyncChange *change, OSyncError **error)
 Tries to detect the encapsulated format of the given change. More...
 

Detailed Description

High level functions to manipulate changes.

Enumeration Type Documentation

The possible returns of a change comparison.

Enumerator
CONV_DATA_UNKNOWN 

The result is unknown, there was a error

CONV_DATA_MISMATCH 

The changes are not the same

CONV_DATA_SIMILAR 

The changs are not the same but look similar

CONV_DATA_SAME 

The changes are exactly the same

Definition at line 16 of file opensync_convert.h.

Function Documentation

char* osync_change_get_printable ( OSyncChange change)

Returns a string describing a change object.

Some formats cannot be printed directly. To be able to print these objects they should specify a print function.

Parameters
changeThe change to get printable
Returns
A string describing the object

Definition at line 97 of file opensync_changecmds.c.

time_t osync_change_get_revision ( OSyncChange change,
OSyncError **  error 
)

Returns the revision of the object.

Parameters
changeThe change to get the revision from
errorA error struct
Returns
The revision of the object in seconds since the epoch in zulu time

Definition at line 119 of file opensync_changecmds.c.

Referenced by osengine_mapping_check_timestamps(), and osengine_mapping_solve_latest().

OSyncConvCmpResult osync_change_compare_data ( OSyncChange leftchange,
OSyncChange rightchange 
)

Compares the data of 2 changes.

Compares the two given changes and returns: CONV_DATA_MISMATCH if they are not the same CONV_DATA_SIMILAR if the are not the same but look similar CONV_DATA_SAME if they are exactly the same

Parameters
leftchangeThe left change to compare
rightchangeThe right change to compare
Returns
The result of the comparison

Definition at line 157 of file opensync_changecmds.c.

Referenced by osync_change_compare().

OSyncConvCmpResult osync_change_compare ( OSyncChange leftchange,
OSyncChange rightchange 
)

Compares 2 changes.

Compares the two given changes and returns: CONV_DATA_MISMATCH if they are not the same CONV_DATA_SIMILAR if the are not the same but look similar CONV_DATA_SAME if they are exactly the same This function does also compare changetypes etc unlike osync_change_compare_data()

Parameters
leftchangeThe left change to compare
rightchangeThe right change to compare
Returns
The result of the comparison

Definition at line 217 of file opensync_changecmds.c.

osync_bool osync_change_copy_data ( OSyncChange source,
OSyncChange target,
OSyncError **  error 
)

Copies the data from one change to another change.

Parameters
sourceThe change to copy from
targetThe change to copy to
errorA error struct
Returns
TRUE if the copy was successfull

Definition at line 256 of file opensync_changecmds.c.

Referenced by osync_change_copy(), and osync_change_update().

OSyncChange* osync_change_copy ( OSyncChange source,
OSyncError **  error 
)

Makes a exact copy of change.

Parameters
sourceThe change to copy from
errorA error struct
Returns
A new change that is the copy, NULL on error

Definition at line 302 of file opensync_changecmds.c.

osync_bool osync_change_duplicate ( OSyncChange change)

Duplicates the uid of the change.

This will call the duplicate function of a format. This is used if a uid is not unique.

Parameters
changeThe change to duplicate
Returns
TRUE if the uid was duplicated successfull

Definition at line 338 of file opensync_changecmds.c.

osync_bool osync_change_convert_extension ( OSyncFormatEnv env,
OSyncChange change,
OSyncObjFormat targetformat,
const char *  extension_name,
OSyncError **  error 
)

Convert a change to a specific format with a specific extension.

This will convert the change with its data to the specified format if possible. And this will also convert the data to the specified format extension.

Parameters
envThe conversion environment to use
changeThe change to convert
targetformatTo which format you want to convert to
extension_nameThe name of the extension
errorThe error-return location
Returns
TRUE on success, FALSE otherwise

Definition at line 363 of file opensync_changecmds.c.

Referenced by osync_change_convert().

osync_bool osync_change_convert ( OSyncFormatEnv env,
OSyncChange change,
OSyncObjFormat targetformat,
OSyncError **  error 
)

Convert a change to a specific format.

This will convert the change with its data to the specified format if possible.

Parameters
envThe conversion environment to use
changeThe change to convert
targetformatTo which format you want to convert to
errorThe error-return location
Returns
TRUE on success, FALSE otherwise

Definition at line 387 of file opensync_changecmds.c.

Referenced by osync_change_convert_to_common(), and osync_member_make_random_data().

osync_bool osync_change_convert_to_common ( OSyncChange change,
OSyncError **  error 
)

Convert a change to the specified common format.

Parameters
changeThe change to convert
errorThe error-return location
Returns
TRUE on success, FALSE otherwise

Definition at line 399 of file opensync_changecmds.c.

Referenced by _new_change_receiver(), osync_change_compare(), and osync_change_compare_data().

osync_bool osync_change_convert_fmtname ( OSyncFormatEnv env,
OSyncChange change,
const char *  targetname,
OSyncError **  error 
)

Convert a change to a specific format with the given name.

This will convert the change with its data to the specified format if possible.

Parameters
envThe conversion environment to use
changeThe change to convert
targetnameTo which format you want to convert to
errorThe error-return location
Returns
TRUE on success, FALSE otherwise

Definition at line 438 of file opensync_changecmds.c.

osync_bool osync_change_convert_fmtnames ( OSyncFormatEnv env,
OSyncChange change,
const char **  targetnames,
OSyncError **  error 
)

Convert a change to some formats.

This will convert the change with its data to one of the specified formats if possible.

Parameters
envThe conversion environment to use
changeThe change to convert
targetnamesNULL-Terminated array of formatnames
errorThe error-return location
Returns
TRUE on success, FALSE otherwise

Definition at line 455 of file opensync_changecmds.c.

osync_bool osync_change_convert_member_sink ( OSyncFormatEnv env,
OSyncChange change,
OSyncMember member,
OSyncError **  error 
)

Convert a change to the nearest sink on a member.

Parameters
envThe conversion environment to use
changeThe change to convert
memberThe member that will receive the change
errorThe error-return location
Returns
TRUE on success, FALSE otherwise

Definition at line 470 of file opensync_changecmds.c.

OSyncObjType* osync_change_detect_objtype ( OSyncFormatEnv env,
OSyncChange change,
OSyncError **  error 
)

Tries to detect the object type of the given change.

This will try to detect the object type of the data on the change and return it, but not set it.

Parameters
envThe conversion environment to use
changeThe change to detect
errorThe error-return location
Returns
The objecttype on success, NULL otherwise

Definition at line 489 of file opensync_changecmds.c.

OSyncObjType* osync_change_detect_objtype_full ( OSyncFormatEnv env,
OSyncChange change,
OSyncError **  error 
)

Tries to detect the encapsulated object type of the given change.

This will try to detect the encapsulated object type of the data on the change and return it, but not set it. This will try to detect the change, deencapsulate it, detect again etc until it cannot deencapsulate further.

Parameters
envThe conversion environment to use
changeThe change to detect
errorThe error-return location
Returns
The objecttype on success, NULL otherwise

Definition at line 509 of file opensync_changecmds.c.

Referenced by _new_change_receiver().

OSyncObjFormat* osync_change_detect_objformat ( OSyncFormatEnv env,
OSyncChange change,
OSyncError **  error 
)

Tries to detect the format of the given change.

This will try to detect the format of the data on the change and return it, but not set it.

Parameters
envThe conversion environment to use
changeThe change to detect
errorThe error-return location
Returns
The format on success, NULL otherwise

Definition at line 528 of file opensync_changecmds.c.

Referenced by osync_change_detect_objformat_full(), and osync_change_detect_objtype().

OSyncObjFormat* osync_change_detect_objformat_full ( OSyncFormatEnv env,
OSyncChange change,
OSyncError **  error 
)

Tries to detect the encapsulated format of the given change.

This will try to detect the encapsulated format of the data on the change and return it, but not set it. This will try to detect the change, deencapsulate it, detect again etc until it cannot deencapsulate further.

Parameters
envThe conversion environment to use
changeThe change to detect
errorThe error-return location
Returns
The format on success, NULL otherwise

Definition at line 567 of file opensync_changecmds.c.

Referenced by osync_change_detect_objtype_full().