From: <svn...@op...> - 2009-03-31 11:30:01
|
Author: bellmich Date: Tue Mar 31 13:29:49 2009 New Revision: 5481 URL: http://www.opensync.org/changeset/5481 Log: renamed OSyncAnchor to OSyncSinkStateDB Modified: trunk/opensync/client/opensync_client.c trunk/opensync/opensync.h trunk/opensync/plugin/opensync_objtype_sink.c trunk/opensync/plugin/opensync_objtype_sink.h trunk/opensync/plugin/opensync_objtype_sink_internals.h trunk/opensync/plugin/opensync_objtype_sink_private.h Modified: trunk/opensync/client/opensync_client.c ============================================================================== --- trunk/opensync/client/opensync_client.c Tue Mar 31 13:29:05 2009 (r5480) +++ trunk/opensync/client/opensync_client.c Tue Mar 31 13:29:49 2009 (r5481) @@ -708,7 +708,7 @@ list = objtypesinks; while (list) { sink = (OSyncObjTypeSink*)list->data; - if (!osync_objtype_sink_load_anchor(sink, client->plugin_info, error)) { + if (!osync_objtype_sink_open_state_db(sink, client->plugin_info, error)) { goto error_finalize; } @@ -721,7 +721,7 @@ main_sink = osync_plugin_info_get_main_sink(client->plugin_info); if (main_sink) { - if (!osync_objtype_sink_load_anchor(main_sink, + if (!osync_objtype_sink_open_state_db(main_sink, client->plugin_info, error)) goto error_finalize; Modified: trunk/opensync/opensync.h ============================================================================== --- trunk/opensync/opensync.h Tue Mar 31 13:29:05 2009 (r5480) +++ trunk/opensync/opensync.h Tue Mar 31 13:29:49 2009 (r5481) @@ -235,7 +235,7 @@ typedef struct OSyncModule OSyncModule; /* Helper component */ -typedef struct OSyncAnchor OSyncAnchor; +typedef struct OSyncSinkStateDB OSyncSinkStateDB; typedef struct OSyncHashTable OSyncHashTable; /* IPC component */ Modified: trunk/opensync/plugin/opensync_objtype_sink.c ============================================================================== --- trunk/opensync/plugin/opensync_objtype_sink.c Tue Mar 31 13:29:05 2009 (r5480) +++ trunk/opensync/plugin/opensync_objtype_sink.c Tue Mar 31 13:29:49 2009 (r5481) @@ -80,8 +80,8 @@ sink->objformatsinks = osync_list_remove(sink->objformatsinks, sink->objformatsinks->data); } - if (sink->anchor) - osync_anchor_unref(sink->anchor); + if (sink->state_db) + osync_sink_state_db_unref(sink->state_db); if (sink->hashtable) osync_hashtable_unref(sink->hashtable); @@ -96,31 +96,31 @@ } } -void osync_objtype_sink_enable_anchor(OSyncObjTypeSink *sink, osync_bool enable) +void osync_objtype_sink_enable_state_db(OSyncObjTypeSink *sink, osync_bool enable) { osync_return_if_fail(sink); - sink->anchor_requested = enable; + sink->state_db_requested = enable; } -osync_bool osync_objtype_sink_has_anchor(OSyncObjTypeSink *sink) +osync_bool osync_objtype_sink_has_state_db(OSyncObjTypeSink *sink) { osync_return_val_if_fail(sink, FALSE); - return sink->anchor_requested; + return sink->state_db_requested; } -OSyncAnchor *osync_objtype_sink_get_anchor(OSyncObjTypeSink *sink) +OSyncSinkStateDB *osync_objtype_sink_get_state_db(OSyncObjTypeSink *sink) { osync_return_val_if_fail(sink, NULL); - return sink->anchor; + return sink->state_db; } -void osync_objtype_sink_set_anchor(OSyncObjTypeSink *sink, OSyncAnchor *anchor) +void osync_objtype_sink_set_state_db(OSyncObjTypeSink *sink, OSyncSinkStateDB *state_db) { osync_return_if_fail(sink); - if (sink->anchor) - osync_anchor_unref(sink->anchor); + if (sink->state_db) + osync_sink_state_db_unref(sink->state_db); - sink->anchor = osync_anchor_ref(anchor); + sink->state_db = osync_sink_state_db_ref(state_db); } void osync_objtype_sink_enable_hashtable(OSyncObjTypeSink *sink, osync_bool enable) @@ -708,32 +708,32 @@ return sink->timeout.read; } -osync_bool osync_objtype_sink_load_anchor(OSyncObjTypeSink *sink, OSyncPluginInfo *plugin_info, OSyncError **error) +osync_bool osync_objtype_sink_open_state_db(OSyncObjTypeSink *sink, OSyncPluginInfo *plugin_info, OSyncError **error) { - char *anchorpath; + char *filename; osync_assert(sink); - if (!osync_objtype_sink_has_anchor(sink)) + if (!osync_objtype_sink_has_state_db(sink)) return TRUE; - /* FIXME: Get rid of file lcoation! - * Later with fruther OSyncDB modifications this should be file-hiarchy indepdendent. + /* FIXME: Get rid of file location! + * Later with further OSyncDB modifications this should be file-hierarchy indepdendent. * And The first arg should just consists of the Member ID */ - anchorpath = osync_strdup_printf("%s%canchor.db", + filename = osync_strdup_printf("%s%canchor.db", osync_plugin_info_get_configdir(plugin_info), G_DIR_SEPARATOR); - sink->anchor = osync_anchor_new(anchorpath, sink->objtype, error); - if (!sink->anchor) + sink->state_db = osync_sink_state_db_new(filename, sink->objtype, error); + if (!sink->state_db) goto error; - osync_free(anchorpath); + osync_free(filename); return TRUE; error: - osync_free(anchorpath); + osync_free(filename); return FALSE; } Modified: trunk/opensync/plugin/opensync_objtype_sink.h ============================================================================== --- trunk/opensync/plugin/opensync_objtype_sink.h Tue Mar 31 13:29:05 2009 (r5480) +++ trunk/opensync/plugin/opensync_objtype_sink.h Tue Mar 31 13:29:49 2009 (r5481) @@ -77,33 +77,35 @@ */ OSYNC_EXPORT void osync_objtype_sink_unref(OSyncObjTypeSink *sink); -/** @brief Request an anchor for this Sink +/** @brief Request a state database for this Sink * - * If for this sink an anchor is required, this needs to be requested by this - * function. If anchor gets enabled/requested inside the plugin, the framework - * will take care about preparing the anchor. The created anchor can be accessed - * by using the function osync_objtype_sink_get_anchor() + * If for this sink an anchor/state is required, this needs to be requested by this + * function. If anchor/state gets enabled/requested inside the plugin, the framework + * will take care about preparing the anchor/state. + * The created anchor/state can be accessed + * by using the function osync_objtype_sink_get_state_db() * * By default no anchor is requested/enabled. * * @param sink Pointer to the sink - * @param enable Flag to enable, disbable anchor. + * @param enable Flag to enable, disable state database. * */ -OSYNC_EXPORT void osync_objtype_sink_enable_anchor(OSyncObjTypeSink *sink, osync_bool enable); +OSYNC_EXPORT void osync_objtype_sink_enable_state_db(OSyncObjTypeSink *sink, osync_bool enable); -/** @brief Get the pointer to the sink OSyncAnchor +/** @brief Get the pointer to the sink OSyncSinkStateDB * - * This Anchor is sink specific and can store persistent, sink specific data. + * This state database is sink specific and can store persistent, sink specific states. * Originally designed to detect if a certain value changed since last * synchronization on the peer. E.g. to decided if a slow-sync is requried * or not. * * @param sink Pointer to the sink - * @returns Pointer to the requested OSyncAnchor, or NULL if no anchor is requested + * @returns Pointer to the requested OSyncSinkStateDB, + * or NULL if no state datbase is requested * */ -OSYNC_EXPORT OSyncAnchor *osync_objtype_sink_get_anchor(OSyncObjTypeSink *sink); +OSYNC_EXPORT OSyncSinkStateDB *osync_objtype_sink_get_state_db(OSyncObjTypeSink *sink); /** @brief Request a hashtable for this Sink * @@ -458,7 +460,7 @@ */ OSYNC_EXPORT void osync_objtype_sink_set_read_timeout(OSyncObjTypeSink *sink, unsigned int timeout); -/*! @brief Load the Anchor for a specific Sink if requested +/*! @brief Open the state database for a specific Sink if requested * * Load (i.e. connects) to the Anchor. If no Anchor is requested for this sink * this functions just returns TRUE. @@ -469,7 +471,7 @@ * @returns TRUE on success, FALSE on any error * */ -OSYNC_EXPORT osync_bool osync_objtype_sink_load_anchor(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncError **error); +OSYNC_EXPORT osync_bool osync_objtype_sink_open_state_db(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncError **error); /*! @brief Load the Hashtable for a specific Sink if requested * Modified: trunk/opensync/plugin/opensync_objtype_sink_internals.h ============================================================================== --- trunk/opensync/plugin/opensync_objtype_sink_internals.h Tue Mar 31 13:29:05 2009 (r5480) +++ trunk/opensync/plugin/opensync_objtype_sink_internals.h Tue Mar 31 13:29:49 2009 (r5481) @@ -44,25 +44,27 @@ OSyncSinkConnectDoneFn connect_done; } OSyncObjTypeSinkFunctions; -/** @brief Check if sink has an anchor request. +/** @brief Check if sink has a state database request. * * @param sink Pointer to the sink - * @returns TRUE if the sink has an anchor request, FALSE otherwise + * @returns TRUE if the sink has a state database request, FALSE otherwise */ -osync_bool osync_objtype_sink_has_anchor(OSyncObjTypeSink *sink); +osync_bool osync_objtype_sink_has_state_db(OSyncObjTypeSink *sink); -/** @brief Set the OSyncAnchor for this sink +/** @brief Set the OSyncSinkStateDB for this sink * - * This Anchor is sink specific and can store persistent, sink specific data. + * This state database is sink specific and can store persistent, sink specific states. * Originally designed to detect if a certain value changed since last * synchronization on the peer. E.g. to decided if a slow-sync is requried * or not. * * @param sink Pointer to the sink - * @param anchor Pointer to the Anchor object + * @param state_db Pointer to the state database object * */ -void osync_objtype_sink_set_anchor(OSyncObjTypeSink *sink, OSyncAnchor *anchor); +void osync_objtype_sink_set_state_db( + OSyncObjTypeSink *sink, + OSyncSinkStateDB *state_db); /** @brief Check if sink has a hashtable request. * Modified: trunk/opensync/plugin/opensync_objtype_sink_private.h ============================================================================== --- trunk/opensync/plugin/opensync_objtype_sink_private.h Tue Mar 31 13:29:05 2009 (r5480) +++ trunk/opensync/plugin/opensync_objtype_sink_private.h Tue Mar 31 13:29:49 2009 (r5481) @@ -74,10 +74,10 @@ struct OSyncObjTypeSink { /** The sink anchor if requested by the plugin */ - OSyncAnchor *anchor; + OSyncSinkStateDB *state_db; /** Flag if anchor is requested by plugin */ - osync_bool anchor_requested; + osync_bool state_db_requested; /** The sink hashtable if requested by the plugin */ OSyncHashTable *hashtable; |