OpenSync Group
[OpenSync Group Module]

A groups represent several device or application that should be synchronized. More...


Enumerations

enum  OSyncLockState { OSYNC_LOCK_OK, OSYNC_LOCKED, OSYNC_LOCK_STALE }
 The lock state of a group.
enum  OSyncConflictResolution {
  OSYNC_CONFLICT_RESOLUTION_UNKNOWN, OSYNC_CONFLICT_RESOLUTION_DUPLICATE, OSYNC_CONFLICT_RESOLUTION_IGNORE, OSYNC_CONFLICT_RESOLUTION_NEWER,
  OSYNC_CONFLICT_RESOLUTION_SELECT
}

Functions

OSYNC_EXPORT OSyncGrouposync_group_new (OSyncError **error)
 Creates a new group for the given environment.
OSYNC_EXPORT OSyncGrouposync_group_ref (OSyncGroup *group)
 Increase the reference count of the group.
OSYNC_EXPORT void osync_group_unref (OSyncGroup *group)
 Decrease the reference count of the group.
OSYNC_EXPORT OSyncLockState osync_group_lock (OSyncGroup *group)
 Locks a group.
OSYNC_EXPORT void osync_group_unlock (OSyncGroup *group)
 Unlocks a group.
OSYNC_EXPORT void osync_group_set_name (OSyncGroup *group, const char *name)
 Sets the name for the group.
OSYNC_EXPORT const char * osync_group_get_name (OSyncGroup *group)
 Returns the name of a group.
OSYNC_EXPORT osync_bool osync_group_save (OSyncGroup *group, OSyncError **error)
 Saves the group to disc.
OSYNC_EXPORT osync_bool osync_group_delete (OSyncGroup *group, OSyncError **error)
 Deletes a group from disc.
OSYNC_EXPORT osync_bool osync_group_reset (OSyncGroup *group, OSyncError **error)
 Reset all databases of a group (anchor, hashtable and archive).
OSYNC_EXPORT osync_bool osync_group_load (OSyncGroup *group, const char *path, OSyncError **error)
 Loads a group from a directory.
OSYNC_EXPORT void osync_group_add_member (OSyncGroup *group, OSyncMember *member)
 Appends a member to the group.
OSYNC_EXPORT void osync_group_remove_member (OSyncGroup *group, OSyncMember *member)
 Removes a member from the group.
OSYNC_EXPORT OSyncMemberosync_group_find_member (OSyncGroup *group, int id)
 Searches for a member by its id.
OSYNC_EXPORT OSyncMemberosync_group_nth_member (OSyncGroup *group, int nth)
 Returns the nth member of the group.
OSYNC_EXPORT int osync_group_num_members (OSyncGroup *group)
 Counts the members of the group.
OSYNC_EXPORT const char * osync_group_get_configdir (OSyncGroup *group)
 Returns the configdir for the group.
OSYNC_EXPORT void osync_group_set_configdir (OSyncGroup *group, const char *directory)
 Sets the configdir of the group.
OSYNC_EXPORT int osync_group_num_objtypes (OSyncGroup *group)
 Gets the number of object types of the group.
OSYNC_EXPORT const char * osync_group_nth_objtype (OSyncGroup *group, int nth)
 Gets the nth object type of the group.
OSYNC_EXPORT void osync_group_set_objtype_enabled (OSyncGroup *group, const char *objtype, osync_bool enabled)
 Change the status of an object type in the group.
OSYNC_EXPORT int osync_group_objtype_enabled (OSyncGroup *group, const char *objtype)
 Get the status of an object type in the group.
OSYNC_EXPORT time_t osync_group_get_last_synchronization (OSyncGroup *group)
 Gets the last synchronization date from this group.
OSYNC_EXPORT void osync_group_set_conflict_resolution (OSyncGroup *group, OSyncConflictResolution res, int num)
 Set fixed conflict resolution for the group for all appearing conflicts.
OSYNC_EXPORT void osync_group_get_conflict_resolution (OSyncGroup *group, OSyncConflictResolution *res, int *num)
 Get fixed conflict resolution for the group for all appearing conflicts.
OSYNC_EXPORT osync_bool osync_group_get_merger_enabled (OSyncGroup *group)
 Get group configured status of merger use.
OSYNC_EXPORT void osync_group_set_merger_enabled (OSyncGroup *group, osync_bool merger_enabled)
 Configure status of merger use.
OSYNC_EXPORT osync_bool osync_group_get_converter_enabled (OSyncGroup *group)
 Get group configured status of converter use.
OSYNC_EXPORT void osync_group_set_converter_enabled (OSyncGroup *group, osync_bool converter_enabled)
 Configure status of converter use.
OSYNC_EXPORT osync_bool osync_group_is_uptodate (OSyncGroup *group)
 Check if group configuration is up to date.


Detailed Description

A groups represent several device or application that should be synchronized.

Function Documentation

OSYNC_EXPORT OSyncGroup* osync_group_new ( OSyncError **  error  ) 

Creates a new group for the given environment.

Creates a newly allocated group

Parameters:
error Pointer to an error struct
Returns:
Pointer to a new group

Definition at line 277 of file opensync_group.c.

Referenced by osync_group_env_load_groups().

OSYNC_EXPORT OSyncGroup* osync_group_ref ( OSyncGroup group  ) 

Increase the reference count of the group.

Parameters:
group The group
Returns:
The referenced group pointer

Definition at line 301 of file opensync_group.c.

Referenced by osync_engine_new(), and osync_group_env_add_group().

OSYNC_EXPORT void osync_group_unref ( OSyncGroup group  ) 

Decrease the reference count of the group.

Parameters:
group The group

Definition at line 310 of file opensync_group.c.

Referenced by osync_group_env_load_groups(), osync_group_env_remove_group(), and osync_group_env_unref().

OSYNC_EXPORT OSyncLockState osync_group_lock ( OSyncGroup group  ) 

Locks a group.

Tries to acquire a lock for the given group.

If the lock was successfully acquired, OSYNC_LOCK_OK will be returned.

If the lock was acquired, but a old lock file was detected, OSYNC_LOCK_STALE will be returned. Use this to detect if the last sync of this group was successful, or if this something crashed. If you get this answer you should perform a slow-sync

If the group is locked, OSYNC_LOCKED is returned

Parameters:
group The group
Returns:
if the lockfile was acquired

Definition at line 334 of file opensync_group.c.

OSYNC_EXPORT void osync_group_unlock ( OSyncGroup group  ) 

Unlocks a group.

Parameters:
group The group to unlock

Definition at line 414 of file opensync_group.c.

OSYNC_EXPORT void osync_group_set_name ( OSyncGroup group,
const char *  name 
)

Sets the name for the group.

Sets the name for a group

Parameters:
group The group
name The name to set

Definition at line 444 of file opensync_group.c.

Referenced by osync_group_load().

OSYNC_EXPORT const char* osync_group_get_name ( OSyncGroup group  ) 

Returns the name of a group.

Returns the name of a group

Parameters:
group The group
Returns:
Name of the group

Definition at line 452 of file opensync_group.c.

Referenced by osync_group_env_add_group(), and osync_group_env_find_group().

OSYNC_EXPORT osync_bool osync_group_save ( OSyncGroup group,
OSyncError **  error 
)

Saves the group to disc.

Saves the group to disc possibly creating the configdirectory

Parameters:
group The group
error Pointer to an error struct
Returns:
TRUE on success, FALSE otherwise

Definition at line 458 of file opensync_group.c.

OSYNC_EXPORT osync_bool osync_group_delete ( OSyncGroup group,
OSyncError **  error 
)

Deletes a group from disc.

Deletes to group directories

Parameters:
group The group
error Pointer to an error struct
Returns:
TRUE on success, FALSE otherwise

Definition at line 552 of file opensync_group.c.

OSYNC_EXPORT osync_bool osync_group_reset ( OSyncGroup group,
OSyncError **  error 
)

Reset all databases of a group (anchor, hashtable and archive).

Parameters:
group The group
error Pointer to an error struct
Returns:
TRUE on success, FALSE otherwise

Definition at line 571 of file opensync_group.c.

OSYNC_EXPORT osync_bool osync_group_load ( OSyncGroup group,
const char *  path,
OSyncError **  error 
)

Loads a group from a directory.

Loads a group from a directory

Parameters:
group The group object to load into
path The path to the config directory of the group
error Pointer to an error struct
Returns:
TRUE on success, FALSE otherwise

Definition at line 631 of file opensync_group.c.

Referenced by osync_group_env_load_groups().

OSYNC_EXPORT void osync_group_add_member ( OSyncGroup group,
OSyncMember member 
)

Appends a member to the group.

Appends a member to the group

Parameters:
group The group to which to append
member The member to append

Definition at line 769 of file opensync_group.c.

OSYNC_EXPORT void osync_group_remove_member ( OSyncGroup group,
OSyncMember member 
)

Removes a member from the group.

Parameters:
group The group from which to remove
member The member to remove

Definition at line 783 of file opensync_group.c.

Referenced by osync_group_unref().

OSYNC_EXPORT OSyncMember* osync_group_find_member ( OSyncGroup group,
int  id 
)

Searches for a member by its id.

Parameters:
group The group in which to search
id The id of the member
Returns:
The member, or NULL if not found

Definition at line 790 of file opensync_group.c.

OSYNC_EXPORT OSyncMember* osync_group_nth_member ( OSyncGroup group,
int  nth 
)

Returns the nth member of the group.

Returns a pointer to the nth member of the group

Parameters:
group The group
nth Which member to return
Returns:
Pointer to the member

Definition at line 801 of file opensync_group.c.

Referenced by osync_group_save(), and osync_updater_action_required().

OSYNC_EXPORT int osync_group_num_members ( OSyncGroup group  ) 

Counts the members of the group.

Returns the number of members in the group

Parameters:
group The group
Returns:
Number of members

Definition at line 807 of file opensync_group.c.

Referenced by osync_group_save(), and osync_updater_action_required().

OSYNC_EXPORT const char* osync_group_get_configdir ( OSyncGroup group  ) 

Returns the configdir for the group.

Returns the configdir for the group

Parameters:
group The group
Returns:
String with the path of the config directory

Definition at line 813 of file opensync_group.c.

Referenced by osync_engine_new(), osync_group_env_add_group(), osync_group_is_uptodate(), and osync_group_reset().

OSYNC_EXPORT void osync_group_set_configdir ( OSyncGroup group,
const char *  directory 
)

Sets the configdir of the group.

Parameters:
group The group
directory The new configdir
Returns:
String with the path of the config directory

Definition at line 819 of file opensync_group.c.

Referenced by osync_group_env_add_group(), and osync_group_load().

OSYNC_EXPORT int osync_group_num_objtypes ( OSyncGroup group  ) 

Gets the number of object types of the group.

Parameters:
group The group
Returns:
Number of object types of the group

Definition at line 827 of file opensync_group.c.

OSYNC_EXPORT const char* osync_group_nth_objtype ( OSyncGroup group,
int  nth 
)

Gets the nth object type of the group.

Parameters:
group The group
nth The nth position of the object type list
Returns:
Name of the nth object type of the group

Definition at line 838 of file opensync_group.c.

OSYNC_EXPORT void osync_group_set_objtype_enabled ( OSyncGroup group,
const char *  objtype,
osync_bool  enabled 
)

Change the status of an object type in the group.

Parameters:
group The group
objtype Name of the object type
enabled The status of the object type to set. TRUE enable, FALSE disable objtype.

Definition at line 850 of file opensync_group.c.

OSYNC_EXPORT int osync_group_objtype_enabled ( OSyncGroup group,
const char *  objtype 
)

Get the status of an object type in the group.

Parameters:
group The group
objtype The name of the object type
Returns:
TRUE if object type is enabled in this group, otherwise FALSE

Definition at line 861 of file opensync_group.c.

OSYNC_EXPORT time_t osync_group_get_last_synchronization ( OSyncGroup group  ) 

Gets the last synchronization date from this group.

The information will available on the group after osync_group_load()

Parameters:
group The group
Returns:
The synchronization info

Definition at line 941 of file opensync_group.c.

OSYNC_EXPORT void osync_group_set_conflict_resolution ( OSyncGroup group,
OSyncConflictResolution  res,
int  num 
)

Set fixed conflict resolution for the group for all appearing conflicts.

Parameters:
group The group
res The conflict resolution
num The Member ID which solves the conflict (winner)

Definition at line 947 of file opensync_group.c.

OSYNC_EXPORT void osync_group_get_conflict_resolution ( OSyncGroup group,
OSyncConflictResolution *  res,
int *  num 
)

Get fixed conflict resolution for the group for all appearing conflicts.

Parameters:
group The group
res Pointer to set conflict resolution value
num Pointer to set Member ID value which solves the conflict (winner)

Definition at line 954 of file opensync_group.c.

OSYNC_EXPORT osync_bool osync_group_get_merger_enabled ( OSyncGroup group  ) 

Get group configured status of merger use.

Parameters:
group The group
Returns:
TRUE if merger is enabled. FALSE if merger is disabled.

Definition at line 964 of file opensync_group.c.

OSYNC_EXPORT void osync_group_set_merger_enabled ( OSyncGroup group,
osync_bool  merger_enabled 
)

Configure status of merger use.

Parameters:
group The group
merger_enabled TRUE enables the merger. FALSE disables the merger.

Definition at line 971 of file opensync_group.c.

OSYNC_EXPORT osync_bool osync_group_get_converter_enabled ( OSyncGroup group  ) 

Get group configured status of converter use.

Parameters:
group The group
Returns:
TRUE if converter is enabled. FALSE if converter is disabled.

Definition at line 978 of file opensync_group.c.

OSYNC_EXPORT void osync_group_set_converter_enabled ( OSyncGroup group,
osync_bool  converter_enabled 
)

Configure status of converter use.

Parameters:
group The group
converter_enabled TRUE enables the converter. FALSE disables the converter.

Definition at line 985 of file opensync_group.c.

OSYNC_EXPORT osync_bool osync_group_is_uptodate ( OSyncGroup group  ) 

Check if group configuration is up to date.

Parameters:
group The group
Returns:
TRUE if the group configuration is up to date, FALSE otherwise.

Definition at line 992 of file opensync_group.c.

Referenced by osync_updater_action_required().


Generated on Fri Feb 13 13:33:29 2009 for OpenSync by  doxygen 1.5.7.1