OpenSync
0.22
|
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. | |
Functions | |
OSyncGroup * | osync_group_new (OSyncEnv *env) |
Creates a new group for the given environment. More... | |
void | osync_group_free (OSyncGroup *group) |
Frees the given group. More... | |
OSyncLockState | osync_group_lock (OSyncGroup *group) |
Locks a group. More... | |
void | osync_group_unlock (OSyncGroup *group, osync_bool remove) |
Unlocks a group. More... | |
void | osync_group_set_name (OSyncGroup *group, const char *name) |
Sets the name for the group. More... | |
const char * | osync_group_get_name (OSyncGroup *group) |
Returns the name of a group. More... | |
osync_bool | osync_group_save (OSyncGroup *group, OSyncError **error) |
Saves the group to disc. More... | |
osync_bool | osync_group_delete (OSyncGroup *group, OSyncError **error) |
Deletes a group from disc. More... | |
OSyncGroup * | osync_group_load (OSyncEnv *env, const char *path, OSyncError **error) |
Loads a group from a directory. More... | |
void | osync_group_reset (OSyncGroup *group) |
Resets all databases of a group. More... | |
void | osync_group_add_member (OSyncGroup *group, OSyncMember *member) |
Appends a member to the group. More... | |
void | osync_group_remove_member (OSyncGroup *group, OSyncMember *member) |
Removes a member from the group. More... | |
OSyncMember * | osync_group_nth_member (OSyncGroup *group, int nth) |
Returns the nth member of the group. More... | |
int | osync_group_num_members (OSyncGroup *group) |
Counts the members of the group. More... | |
const char * | osync_group_get_configdir (OSyncGroup *group) |
Returns the configdir for the group. More... | |
void | osync_group_set_configdir (OSyncGroup *group, const char *directory) |
Sets the configdir of the group. More... | |
void | osync_group_set_slow_sync (OSyncGroup *group, const char *objtypestr, osync_bool slow_sync) |
Sets if the group requires slow-sync for the given object type. More... | |
void | osync_group_reset_slow_sync (OSyncGroup *group, const char *objtypestr) |
Reset slow-sync for this group. More... | |
osync_bool | osync_group_get_slow_sync (OSyncGroup *group, const char *objtype) |
Returns if the group will perform a slow-sync for the object type. More... | |
osync_bool | osync_group_objtype_enabled (OSyncGroup *group, const char *objtype) |
Returns if the object type is enabled for the group. More... | |
void | osync_group_set_objtype_enabled (OSyncGroup *group, const char *objtypestr, osync_bool enabled) |
Sets if the object type is accepted for ALL members. More... | |
int | osync_group_num_filters (OSyncGroup *group) |
Returns the number of filters registered in a group. More... | |
OSyncFilter * | osync_group_nth_filter (OSyncGroup *group, int nth) |
Gets the nth filter of a group. More... | |
void | osync_group_flush_filters (OSyncGroup *group) |
Flushes the list of filters for a group. More... | |
osync_bool | osync_group_open_changelog (OSyncGroup *group, char ***uids, char ***objtype, long long int **memberids, int **changetypes, OSyncError **error) |
Can be used to load all items from the changelog. Loaded items will be removed. More... | |
osync_bool | osync_group_save_changelog (OSyncGroup *group, OSyncChange *change, OSyncError **error) |
Saves a change to the changelog. More... | |
osync_bool | osync_group_remove_changelog (OSyncGroup *group, OSyncChange *change, OSyncError **error) |
Removes a change from the changelog. More... | |
void | osync_group_set_last_synchronization (OSyncGroup *group, time_t last_sync) |
Sets the last synchronization date of this group. More... | |
time_t | osync_group_get_last_synchronization (OSyncGroup *group) |
Gets the last synchronization date from this group. More... | |
A groups represent several device or application that should be synchronized.
OSyncGroup* osync_group_new | ( | OSyncEnv * | env | ) |
Creates a new group for the given environment.
Creates a newly allocated group
env | The environment for which to create the group. Might be NULL if you which to not add the group at the point of creation |
Definition at line 204 of file opensync_group.c.
Referenced by osync_group_load().
void osync_group_free | ( | OSyncGroup * | group | ) |
Frees the given group.
Frees the given group
group | The group |
Definition at line 224 of file opensync_group.c.
Referenced by osync_env_finalize(), osync_group_delete(), and osync_group_load().
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 successfull, 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
group | The group |
Definition at line 267 of file opensync_group.c.
Referenced by osengine_init().
void osync_group_unlock | ( | OSyncGroup * | group, |
osync_bool | remove | ||
) |
Unlocks a group.
if you set remove = FALSE, the lock file will not be removed and the next call to osync_lock_group() for this group will return OSYNC_LOCK_STALE.
group | The group |
remove | If the lockfile should be removed |
Definition at line 348 of file opensync_group.c.
Referenced by osengine_finalize(), osengine_init(), and osync_group_free().
void osync_group_set_name | ( | OSyncGroup * | group, |
const char * | name | ||
) |
Sets the name for the group.
Sets the name for a group
group | The group |
name | The name to set |
Definition at line 384 of file opensync_group.c.
const char* osync_group_get_name | ( | OSyncGroup * | group | ) |
Returns the name of a group.
Returns the name of a group
group | The group |
Definition at line 400 of file opensync_group.c.
osync_bool osync_group_save | ( | OSyncGroup * | group, |
OSyncError ** | error | ||
) |
Saves the group to disc.
Saves the group to disc possibly creating the configdirectory
group | The group |
error | Pointer to a error struct |
Definition at line 415 of file opensync_group.c.
osync_bool osync_group_delete | ( | OSyncGroup * | group, |
OSyncError ** | error | ||
) |
Deletes a group from disc.
Deletes to group directories and removes it from its environment
group | The group |
error | Pointer to a error struct |
Definition at line 512 of file opensync_group.c.
OSyncGroup* osync_group_load | ( | OSyncEnv * | env, |
const char * | path, | ||
OSyncError ** | error | ||
) |
Loads a group from a directory.
Loads a group from a directory
env | The environment in which to create the group. Can be NULL |
path | The path to the config directory of the group |
error | Pointer to a error struct |
Definition at line 536 of file opensync_group.c.
Referenced by osync_env_load_groups().
void osync_group_reset | ( | OSyncGroup * | group | ) |
Resets all databases of a group.
This will reset all databases of a group. So all anchors, mappings hashtables etc will be forgotten (as if the group was never synced)
group | The group to reset |
Definition at line 667 of file opensync_group.c.
void osync_group_add_member | ( | OSyncGroup * | group, |
OSyncMember * | member | ||
) |
Appends a member to the group.
Appends a member to the group
group | The group to which to append |
member | The member to append |
Definition at line 687 of file opensync_group.c.
Referenced by osync_member_new().
void osync_group_remove_member | ( | OSyncGroup * | group, |
OSyncMember * | member | ||
) |
Removes a member from the group.
group | The group from which to remove |
member | The member to remove |
Definition at line 699 of file opensync_group.c.
Referenced by osync_member_free().
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
group | The group |
nth | Which member to return |
Definition at line 714 of file opensync_group.c.
Referenced by osengine_new(), osync_group_free(), osync_group_save(), and osync_member_from_id().
int osync_group_num_members | ( | OSyncGroup * | group | ) |
Counts the members of the group.
Returns the number of members in the group
group | The group |
Definition at line 728 of file opensync_group.c.
Referenced by osengine_init(), osengine_new(), osync_group_save(), and osync_member_from_id().
const char* osync_group_get_configdir | ( | OSyncGroup * | group | ) |
Returns the configdir for the group.
Returns the configdir for the group
group | The group |
Definition at line 742 of file opensync_group.c.
Referenced by osync_group_load_members().
void osync_group_set_configdir | ( | OSyncGroup * | group, |
const char * | directory | ||
) |
Sets the configdir of the group.
group | The group |
directory | The new configdir |
Definition at line 755 of file opensync_group.c.
void osync_group_set_slow_sync | ( | OSyncGroup * | group, |
const char * | objtypestr, | ||
osync_bool | slow_sync | ||
) |
Sets if the group requires slow-sync for the given object type.
Sets if the group requires slow-sync for the given object type. This will be reset once the group performs a successfull slow-sync.
group | The group |
objtypestr | The name of the object type |
slow_sync | Set to TRUE if you want to perform a slow-sync, FALSE otherwise |
Definition at line 773 of file opensync_group.c.
Referenced by osengine_init(), osengine_reset(), and osync_member_set_slow_sync().
void osync_group_reset_slow_sync | ( | OSyncGroup * | group, |
const char * | objtypestr | ||
) |
Reset slow-sync for this group.
You can use this function to reset the slow-sync status for the given group. This is normally done if a synchronization succeeds.
group | The group to reset slow-sync on |
objtypestr | The name of the object type |
Definition at line 809 of file opensync_group.c.
Referenced by osengine_reset().
osync_bool osync_group_get_slow_sync | ( | OSyncGroup * | group, |
const char * | objtype | ||
) |
Returns if the group will perform a slow-sync for the object type.
Returns if the group will perform a slow-sync for the object type
group | The group |
objtype | The name of the object type |
Definition at line 839 of file opensync_group.c.
Referenced by _new_change_receiver(), osengine_synchronize(), osync_group_set_slow_sync(), and osync_member_get_slow_sync().
osync_bool osync_group_objtype_enabled | ( | OSyncGroup * | group, |
const char * | objtype | ||
) |
Returns if the object type is enabled for the group.
Returns TRUE if the object type is enabled for the group. Note that this information is saved on a per member basis. If one of the members has this object type enabled this function will return TRUE
group | The group |
objtype | The name of the object type |
Definition at line 870 of file opensync_group.c.
void osync_group_set_objtype_enabled | ( | OSyncGroup * | group, |
const char * | objtypestr, | ||
osync_bool | enabled | ||
) |
Sets if the object type is accepted for ALL members.
BUG We loose information if only some members are enabled
group | The group |
objtypestr | The name of the object type |
enabled | What do you want to set today? |
Note: the plugin needs to be instanced for this function to be called
Definition at line 899 of file opensync_group.c.
int osync_group_num_filters | ( | OSyncGroup * | group | ) |
Returns the number of filters registered in a group.
group | The group |
Definition at line 928 of file opensync_group.c.
OSyncFilter* osync_group_nth_filter | ( | OSyncGroup * | group, |
int | nth | ||
) |
Gets the nth filter of a group.
Note that you should not add or delete filters while iterating over them
group | The group |
nth | Which filter to return |
Definition at line 944 of file opensync_group.c.
void osync_group_flush_filters | ( | OSyncGroup * | group | ) |
Flushes the list of filters for a group.
Clean the list of filters on the group
Definition at line 954 of file opensync_group.c.
osync_bool osync_group_open_changelog | ( | OSyncGroup * | group, |
char *** | uids, | ||
char *** | objtype, | ||
long long int ** | memberids, | ||
int ** | changetypes, | ||
OSyncError ** | error | ||
) |
Can be used to load all items from the changelog. Loaded items will be removed.
group | The group for which to load the log |
uids | Place to return an array with the saved uids |
objtype | Place to return an array with the saved objtypes |
memberids | Place to return an array with the saved memberids |
changetypes | Place to return an array with the saved changetypes. Same size as uids |
error | Place to return the error |
Definition at line 976 of file opensync_group.c.
osync_bool osync_group_save_changelog | ( | OSyncGroup * | group, |
OSyncChange * | change, | ||
OSyncError ** | error | ||
) |
Saves a change to the changelog.
group | The group in which to save |
change | The change to save |
error | Place to return the error |
Definition at line 988 of file opensync_group.c.
Referenced by osengine_mapping_ignore_conflict().
osync_bool osync_group_remove_changelog | ( | OSyncGroup * | group, |
OSyncChange * | change, | ||
OSyncError ** | error | ||
) |
Removes a change from the changelog.
group | The group in which to save |
change | The change to remove |
error | Place to return the error |
Definition at line 1000 of file opensync_group.c.
Referenced by _new_change_receiver().
void osync_group_set_last_synchronization | ( | OSyncGroup * | group, |
time_t | last_sync | ||
) |
Sets the last synchronization date of this group.
The information will be stored on disc after osync_group_save()
group | The group in which to save |
tm | The time info to set |
Definition at line 1012 of file opensync_group.c.
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()
group | The group |
Definition at line 1029 of file opensync_group.c.