You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
(56) |
Apr
(109) |
May
(15) |
Jun
(3) |
Jul
(37) |
Aug
(96) |
Sep
(40) |
Oct
(4) |
Nov
(54) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(47) |
Feb
(30) |
Mar
(102) |
Apr
(120) |
May
(68) |
Jun
(54) |
Jul
(53) |
Aug
(122) |
Sep
(190) |
Oct
(71) |
Nov
(85) |
Dec
(108) |
2007 |
Jan
(72) |
Feb
(190) |
Mar
(53) |
Apr
(101) |
May
(145) |
Jun
(148) |
Jul
(167) |
Aug
(143) |
Sep
(23) |
Oct
(198) |
Nov
(223) |
Dec
(195) |
2008 |
Jan
(100) |
Feb
(129) |
Mar
(79) |
Apr
(77) |
May
(34) |
Jun
(95) |
Jul
(112) |
Aug
(160) |
Sep
(82) |
Oct
(124) |
Nov
(199) |
Dec
(355) |
2009 |
Jan
(436) |
Feb
(89) |
Mar
(298) |
Apr
(189) |
May
(33) |
Jun
(88) |
Jul
(105) |
Aug
(44) |
Sep
(181) |
Oct
(87) |
Nov
(75) |
Dec
(1) |
2010 |
Jan
(63) |
Feb
(21) |
Mar
(3) |
Apr
(1) |
May
(1) |
Jun
(3) |
Jul
(26) |
Aug
(37) |
Sep
(26) |
Oct
(15) |
Nov
(13) |
Dec
|
From: <svn...@op...> - 2009-03-31 16:16:26
|
Author: bellmich Date: Tue Mar 31 18:16:19 2009 New Revision: 5493 URL: http://www.opensync.org/changeset/5493 Log: migration from OSyncAnchor to OSyncSinkStateDB Modified: plugins/evolution2/src/evolution2_ebook.c plugins/evolution2/src/evolution2_ecal.c Modified: plugins/evolution2/src/evolution2_ebook.c ============================================================================== --- plugins/evolution2/src/evolution2_ebook.c Tue Mar 31 18:08:58 2009 (r5492) +++ plugins/evolution2/src/evolution2_ebook.c Tue Mar 31 18:16:19 2009 (r5493) @@ -137,22 +137,22 @@ osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, userdata); OSyncEvoEnv *env = (OSyncEvoEnv *)userdata; - osync_bool anchor_match; + osync_bool state_match; if (!(env->addressbook = evo2_ebook_open_book(osync_strdup(env->addressbook_path), &error))) { goto error; } - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); - if (!anchor) { - osync_error_set(&error, OSYNC_ERROR_GENERIC, "Anchor missing for objtype \"%s\"", osync_objtype_sink_get_name(sink)); + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); + if (!state_db) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "State database missing for objtype \"%s\"", osync_objtype_sink_get_name(sink)); goto error_free_book; } - if (!osync_anchor_compare(anchor, "path", env->addressbook_path, &anchor_match, &error)) { + if (!osync_sink_state_equal(state_db, "path", env->addressbook_path, &state_match, &error)) { osync_error_set(&error, OSYNC_ERROR_GENERIC, "Anchor comparison failed for objtype \"%s\"", osync_objtype_sink_get_name(sink)); goto error_free_book; } - if (!anchor_match) { + if (!state_match) { osync_trace(TRACE_INTERNAL, "EBook slow sync, due to anchor mismatch"); osync_context_report_slowsync(ctx); } @@ -194,12 +194,12 @@ OSyncError *error = NULL; GError *gerror=NULL; - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); - if (!anchor) { - osync_error_set(&error, OSYNC_ERROR_GENERIC, "Anchor missing for objtype \"%s\"", osync_objtype_sink_get_name(sink)); + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); + if (!state_db) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "State database missing for objtype \"%s\"", osync_objtype_sink_get_name(sink)); goto error; } - if (!osync_anchor_update(anchor, "path", env->addressbook_path, &error)) + if (!osync_sink_state_set(state_db, "path", env->addressbook_path, &error)) goto error; GList *changes = NULL; @@ -427,7 +427,7 @@ osync_objtype_sink_set_commit_func(sink, evo2_ebook_modify); osync_objtype_sink_set_sync_done_func(sink, evo2_ebook_sync_done); - osync_objtype_sink_enable_anchor(sink, TRUE); + osync_objtype_sink_enable_state_db(sink, TRUE); OSyncPluginConfig *config = osync_plugin_info_get_config(info); OSyncPluginResource *resource = osync_plugin_config_find_active_resource(config, "contact"); Modified: plugins/evolution2/src/evolution2_ecal.c ============================================================================== --- plugins/evolution2/src/evolution2_ecal.c Tue Mar 31 18:08:58 2009 (r5492) +++ plugins/evolution2/src/evolution2_ecal.c Tue Mar 31 18:16:19 2009 (r5493) @@ -92,17 +92,17 @@ goto error; } - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); - osync_bool anchor_match; - if (!anchor) { + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); + osync_bool state_match; + if (!state_db) { osync_error_set(&error, OSYNC_ERROR_GENERIC, "Anchor missing for objtype \"%s\"", osync_objtype_sink_get_name(sink)); goto error_free_cal; } - if (!osync_anchor_compare(anchor, "uri", evo_cal->uri, &anchor_match, &error)) { + if (!osync_sink_state_equal(state_db, "uri", evo_cal->uri, &state_match, &error)) { osync_error_set(&error, OSYNC_ERROR_GENERIC, "Anchor comparison failed for objtype \"%s\"", osync_objtype_sink_get_name(sink)); goto error_free_cal; } - if (!anchor_match) { + if (!state_match) { osync_trace(TRACE_INTERNAL, "ECal slow sync, due to anchor mismatch for objtype \"%s\"", osync_objtype_sink_get_name(sink)); osync_context_report_slowsync(ctx); } @@ -146,12 +146,12 @@ OSyncEvoCalendar * evo_cal = (OSyncEvoCalendar *)userdata; - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); - if (!anchor) { - osync_error_set(&error, OSYNC_ERROR_GENERIC, "Anchor missing for objtype \"%s\"", osync_objtype_sink_get_name(sink)); + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); + if (!state_db) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "State database missing for objtype \"%s\"", osync_objtype_sink_get_name(sink)); goto error; } - if (!osync_anchor_update(anchor, "uri", evo_cal->uri, &error)) + if (!osync_sink_state_set(state_db, "uri", evo_cal->uri, &error)) goto error; GList *changes = NULL; @@ -417,7 +417,7 @@ osync_objtype_sink_set_commit_func(sink, evo2_ecal_modify); osync_objtype_sink_set_sync_done_func(sink, evo2_ecal_sync_done); - osync_objtype_sink_enable_anchor(sink, TRUE); + osync_objtype_sink_enable_state_db(sink, TRUE); OSyncEvoCalendar *cal = osync_try_malloc0(sizeof(OSyncEvoCalendar), error); if (!cal) { |
From: <svn...@op...> - 2009-03-31 16:14:01
|
Author: bellmich Date: Tue Mar 31 18:13:45 2009 New Revision: 204 URL: http://libwbxml.opensync.org/changeset/204 Log: Added ChangeLog entry for r203 Modified: wbxml2/trunk/ChangeLog Modified: wbxml2/trunk/ChangeLog ============================================================================== --- wbxml2/trunk/ChangeLog Tue Mar 31 17:39:17 2009 (r203) +++ wbxml2/trunk/ChangeLog Tue Mar 31 18:13:45 2009 (r204) @@ -2,6 +2,7 @@ * Fixed Sun Studio CC and GCC warnings. * Fixed Testing.cmake to not set GCC specific compiler and linker flags for other compilers. + * Fixed race condition in WV datetime opaque encoding 2009-03-30 Michael Bell <mic...@we...> * Released 0.10.5 |
From: <svn...@op...> - 2009-03-31 16:09:10
|
Author: bellmich Date: Tue Mar 31 18:08:58 2009 New Revision: 5492 URL: http://www.opensync.org/changeset/5492 Log: commited forgotten file from OSyncAnchor migration Modified: plugins/syncml/src/syncml_ds_server.c Modified: plugins/syncml/src/syncml_ds_server.c ============================================================================== --- plugins/syncml/src/syncml_ds_server.c Tue Mar 31 16:56:29 2009 (r5491) +++ plugins/syncml/src/syncml_ds_server.c Tue Mar 31 18:08:58 2009 (r5492) @@ -44,8 +44,8 @@ osync_objtype_sink_set_get_changes_func(sink, ds_server_get_changeinfo); osync_objtype_sink_set_batch_commit_func(sink, ds_server_batch_commit); - // Request an anchor from the framework. - osync_objtype_sink_enable_anchor(sink, TRUE); + // Request a state database from the framework. + osync_objtype_sink_enable_state_db(sink, TRUE); const char *objtype = osync_objtype_sink_get_name(sink); OSyncPluginResource *res = osync_plugin_config_find_active_resource(config, objtype); |
From: <svn...@op...> - 2009-03-31 15:39:22
|
Author: bellmich Date: Tue Mar 31 17:39:17 2009 New Revision: 203 URL: http://libwbxml.opensync.org/changeset/203 Log: - fixed race condition in WV datetime opaque encoding - fixed order of opaque encoded WV datetime in debug output Modified: wbxml2/trunk/src/wbxml_encoder.c Modified: wbxml2/trunk/src/wbxml_encoder.c ============================================================================== --- wbxml2/trunk/src/wbxml_encoder.c Tue Mar 31 17:10:09 2009 (r202) +++ wbxml2/trunk/src/wbxml_encoder.c Tue Mar 31 17:39:17 2009 (r203) @@ -3184,6 +3184,9 @@ /* delete time zone */ wbxml_buffer_delete(tmp, 15, 1); + } else { + /* There is no time zone. */ + octets[5] = 0; } /* delete 'T' */ @@ -3286,7 +3289,7 @@ octets[4] <<=6; octets[4] += (WB_UTINY) (second & 0x3f); /* 6 bits */ - WBXML_DEBUG((WBXML_CONV, "WV datetime: %x %x %x %x %x %x", octets[5], octets[4], octets[3], octets[2], octets[1], octets[0])); + WBXML_DEBUG((WBXML_CONV, "WV datetime: %x %x %x %x %x %x", octets[0], octets[1], octets[2], octets[3], octets[4], octets[5])); /* Encode it to Opaque */ ret = wbxml_encode_opaque_data(encoder, octets, 6); |
From: <svn...@op...> - 2009-03-31 15:10:20
|
Author: bellmich Date: Tue Mar 31 17:10:09 2009 New Revision: 202 URL: http://libwbxml.opensync.org/changeset/202 Log: fixed forgotten bashism Modified: wbxmlTestSuite/trunk/launchTests.sh Modified: wbxmlTestSuite/trunk/launchTests.sh ============================================================================== --- wbxmlTestSuite/trunk/launchTests.sh Tue Mar 31 17:01:40 2009 (r201) +++ wbxmlTestSuite/trunk/launchTests.sh Tue Mar 31 17:10:09 2009 (r202) @@ -79,7 +79,7 @@ then RESULT=$ITEM fi - COUNTER=$(($COUNTER + 1)) + COUNTER=`expr $COUNTER + 1` done DIRLIST=$RESULT fi |
From: <svn...@op...> - 2009-03-31 15:01:52
|
Author: bellmich Date: Tue Mar 31 17:01:40 2009 New Revision: 201 URL: http://libwbxml.opensync.org/changeset/201 Log: added ChangeLog entries from r199 and r200 Modified: wbxml2/trunk/ChangeLog Modified: wbxml2/trunk/ChangeLog ============================================================================== --- wbxml2/trunk/ChangeLog Tue Mar 31 16:34:35 2009 (r200) +++ wbxml2/trunk/ChangeLog Tue Mar 31 17:01:40 2009 (r201) @@ -1,3 +1,8 @@ + * Fixed bashisms in launchTest.sh + * Fixed Sun Studio CC and GCC warnings. + * Fixed Testing.cmake to not set GCC specific compiler and linker + flags for other compilers. + 2009-03-30 Michael Bell <mic...@we...> * Released 0.10.5 * Fixed library installation path for win32 (ticket #31) |
From: <svn...@op...> - 2009-03-31 14:56:41
|
Author: bellmich Date: Tue Mar 31 16:56:29 2009 New Revision: 5491 URL: http://www.opensync.org/changeset/5491 Log: - migrated OSyncAnchor to OSyncSinkStateDB - fixed config.h and Doxyfile generation Modified: plugins/ldap-sync/CMakeLists.txt plugins/ldap-sync/src/ldap_plugin.c plugins/ldap-sync/src/ldap_plugin.h Modified: plugins/ldap-sync/CMakeLists.txt ============================================================================== --- plugins/ldap-sync/CMakeLists.txt Tue Mar 31 16:41:53 2009 (r5490) +++ plugins/ldap-sync/CMakeLists.txt Tue Mar 31 16:56:29 2009 (r5491) @@ -69,7 +69,7 @@ IF ( DOXYGEN_DOT_EXECUTABLE ) SET( HAVE_DOT "YES" ) ENDIF ( DOXYGEN_DOT_EXECUTABLE ) - CONFIGURE_FILE( "Doxyfile.in" "Doxyfile" ) + CONFIGURE_FILE( "Doxyfile.in" "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" ) ADD_CUSTOM_TARGET( doxygen ${DOXYGEN_EXECUTABLE} ) ENDIF ( DOXYGEN_EXECUTABLE ) @@ -114,7 +114,7 @@ ################### config.h ############################# SET( SHARE_INSTALL_DIR "${SHARE_INSTALL_DIR}" CACHE PATH "Installation directory for configuration files and schemata") -CONFIGURE_FILE( "config.h.cmake" "config.h" ) +CONFIGURE_FILE( "config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/config.h" ) Modified: plugins/ldap-sync/src/ldap_plugin.c ============================================================================== --- plugins/ldap-sync/src/ldap_plugin.c Tue Mar 31 16:41:53 2009 (r5490) +++ plugins/ldap-sync/src/ldap_plugin.c Tue Mar 31 16:56:29 2009 (r5491) @@ -382,7 +382,7 @@ * anything about the comparison. */ -osync_bool ldap_plugin_check_anchor_system(OSyncContext *ctx, sink_environment *sinkenv, OSyncError **error) +osync_bool ldap_plugin_check_state_system(OSyncContext *ctx, sink_environment *sinkenv, OSyncError **error) { char *timestamp = NULL; @@ -407,20 +407,20 @@ // Get the latest stored anchor from the device char *path_field = g_strdup_printf("path_%s", osync_objtype_sink_get_name(sinkenv->sink)); - osync_bool anchor_match; - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sinkenv->sink); - if (anchor == NULL) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: anchor = NULL for objtype \"%s\". Ignoring for now.\n", __FILE__, __LINE__, osync_objtype_sink_get_name(sinkenv->sink)); + osync_bool state_match; + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sinkenv->sink); + if (state_db == NULL) { + osync_trace(TRACE_ERROR, "%s:%i: ERROR: state_db = NULL for objtype \"%s\". Ignoring for now.\n", __FILE__, __LINE__, osync_objtype_sink_get_name(sinkenv->sink)); goto out; } - timestamp = osync_anchor_retrieve(anchor, "latest_timestamp", error); + timestamp = osync_sink_state_get(state_db, "latest_timestamp", error); if (timestamp) { osync_trace(TRACE_INTERNAL, "Latest timestamp in anchordb is: %s (objtype: \"%s\")\n", timestamp, osync_objtype_sink_get_name(sinkenv->sink)); #ifdef DEBUG_anchor - ldap_plugin_printf("%s:%i: Latest timestamp for objtype \"%s\" in anchordb is: \"%s\"", __FILE__, __LINE__, osync_objtype_sink_get_name(sinkenv->sink), timestamp); + ldap_plugin_printf("%s:%i: Latest timestamp for objtype \"%s\" in state_db is: \"%s\"", __FILE__, __LINE__, osync_objtype_sink_get_name(sinkenv->sink), timestamp); #endif } else { @@ -433,21 +433,21 @@ if (sinkenv->latest_timestamp && sinkenv->latest_timestamp[0]) { - if (!osync_anchor_compare(anchor, "latest_timestamp", sinkenv->latest_timestamp, &anchor_match, error)) { + if (!osync_sink_state_equal(state_db, "latest_timestamp", sinkenv->latest_timestamp, &state_match, error)) { if (!osync_error_is_set(error)) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_anchor_compare() has failed.", __FILE__, __LINE__); + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_sink_state_equal() has failed.", __FILE__, __LINE__); } goto error; } } else { #ifdef DEBUG_anchor - ldap_plugin_printf("%s:%i: sinkenv->latest_timestamp was NULL. Therefore setting anchor_match to FALSE.", __FILE__, __LINE__); + ldap_plugin_printf("%s:%i: sinkenv->latest_timestamp was NULL. Therefore setting state_match to FALSE.", __FILE__, __LINE__); #endif - anchor_match = FALSE; + state_match = FALSE; } - if (!anchor_match) { + if (!state_match) { #ifdef DEBUG_anchor ldap_plugin_printf("%s:%i: Anchor value differs from our own one, therefore setting \"slow-sync\":", __FILE__, __LINE__); #endif @@ -4015,16 +4015,16 @@ osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: tt = NULL.\n", __FILE__, __LINE__); } - // Store it in anchordb. - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); - if (anchor == NULL) { - osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: anchor = NULL.\n", __FILE__, __LINE__); + // Store it in state database. + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); + if (state_db == NULL) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: state_db = NULL.\n", __FILE__, __LINE__); goto error; } - if (!osync_anchor_update(anchor, "latest_timestamp", sinkenv->latest_timestamp, &error)) { + if (!osync_sink_state_set(state_db, "latest_timestamp", sinkenv->latest_timestamp, &error)) { if (!osync_error_is_set(&error)) { - osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_anchor_update() has failed.\n", __FILE__, __LINE__); + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_sink_state_set() has failed.\n", __FILE__, __LINE__); } goto error; @@ -4110,13 +4110,13 @@ - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sinkenv->sink); - if (anchor == NULL) { + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sinkenv->sink); + if (state_db == NULL) { osync_trace(TRACE_ERROR, "%s:%i: ERROR: anchor = NULL for objtype \"%s\". Ignoring for now.\n", __FILE__, __LINE__, osync_objtype_sink_get_name(sinkenv->sink)); } else { - timestamp = osync_anchor_retrieve(anchor, "latest_timestamp", error); + timestamp = osync_sink_state_get(state_db, "latest_timestamp", error); #ifdef DEBUG_anchor - ldap_plugin_printf("%s:%i: osync_anchor_retrieve() returned: \"%s\"", __FILE__, __LINE__, timestamp ? timestamp : "NULL"); + ldap_plugin_printf("%s:%i: osync_sink_state_get() returned: \"%s\"", __FILE__, __LINE__, timestamp ? timestamp : "NULL"); #endif } @@ -4425,8 +4425,8 @@ osync_objtype_sink_enable_hashtable(sinkenv->sink, TRUE); // Initialize anchor system - osync_objtype_sink_enable_anchor(sinkenv->sink, TRUE); - osync_trace(TRACE_INTERNAL, "%s:%i: Having called \"osync_objtype_sink_enable_anchor(sinkenv->sink, TRUE);\"; sinkenv = %p, sinkenv->sink = %p", __FILE__, __LINE__, sinkenv, sinkenv->sink); + osync_objtype_sink_enable_state_db(sinkenv->sink, TRUE); + osync_trace(TRACE_INTERNAL, "%s:%i: Having called \"osync_objtype_sink_enable_state_db(sinkenv->sink, TRUE);\"; sinkenv = %p, sinkenv->sink = %p", __FILE__, __LINE__, sinkenv, sinkenv->sink); Modified: plugins/ldap-sync/src/ldap_plugin.h ============================================================================== --- plugins/ldap-sync/src/ldap_plugin.h Tue Mar 31 16:41:53 2009 (r5490) +++ plugins/ldap-sync/src/ldap_plugin.h Tue Mar 31 16:56:29 2009 (r5491) @@ -308,8 +308,8 @@ osync_bool anonymous; ///< Bind as anonymous user osync_bool ldap_read, ldap_write; ///< Read/Write permissions int ldap_version; ///< LDAP version (2 or 3) - // char *anchor_path; ///< For the anchor system. - // OSyncAnchor *anchor; ///< For the anchor system + // char *state_name; ///< For the state database + // OSyncSinkStateDB *state_db; ///< For the state database char *latest_timestamp; ///< For the anchor system. osync_bool evolution_support; ///< Whether or not the LDAP server supports ///< the "evolutionPerson" objectclass. |
From: <svn...@op...> - 2009-03-31 14:42:09
|
Author: henrik Date: Tue Mar 31 16:41:53 2009 New Revision: 5490 URL: http://www.opensync.org/changeset/5490 Log: migrated from OSyncAnchor to OSyncSinkStateDB Modified: plugins/mozilla-sync/trunk/src/mozilla-sync.cpp Modified: plugins/mozilla-sync/trunk/src/mozilla-sync.cpp ============================================================================== --- plugins/mozilla-sync/trunk/src/mozilla-sync.cpp Tue Mar 31 16:41:50 2009 (r5489) +++ plugins/mozilla-sync/trunk/src/mozilla-sync.cpp Tue Mar 31 16:41:53 2009 (r5490) @@ -766,8 +766,8 @@ OSyncError *error = NULL; LOG(10, "Updating anchor to value [%s]", db->szAnchorValue); - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(pOSyncObjTypeSink); - if (!osync_anchor_update(anchor, db->szAnchorKey, db->szAnchorValue, &error)) { + OSyncSinkStateDB *pStateDB = osync_objtype_sink_get_state_db(pOSyncObjTypeSink); + if (!osync_sink_state_set(pStateDB, db->szAnchorKey, db->szAnchorValue, &error)) { osync_context_report_osyncerror(pOSyncContext, error); LOG_EXIT_ERROR_OSYNC_SZ(10, &error, "Could not do osync_anchor_update"); return; } @@ -807,11 +807,10 @@ osync_objtype_sink_set_read_timeout(pOSyncObjTypeSink, 4*60); // 4 minutes - osync_objtype_sink_enable_anchor(pOSyncObjTypeSink, TRUE); - - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(pOSyncObjTypeSink); + osync_objtype_sink_enable_state_db(pOSyncObjTypeSink, TRUE); + OSyncSinkStateDB *pStateDB = osync_objtype_sink_get_state_db(pOSyncObjTypeSink); osync_bool same; - if (!osync_anchor_compare(anchor, db->szAnchorKey, db->szAnchorValue, &same, &error)) { + if (!osync_sink_state_equal(pStateDB, db->szAnchorKey, db->szAnchorValue, &same, &error)) { osync_context_report_osyncerror(pOSyncContext, error); LOG_EXIT_ERROR_OSYNC_SZ(10, &error, "Could not do osync_anchor_compare"); return; } @@ -1049,8 +1048,8 @@ continue; } - // Request anchor functionality from OpenSync - osync_objtype_sink_enable_anchor(sink, TRUE); + // Request state database functionality from OpenSync + osync_objtype_sink_enable_state_db(sink, TRUE); // Request a hashtable from OpenSync osync_objtype_sink_enable_hashtable(sink, TRUE); |
From: <svn...@op...> - 2009-03-31 14:42:02
|
Author: bellmich Date: Tue Mar 31 16:41:50 2009 New Revision: 5489 URL: http://www.opensync.org/changeset/5489 Log: migrated from OSyncAnchor to OSyncSinkStateDB Modified: plugins/opie-sync/src/opie_sync.c Modified: plugins/opie-sync/src/opie_sync.c ============================================================================== --- plugins/opie-sync/src/opie_sync.c Tue Mar 31 16:37:20 2009 (r5488) +++ plugins/opie-sync/src/opie_sync.c Tue Mar 31 16:41:50 2009 (r5489) @@ -286,11 +286,11 @@ if(env->objtype == OPIE_OBJECT_TYPE_NOTE) { /* Check if the notes resource has changed since the last sync */ - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); - osync_bool anchor_result = FALSE; - if(!osync_anchor_compare(anchor, env->plugin_env->notes_path, &anchor_result, &error)) + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); + osync_bool state_match = FALSE; + if(!osync_sink_state_equal(state_db, "notes_path", env->plugin_env->notes_path, &state_match, &error)) goto error; - if(!anchor_result) + if(!state_match) osync_context_report_slowsync(ctx); } @@ -554,8 +554,8 @@ } if(env->objtype == OPIE_OBJECT_TYPE_NOTE) { - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); - if(!osync_anchor_update(anchor, env->plugin_env->notes_path, &error)) + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); + if(!osync_sink_state_set(state_db, "notes_path", env->plugin_env->notes_path, &error)) goto error; } @@ -648,7 +648,7 @@ env->note_env = opie_sync_create_sink_env(env, info, "note", OPIE_FORMAT_XML_NOTE, OPIE_OBJECT_TYPE_NOTE, NULL, "notes", "note", error); if(!env->note_env) goto error_free_env; - osync_objtype_sink_enable_anchor(env->note_env->sink, TRUE); + osync_objtype_sink_enable_state_db(env->note_env->sink, TRUE); env->qcopconn = NULL; env->connected = FALSE; |
From: <svn...@op...> - 2009-03-31 14:37:37
|
Author: bellmich Date: Tue Mar 31 16:37:20 2009 New Revision: 5488 URL: http://www.opensync.org/changeset/5488 Log: - migrated from OSyncAnchor to OSyncSinkStateDB - fixed generation of config.h Modified: plugins/tomboy-sync/CMakeLists.txt plugins/tomboy-sync/src/tomboy_sync.c plugins/tomboy-sync/src/tomboy_sync_dbus.c plugins/tomboy-sync/src/tomboy_sync_file.c Modified: plugins/tomboy-sync/CMakeLists.txt ============================================================================== --- plugins/tomboy-sync/CMakeLists.txt Tue Mar 31 15:48:26 2009 (r5487) +++ plugins/tomboy-sync/CMakeLists.txt Tue Mar 31 16:37:20 2009 (r5488) @@ -22,7 +22,7 @@ OPTION( ENABLE_DBUS "Enable DBus" ON ) ENDIF ( LIBDBUSGLIB_FOUND AND LIBDBUS_FOUND ) -CONFIGURE_FILE( "config.h.cmake" "config.h" ) +CONFIGURE_FILE( "config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/config.h" ) # add uninstall target CONFIGURE_FILE( "${CMAKE_SOURCE_DIR}/cmake/modules/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) Modified: plugins/tomboy-sync/src/tomboy_sync.c ============================================================================== --- plugins/tomboy-sync/src/tomboy_sync.c Tue Mar 31 15:48:26 2009 (r5487) +++ plugins/tomboy-sync/src/tomboy_sync.c Tue Mar 31 16:37:20 2009 (r5488) @@ -36,15 +36,15 @@ g_free(dir); } -osync_bool osync_tomboysync_compare_anchor(OSyncAnchor *anchor, OSyncContext *ctx, const char *new_anchor, OSyncError **error) { +osync_bool osync_tomboysync_homedir_equal(OSyncSinkStateDB *state_db, OSyncContext *ctx, const char *new_path, OSyncError **error) { - osync_bool anchormatch; + osync_bool match; - if ( !osync_anchor_compare(anchor, "anchor_key1", new_anchor, &anchormatch, error) ) { - /* anchor couldn't be compared */ + if ( !osync_sink_state_equal(state_db, "homedir", new_path, &match, error) ) { + /* state value couldn't be compared */ goto error; } - if ( !anchormatch ) { + if ( !match ) { /* request slow sync */ osync_context_report_slowsync(ctx); } @@ -228,7 +228,7 @@ osync_objtype_sink_enable_hashtable(dir->sink, TRUE); /* Enable Anchors */ - osync_objtype_sink_enable_anchor(dir->sink, TRUE); + osync_objtype_sink_enable_state_db(dir->sink, TRUE); if ( !usedbus ) { if (!osync_tomboysync_file_initalize(tomboyenv, error)) { Modified: plugins/tomboy-sync/src/tomboy_sync_dbus.c ============================================================================== --- plugins/tomboy-sync/src/tomboy_sync_dbus.c Tue Mar 31 15:48:26 2009 (r5487) +++ plugins/tomboy-sync/src/tomboy_sync_dbus.c Tue Mar 31 16:37:20 2009 (r5488) @@ -226,8 +226,8 @@ OSyncTomboyDir *dir = (OSyncTomboyDir*)userdata; OSyncTomboyEnv *tomboyenv = dir->env; - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); - if ( !osync_anchor_update(anchor, "anchor_key1", tomboyenv->homedir_path, &error) ) { + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); + if ( !osync_sink_state_set(state_db, "homedir", tomboyenv->homedir_path, &error) ) { goto error; } @@ -438,9 +438,9 @@ tomboyenv->proxy = dbus_g_proxy_new_for_name(tomboyenv->connection, TOMBOY_DBUS_NAME, TOMBOY_DBUS_PATH, TOMBOY_DBUS_INTERFACE); - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(dir->sink); + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(dir->sink); - if (!osync_tomboysync_compare_anchor(anchor, ctx, tomboyenv->homedir_path, &error) ) { + if (!osync_tomboysync_homedir_equal(state_db, ctx, tomboyenv->homedir_path, &error) ) { goto error; } Modified: plugins/tomboy-sync/src/tomboy_sync_file.c ============================================================================== --- plugins/tomboy-sync/src/tomboy_sync_file.c Tue Mar 31 15:48:26 2009 (r5487) +++ plugins/tomboy-sync/src/tomboy_sync_file.c Tue Mar 31 16:37:20 2009 (r5488) @@ -261,9 +261,9 @@ OSyncTomboyDir *dir = (OSyncTomboyDir*)userdata; OSyncTomboyEnv *tomboyenv = dir->env; - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); - if( !osync_anchor_update(anchor, "anchor_key1", tomboyenv->homedir_path, &error) ) { + if( !osync_sink_state_set(state_db, "homedir", tomboyenv->homedir_path, &error) ) { goto error; } @@ -415,9 +415,9 @@ OSyncError *error = NULL; OSyncTomboyDir *dir = (OSyncTomboyDir*)data; OSyncTomboyEnv *tomboyenv = dir->env; - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(dir->sink); + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(dir->sink); - if (!osync_tomboysync_compare_anchor(anchor, ctx, tomboyenv->homedir_path, &error) ) { + if (!osync_tomboysync_homedir_equal(state_db, ctx, tomboyenv->homedir_path, &error) ) { goto error; } |
From: <svn...@op...> - 2009-03-31 14:34:42
|
Author: bellmich Date: Tue Mar 31 16:34:35 2009 New Revision: 200 URL: http://libwbxml.opensync.org/changeset/200 Log: removed bashisms Modified: wbxmlTestSuite/trunk/launchTests.sh Modified: wbxmlTestSuite/trunk/launchTests.sh ============================================================================== --- wbxmlTestSuite/trunk/launchTests.sh Tue Mar 31 16:31:54 2009 (r199) +++ wbxmlTestSuite/trunk/launchTests.sh Tue Mar 31 16:34:35 2009 (r200) @@ -57,9 +57,10 @@ TEST_SUITE_DIR=`dirname $0` fi -cd "$TEST_SUITE_DIR" +cd "$TEST_SUITE_DIR" || exit 1 +PWD=`pwd` -echo Test suite directory is `pwd` +echo Test suite directory is $PWD # Create temporary directory TMP_DIR=`mktemp -d -t LibWBXMLTestSuite.XXX` @@ -67,10 +68,10 @@ # execute only a special test directory if [ " $2" != " " ] then - DIRLIST=$(find `pwd` -maxdepth 1 -type d -name $2 -print | sort) + DIRLIST=`find $PWD/. \( -type d -a -name $2 -a ! -name . -prune \) -print | sort` if [ ! "$DIRLIST" ] then - DIRLIST=$(find `pwd` -maxdepth 1 -type d ! -name "*svn*" -print | sort) + DIRLIST=`find $PWD/. \( -type d -a ! -name "*svn*" -a ! -name . -prune \) -print | sort` COUNTER=0 for ITEM in $DIRLIST do @@ -83,7 +84,7 @@ DIRLIST=$RESULT fi else - DIRLIST=$(find `pwd` -maxdepth 1 -type d ! -name "*svn*" -print | sort) + DIRLIST=`find $PWD/. \( -type d -a ! -name "*svn*" -a ! -name . -prune \) -print | sort` fi # For each directory @@ -98,16 +99,16 @@ # execute only a special test in a directory if [ `basename $i` != 'ddf' ]; then - TESTLIST=$(find $i -maxdepth 1 -type f -name "*.xml" -print | sort ) + TESTLIST=`find $i/. \( -type f -name "*.xml" -a ! -name . -prune \) -print | sort` else - TESTLIST=$(find $i -maxdepth 1 -type f \( -name "*.ddf" -or -name "*.xml" \) -print | sort ) + TESTLIST=`find $i/. \( -type f \( -name "*.ddf" -or -name "*.xml" \) -a ! -name . -prune \) -print | sort` fi if [ " $3" != " " ] then COUNTER=0 for ITEM in $TESTLIST do - COUNTER=$(($COUNTER + 1)) + COUNTER=`expr $COUNTER + 1` if [ "$COUNTER" -eq "$3" ] then TESTCASE=$ITEM |
From: <svn...@op...> - 2009-03-31 14:32:07
|
Author: bellmich Date: Tue Mar 31 16:31:54 2009 New Revision: 199 URL: http://libwbxml.opensync.org/changeset/199 Log: fixed warnings from Sun Studio CC Modified: wbxml2/trunk/src/wbxml_encoder.c wbxml2/trunk/src/wbxml_parser.c Modified: wbxml2/trunk/src/wbxml_encoder.c ============================================================================== --- wbxml2/trunk/src/wbxml_encoder.c Mon Mar 30 11:54:06 2009 (r198) +++ wbxml2/trunk/src/wbxml_encoder.c Tue Mar 31 16:31:54 2009 (r199) @@ -2149,8 +2149,7 @@ * * Assumption: The buffer is already normalized. */ - // if (wbxml_buffer_search_cstr(elt->u.str, (WB_UTINY *) encoder->lang->extValueTable[j].xmlName, 0, &index)) - if (wbxml_buffer_compare_cstr(elt->u.str, (WB_UTINY *) encoder->lang->extValueTable[j].xmlName) == 0) + if (wbxml_buffer_compare_cstr(elt->u.str, (WB_TINY *) encoder->lang->extValueTable[j].xmlName) == 0) { /* Create new Value Element */ if ((new_elt = wbxml_value_element_create()) == NULL) { @@ -3131,7 +3130,6 @@ WB_ULONG i = 0, len = 0; WB_UTINY ch = 0; WBXMLError ret = WBXML_OK; - WB_BOOL is_utc = FALSE; WB_UTINY octets[6]; WBXMLBuffer *component = NULL; @@ -3322,11 +3320,11 @@ WB_ULONG len = WBXML_STRLEN(buffer); /* long version of ISO 8601 should be inline encoded */ - if (index(buffer, '-')) + if (strchr((WB_TINY *) buffer, '-')) use_inline = TRUE; - if (index(buffer, '+')) + if (strchr((WB_TINY *) buffer, '+')) use_inline = TRUE; - if (index(buffer, ':')) + if (strchr((WB_TINY *) buffer, ':')) use_inline = TRUE; /* timezone Z should be inline encoded */ Modified: wbxml2/trunk/src/wbxml_parser.c ============================================================================== --- wbxml2/trunk/src/wbxml_parser.c Mon Mar 30 11:54:06 2009 (r198) +++ wbxml2/trunk/src/wbxml_parser.c Tue Mar 31 16:31:54 2009 (r199) @@ -718,11 +718,23 @@ WB_ULONG startpos = parser->pos; #endif /* WBXML_LIB_VERBOSE */ - WBXMLError ret = parse_mb_uint32(parser, &parser->charset); + unsigned int charset = 0; + WBXMLError ret = parse_mb_uint32(parser, &charset); + + if (ret != WBXML_OK) { + WBXML_DEBUG((WBXML_PARSER, "(%d) failed to parse character set", startpos)); + return ret; + } + + const char *charset_name = NULL; + if (!wbxml_charset_get_name(charset, &charset_name)) { + return WBXML_ERROR_NO_CHARSET_CONV; + } + parser->charset = (WBXMLCharsetMIBEnum) charset; WBXML_DEBUG((WBXML_PARSER, "(%d) Parsed charset: '0x%X'", startpos, parser->charset)); - return ret; + return WBXML_OK; } @@ -1696,8 +1708,8 @@ } else { - WB_TINY masks[5] = {0xFC, 0xF8, 0xF0, 0xE0, 0xC0}; - WB_TINY entity[7] = {0, 0, 0, 0, 0, 0, 0}; + WB_UTINY masks[5] = {0xFC, 0xF8, 0xF0, 0xE0, 0xC0}; + WB_UTINY entity[7] = {0, 0, 0, 0, 0, 0, 0}; int index = 5; while (code >= 0x40) @@ -1708,7 +1720,7 @@ entity[index] = masks[index] | code; /* Create result buffer */ - if ( (*result = wbxml_buffer_create_from_cstr(entity + index)) == NULL ) { + if ( (*result = wbxml_buffer_create_from_cstr((WB_TINY *) entity + index)) == NULL ) { return WBXML_ERROR_NOT_ENOUGH_MEMORY; } |
From: <svn...@op...> - 2009-03-31 13:48:35
|
Author: bellmich Date: Tue Mar 31 15:48:26 2009 New Revision: 5487 URL: http://www.opensync.org/changeset/5487 Log: the flags only work for GCC Modified: branches/3rd-party-cmake-modules/modules/Testing.cmake Modified: branches/3rd-party-cmake-modules/modules/Testing.cmake ============================================================================== --- branches/3rd-party-cmake-modules/modules/Testing.cmake Tue Mar 31 14:42:35 2009 (r5486) +++ branches/3rd-party-cmake-modules/modules/Testing.cmake Tue Mar 31 15:48:26 2009 (r5487) @@ -1,12 +1,14 @@ ENABLE_TESTING() INCLUDE( CTest ) -SET( CMAKE_C_FLAGS_PROFILING "-g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wwrite-strings -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Compiler Flags" ) -# SET( CMAKE_C_FLAGS_PROFILING "-g -O0 -Wall -W -Wextra -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wwrite-strings -pedantic -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Compiler Flags" ) -SET( CMAKE_CXX_FLAGS_PROFILING "-g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wwrite-strings -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Compiler Flags" ) -SET( CMAKE_SHARED_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags" ) -SET( CMAKE_MODULE_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags" ) -SET( CMAKE_EXEC_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags" ) +IF ( CMAKE_COMPILER_IS_GNUCC ) + SET( CMAKE_C_FLAGS_PROFILING "-g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wwrite-strings -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Compiler Flags" ) + # SET( CMAKE_C_FLAGS_PROFILING "-g -O0 -Wall -W -Wextra -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wwrite-strings -pedantic -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Compiler Flags" ) + SET( CMAKE_CXX_FLAGS_PROFILING "-g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wwrite-strings -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Compiler Flags" ) + SET( CMAKE_SHARED_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags" ) + SET( CMAKE_MODULE_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags" ) + SET( CMAKE_EXEC_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags" ) +ENDIF ( CMAKE_COMPILER_IS_GNUCC ) MACRO( BUILD_CHECK_TEST _testName _testSource ) |
From: <svn...@op...> - 2009-03-31 12:42:50
|
Author: bellmich Date: Tue Mar 31 14:42:35 2009 New Revision: 5486 URL: http://www.opensync.org/changeset/5486 Log: migrated from OSyncAnchor to OSyncSinkStateDB Modified: plugins/syncml/src/syncml_callbacks.c plugins/syncml/src/syncml_common.c plugins/syncml/src/syncml_common.h plugins/syncml/src/syncml_ds_client.c Modified: plugins/syncml/src/syncml_callbacks.c ============================================================================== --- plugins/syncml/src/syncml_callbacks.c Tue Mar 31 14:32:43 2009 (r5485) +++ plugins/syncml/src/syncml_callbacks.c Tue Mar 31 14:42:35 2009 (r5486) @@ -254,9 +254,14 @@ { SmlPluginEnv *env = userdata; OSyncError *oerror = NULL; - osync_assert(env->anchor); - /* TODO: error report - via SmlError? */ - return osync_anchor_retrieve(env->anchor, &oerror); + osync_assert(env->stateDB); + char *value = osync_sink_state_get(env->stateDB, name, &oerror); + if (oerror) { + smlErrorSet(error, SML_ERROR_GENERIC, "%s", osync_error_print(&oerror)); + osync_error_unref(&oerror); + value = NULL; + } + return value; } SmlBool _set_anchor( @@ -268,9 +273,14 @@ { SmlPluginEnv *env = userdata; OSyncError *oerror = NULL; - osync_assert(env->anchor); - /* TODO: error reporting - via SmlError? */ - return osync_anchor_update(env->anchor, value, &oerror); + osync_assert(env->stateDB); + SmlBool result = osync_sink_state_set(env->stateDB, name, value, &oerror); + if (oerror) { + smlErrorSet(error, SML_ERROR_GENERIC, "%s", osync_error_print(&oerror)); + osync_error_unref(&oerror); + result = FALSE; + } + return result; } /* ************************************ */ Modified: plugins/syncml/src/syncml_common.c ============================================================================== --- plugins/syncml/src/syncml_common.c Tue Mar 31 14:32:43 2009 (r5485) +++ plugins/syncml/src/syncml_common.c Tue Mar 31 14:42:35 2009 (r5486) @@ -804,12 +804,12 @@ osync_objtype_sink_set_userdata(mainsink, env); - /* Prepare anchor */ - osync_objtype_sink_enable_anchor(mainsink, TRUE); - if (!osync_objtype_sink_load_anchor(mainsink, info, oerror)) + /* Prepare state database */ + osync_objtype_sink_enable_state_db(mainsink, TRUE); + if (!osync_objtype_sink_open_state_db(mainsink, info, oerror)) goto error_free_env; - env->anchor = osync_objtype_sink_get_anchor(mainsink); + env->stateDB = osync_objtype_sink_get_state_db(mainsink); osync_plugin_info_set_main_sink(info, mainsink); osync_objtype_sink_unref(mainsink); Modified: plugins/syncml/src/syncml_common.h ============================================================================== --- plugins/syncml/src/syncml_common.h Tue Mar 31 14:32:43 2009 (r5485) +++ plugins/syncml/src/syncml_common.h Tue Mar 31 14:42:35 2009 (r5486) @@ -99,7 +99,7 @@ /* environment data */ OSyncPluginInfo *pluginInfo; - OSyncAnchor *anchor; + OSyncSinkStateDB *stateDB; GSource *source; GSourceFuncs *source_functions; Modified: plugins/syncml/src/syncml_ds_client.c ============================================================================== --- plugins/syncml/src/syncml_ds_client.c Tue Mar 31 14:32:43 2009 (r5485) +++ plugins/syncml/src/syncml_ds_client.c Tue Mar 31 14:42:35 2009 (r5486) @@ -45,8 +45,8 @@ osync_objtype_sink_set_get_changes_func(sink, ds_client_get_changeinfo); osync_objtype_sink_set_batch_commit_func(sink, ds_client_batch_commit); - // Request an anchor from the framework. - osync_objtype_sink_enable_anchor(sink, TRUE); + /* Request a state database from the framework. */ + osync_objtype_sink_enable_state_db(sink, TRUE); const char *objtype = osync_objtype_sink_get_name(sink); OSyncPluginResource *res = osync_plugin_config_find_active_resource(config, objtype); |
From: <svn...@op...> - 2009-03-31 12:32:55
|
Author: bellmich Date: Tue Mar 31 14:32:43 2009 New Revision: 5485 URL: http://www.opensync.org/changeset/5485 Log: migrated from OSyncAnchor to OSyncSinkStateDB Modified: plugins/file-sync/src/file_sync.c Modified: plugins/file-sync/src/file_sync.c ============================================================================== --- plugins/file-sync/src/file_sync.c Tue Mar 31 13:38:25 2009 (r5484) +++ plugins/file-sync/src/file_sync.c Tue Mar 31 14:32:43 2009 (r5485) @@ -59,13 +59,13 @@ osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, userdata); OSyncFileDir *dir = userdata; - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); - osync_bool anchormatch; + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); + osync_bool pathmatch; - if (!osync_anchor_compare(anchor, "path", dir->path, &anchormatch, &error)) + if (!osync_sink_state_equal(state_db, "path", dir->path, &pathmatch, &error)) goto error; - if (!anchormatch) + if (!pathmatch) osync_context_report_slowsync(ctx); if (!g_file_test(dir->path, G_FILE_TEST_IS_DIR)) { @@ -492,9 +492,9 @@ OSyncError *error = NULL; OSyncFileDir *dir = userdata; - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); - if (!osync_anchor_update(anchor, "path", dir->path, &error)) + if (!osync_sink_state_set(state_db, "path", dir->path, &error)) goto error; osync_context_report_success(ctx); @@ -574,8 +574,8 @@ * again once the functions are called */ osync_objtype_sink_set_userdata(dir->sink, dir); - /* Request an anchor from the framework. */ - osync_objtype_sink_enable_anchor(dir->sink, TRUE); + /* Request a state database from the framework. */ + osync_objtype_sink_enable_state_db(dir->sink, TRUE); /* Request an hashtable from the framework. */ osync_objtype_sink_enable_hashtable(dir->sink, TRUE); |
From: <svn...@op...> - 2009-03-31 11:38:32
|
Author: bellmich Date: Tue Mar 31 13:38:25 2009 New Revision: 5484 URL: http://www.opensync.org/changeset/5484 Log: fixed documentation for migration of OSyncAnchor to OSyncSinkStateDB Modified: trunk/docs/examples/plugins/src/plugin.c trunk/docs/examples/plugins/src/simple_plugin.c trunk/docs/whitepaper/plugins.tex Modified: trunk/docs/examples/plugins/src/plugin.c ============================================================================== --- trunk/docs/examples/plugins/src/plugin.c Tue Mar 31 13:30:58 2009 (r5483) +++ trunk/docs/examples/plugins/src/plugin.c Tue Mar 31 13:38:25 2009 (r5484) @@ -38,10 +38,10 @@ //you can also use the anchor system to detect a device reset //or some parameter change here. Check the docs to see how it works //Now you get the last stored anchor from the device - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); osync_bool anchormatch; - if (!osync_anchor_compare(anchor, "anchor_key", "dynamic_anchor_value", &anchormatch, &error)) { + if (!osync_sink_state_equal(state_db, "anchor_key", "dynamic_anchor_value", &anchormatch, &error)) { /* anchor couldn't be compared */ goto error; } @@ -235,8 +235,8 @@ //If we use anchors we have to update it now. //Now you get/calculate the current anchor of the device - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); - if (!osync_anchor_update(anchor, "anchor_key", "dynamic_anchor_value", &error)) { + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); + if (!osync_sink_state_set(state_db, "anchor_key", "dynamic_anchor_value", &error)) { goto error; } Modified: trunk/docs/examples/plugins/src/simple_plugin.c ============================================================================== --- trunk/docs/examples/plugins/src/simple_plugin.c Tue Mar 31 13:30:58 2009 (r5483) +++ trunk/docs/examples/plugins/src/simple_plugin.c Tue Mar 31 13:38:25 2009 (r5484) @@ -33,10 +33,10 @@ //you can also use the anchor system to detect a device reset //or some parameter change here. Check the docs to see how it works //Now you get the last stored anchor from the device - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); osync_bool anchormatch; - if (!osync_anchor_compare(anchor, "anchor_key", "dynamic_anchor_value", &anchormatch, &error)) { + if (!osync_sink_state_equal(state_db, "anchor_key", "dynamic_anchor_value", &anchormatch, &error)) { /* anchor couldn't be compared */ goto error; } @@ -166,8 +166,8 @@ //If we use anchors we have to update it now. //Now you get/calculate the current anchor of the device - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); - if (!osync_anchor_update(anchor, "anchor_key", "dynamic_anchor_value", &error)) + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); + if (!osync_sink_state_set(state_db, "anchor_key", "dynamic_anchor_value", &error)) goto error; //Answer the call Modified: trunk/docs/whitepaper/plugins.tex ============================================================================== --- trunk/docs/whitepaper/plugins.tex Tue Mar 31 13:30:58 2009 (r5483) +++ trunk/docs/whitepaper/plugins.tex Tue Mar 31 13:38:25 2009 (r5484) @@ -150,7 +150,7 @@ otherwise be called for each Object Type for the same interface. It is usual at this stage to compare the stored anchor with that from the peer -using \verb|osync_anchor_compare|. If the anchor has changed then the need for +using \verb|osync_sink_state_equal|. If the anchor has changed then the need for a slow sync should be set using \verb|osync_objtype_sink_set_slowsync| This function MUST only establish a connection to the device or resource. After |
From: <svn...@op...> - 2009-03-31 11:31:01
|
Author: bellmich Date: Tue Mar 31 13:30:58 2009 New Revision: 5483 URL: http://www.opensync.org/changeset/5483 Log: renamed OSyncAnchor to OSyncSinkStateDB Modified: trunk/opensync.sym trunk/tests/mock-plugin/mock_sync.c Modified: trunk/opensync.sym ============================================================================== --- trunk/opensync.sym Tue Mar 31 13:30:31 2009 (r5482) +++ trunk/opensync.sym Tue Mar 31 13:30:58 2009 (r5483) @@ -1,6 +1,3 @@ -osync_anchor_compare -osync_anchor_retrieve -osync_anchor_update osync_capabilities_assemble osync_capabilities_get_first osync_capabilities_new @@ -372,10 +369,9 @@ osync_objtype_sink_connect osync_objtype_sink_connect_done osync_objtype_sink_disconnect -osync_objtype_sink_enable_anchor osync_objtype_sink_enable_hashtable +osync_objtype_sink_enable_state_db osync_objtype_sink_find_objformat_sink -osync_objtype_sink_get_anchor osync_objtype_sink_get_changes osync_objtype_sink_get_getchanges osync_objtype_sink_get_hashtable @@ -383,12 +379,13 @@ osync_objtype_sink_get_objformat_sinks osync_objtype_sink_get_preferred_format osync_objtype_sink_get_read +osync_objtype_sink_get_state_db osync_objtype_sink_get_write osync_objtype_sink_is_available osync_objtype_sink_is_enabled -osync_objtype_sink_load_anchor osync_objtype_sink_load_hashtable osync_objtype_sink_new +osync_objtype_sink_open_state_db osync_objtype_sink_read_change osync_objtype_sink_ref osync_objtype_sink_remove_objformat_sink @@ -624,6 +621,9 @@ osync_rand_str osync_sink_engine_get_mapping_entry_engines osync_sink_engine_get_member +osync_sink_state_equal +osync_sink_state_get +osync_sink_state_set osync_strdup osync_strdup_printf osync_strreplace Modified: trunk/tests/mock-plugin/mock_sync.c ============================================================================== --- trunk/tests/mock-plugin/mock_sync.c Tue Mar 31 13:30:31 2009 (r5482) +++ trunk/tests/mock-plugin/mock_sync.c Tue Mar 31 13:30:58 2009 (r5483) @@ -52,8 +52,8 @@ static void mock_connect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) { - osync_bool anchor_compare_match; - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); + osync_bool state_match; + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); MockDir *dir = data; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, data); @@ -73,7 +73,7 @@ if (mock_get_error(info->memberid, "CONNECT_SLOWSYNC")) osync_context_report_slowsync(ctx); - /* Skip Objtype related stuff like hashtable and anchor */ + /* Skip Objtype related stuff like hashtable and state db */ if (mock_get_error(info->memberid, "MAINSINK_CONNECT")) goto end; @@ -87,9 +87,9 @@ */ dir->connect_done = FALSE; - osync_assert_msg(osync_anchor_compare(anchor, "path", dir->path, &anchor_compare_match, NULL), "Not expected to fail"); + osync_assert_msg(osync_sink_state_equal(state_db, "path", dir->path, &state_match, NULL), "Not expected to fail"); - if (!anchor_compare_match) + if (!state_match) osync_context_report_slowsync(ctx); osync_assert(g_file_test(dir->path, G_FILE_TEST_IS_DIR)); @@ -553,7 +553,7 @@ static void mock_sync_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, data); - OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); MockDir *dir = data; if (mock_get_error(info->memberid, "SYNC_DONE_ERROR")) { @@ -563,7 +563,7 @@ if (mock_get_error(info->memberid, "SYNC_DONE_TIMEOUT")) return; - osync_assert_msg(osync_anchor_update(anchor, "path", dir->path, NULL), "Not expected to fail!"); + osync_assert_msg(osync_sink_state_set(state_db, "path", dir->path, NULL), "Not expected to fail!"); osync_context_report_success(ctx); @@ -672,7 +672,7 @@ osync_objtype_sink_set_userdata(sink, dir); /* Request an Anchor */ - osync_objtype_sink_enable_anchor(sink, TRUE); + osync_objtype_sink_enable_state_db(sink, TRUE); /* Request an Hashtable */ osync_objtype_sink_enable_hashtable(sink, TRUE); |
From: <svn...@op...> - 2009-03-31 11:31:01
|
Author: bellmich Date: Tue Mar 31 13:30:31 2009 New Revision: 5482 URL: http://www.opensync.org/changeset/5482 Log: renamed OSyncAnchor to OSyncSinkStateDB Modified: trunk/tools/osyncplugin.c Modified: trunk/tools/osyncplugin.c ============================================================================== --- trunk/tools/osyncplugin.c Tue Mar 31 13:29:49 2009 (r5481) +++ trunk/tools/osyncplugin.c Tue Mar 31 13:30:31 2009 (r5482) @@ -457,7 +457,7 @@ list = objtypesinks; while(list) { OSyncObjTypeSink *sink = (OSyncObjTypeSink*)list->data; - if (!osync_objtype_sink_load_anchor(sink, plugin_info, error)) + if (!osync_objtype_sink_open_state_db(sink, plugin_info, error)) goto error; if (!osync_objtype_sink_load_hashtable(sink, plugin_info, error)) |
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; |
From: <svn...@op...> - 2009-03-31 11:29:18
|
Author: bellmich Date: Tue Mar 31 13:29:05 2009 New Revision: 5480 URL: http://www.opensync.org/changeset/5480 Log: - renamed OSyncAnchor to OSyncSinkStateDB - renamed some functions because of the getter/setter pattern Modified: trunk/opensync/helper/opensync_sink_state_db.c trunk/opensync/helper/opensync_sink_state_db.h trunk/opensync/helper/opensync_sink_state_db_internals.h trunk/opensync/helper/opensync_sink_state_db_private.h Modified: trunk/opensync/helper/opensync_sink_state_db.c ============================================================================== --- trunk/opensync/helper/opensync_sink_state_db.c Tue Mar 31 11:28:47 2009 (r5479) +++ trunk/opensync/helper/opensync_sink_state_db.c Tue Mar 31 13:29:05 2009 (r5480) @@ -27,15 +27,17 @@ #include "opensync_sink_state_db_internals.h" #include "opensync_sink_state_db_private.h" -osync_bool osync_anchor_create(OSyncAnchor *anchor, OSyncError **error) +static osync_bool osync_sink_states_table_create( + OSyncSinkStateDB *sinkStateDB, + OSyncError **error) { char *query = NULL; - osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, anchor, error); + osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, sinkStateDB, error); /* TODO: How portable to other databes is UNIQUE? */ - query = osync_strdup("CREATE TABLE tbl_anchor (id INTEGER PRIMARY KEY, key VARCHAR UNIQUE, value VARCHAR, objtype VARCHAR)"); + query = osync_strdup("CREATE TABLE tbl_sink_states (id INTEGER PRIMARY KEY, key VARCHAR UNIQUE, value VARCHAR, objtype VARCHAR)"); - if (!osync_db_query(anchor->db, query, error)) { + if (!osync_db_query(sinkStateDB->db, query, error)) { osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); osync_free(query); return FALSE; @@ -47,133 +49,143 @@ return TRUE; } -OSyncAnchor *osync_anchor_new(const char *filename, const char *objtype, OSyncError **error) +OSyncSinkStateDB *osync_sink_state_db_new( + const char *filename, + const char *objtype, + OSyncError **error) { - OSyncAnchor *anchor = NULL; + OSyncSinkStateDB *sinkStateDB = NULL; int ret = 0; osync_trace(TRACE_ENTRY, "%s(%s, %s, %p)", __func__, __NULLSTR(filename), __NULLSTR(objtype), error); - anchor = osync_try_malloc0(sizeof(OSyncAnchor), error); - if (!anchor) + sinkStateDB = osync_try_malloc0(sizeof(OSyncSinkStateDB), error); + if (!sinkStateDB) goto error; - anchor->ref_count = 1; + sinkStateDB->ref_count = 1; /* Could be NULL, which means object type neutral * or data for the main-sink. */ if (objtype) - anchor->objtype = osync_strdup(objtype); + sinkStateDB->objtype = osync_strdup(objtype); - anchor->db = osync_db_new(error); - if (!anchor->db) - goto error_free_anchor; + sinkStateDB->db = osync_db_new(error); + if (!sinkStateDB->db) + goto error; - if (!osync_db_open(anchor->db, filename, error)) { + if (!osync_db_open(sinkStateDB->db, filename, error)) { osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); - goto error_free_db; + goto error; } - ret = osync_db_table_exists(anchor->db, "tbl_anchor", error); + ret = osync_db_table_exists(sinkStateDB->db, "tbl_sink_states", error); if (ret > 0) { - osync_trace(TRACE_EXIT, "%s: %p", __func__, anchor->db); - return anchor; + osync_trace(TRACE_EXIT, "%s: %p", __func__, sinkStateDB->db); + return sinkStateDB; /* error if ret == -1 */ } else if (ret < 0) { - goto error_free_db; + goto error; } /* ret equal 0 means table does not exist yet. continue and create one. */ - if (!osync_anchor_create(anchor, error)) - goto error_free_db; + if (!osync_sink_states_table_create(sinkStateDB, error)) + goto error; - osync_trace(TRACE_EXIT, "%s: %p", __func__, anchor); - return anchor; + osync_trace(TRACE_EXIT, "%s: %p", __func__, sinkStateDB); + return sinkStateDB; - error_free_db: - osync_free(anchor->db); - error_free_anchor: - osync_anchor_unref(anchor); error: + if (sinkStateDB && sinkStateDB->db) + osync_free(sinkStateDB->db); + if (sinkStateDB) + osync_sink_state_db_unref(sinkStateDB); osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); return NULL; } -OSyncAnchor *osync_anchor_ref(OSyncAnchor *anchor) +OSyncSinkStateDB *osync_sink_state_db_ref(OSyncSinkStateDB *sinkStateDB) { - osync_return_val_if_fail(anchor, NULL); + osync_return_val_if_fail(sinkStateDB, NULL); - g_atomic_int_inc(&(anchor->ref_count)); + g_atomic_int_inc(&(sinkStateDB->ref_count)); - return anchor; + return sinkStateDB; } -void osync_anchor_unref(OSyncAnchor *anchor) +void osync_sink_state_db_unref(OSyncSinkStateDB *sinkStateDB) { - osync_return_if_fail(anchor); + osync_return_if_fail(sinkStateDB); - if (g_atomic_int_dec_and_test(&(anchor->ref_count))) { + if (g_atomic_int_dec_and_test(&(sinkStateDB->ref_count))) { - if (!osync_db_close(anchor->db, NULL)) + if (!osync_db_close(sinkStateDB->db, NULL)) osync_trace(TRACE_INTERNAL, "Can't close database"); - if (anchor->objtype) - osync_free(anchor->objtype); + if (sinkStateDB->objtype) + osync_free(sinkStateDB->objtype); - osync_free(anchor->db); + osync_free(sinkStateDB->db); - osync_free(anchor); + osync_free(sinkStateDB); } } -char *osync_anchor_retrieve(OSyncAnchor *anchor, const char *key, OSyncError **error) +char *osync_sink_state_get( + OSyncSinkStateDB *sinkStateDB, + const char *key, + OSyncError **error) { - char *retanchor = NULL; + char *value = NULL; char *query = NULL, *escaped_key; - osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, anchor, error); - osync_assert(anchor); - osync_assert(anchor->db); + osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, sinkStateDB, error); + osync_assert(sinkStateDB); + osync_assert(sinkStateDB->db); osync_assert(key); escaped_key = osync_db_sql_escape(key); - query = osync_strdup_printf("SELECT value FROM tbl_anchor WHERE key='%s' AND objtype='%s'", - escaped_key, anchor->objtype ? anchor->objtype : ""); + query = osync_strdup_printf("SELECT value FROM tbl_sink_states WHERE key='%s' AND objtype='%s'", + escaped_key, sinkStateDB->objtype ? sinkStateDB->objtype : ""); osync_free(escaped_key); - retanchor = osync_db_query_single_string(anchor->db, query, error); + value = osync_db_query_single_string(sinkStateDB->db, query, error); osync_free(query); if (osync_error_is_set(error)) goto error; - if (!retanchor) - retanchor = osync_strdup(""); + if (!value) + value = osync_strdup(""); - osync_trace(TRACE_EXIT, "%s: %s", __func__, retanchor); - return retanchor; + osync_trace(TRACE_EXIT, "%s: %s", __func__, value); + return value; error: osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); return NULL; } -osync_bool osync_anchor_update(OSyncAnchor *anchor, const char *key, const char *value, OSyncError **error) +osync_bool osync_sink_state_set( + OSyncSinkStateDB *sinkStateDB, + const char *key, + const char *value, + OSyncError **error) { char *escaped_value = NULL, *escaped_key = NULL; char *query = NULL; - osync_trace(TRACE_ENTRY, "%s(%p, %s, %p)", __func__, anchor, __NULLSTR(value), error); - osync_assert(anchor); - osync_assert(anchor->db); + osync_trace(TRACE_ENTRY, "%s(%p, %s, %p)", __func__, sinkStateDB, __NULLSTR(value), error); + osync_assert(sinkStateDB); + osync_assert(sinkStateDB->db); osync_assert(key); osync_assert(value); escaped_key = osync_db_sql_escape(key); escaped_value = osync_db_sql_escape(value); - query = osync_strdup_printf("REPLACE INTO tbl_anchor (objtype, key, value) VALUES('%s', '%s', '%s')", - anchor->objtype ? anchor->objtype : "", escaped_key, escaped_value); + query = osync_strdup_printf("REPLACE INTO tbl_sink_states (objtype, key, value) VALUES('%s', '%s', '%s')", + sinkStateDB->objtype ? sinkStateDB->objtype : "", escaped_key, escaped_value); osync_free(escaped_value); osync_free(escaped_key); - if (!osync_db_query(anchor->db, query, error)) + if (!osync_db_query(sinkStateDB->db, query, error)) goto error; osync_free(query); @@ -186,16 +198,21 @@ return FALSE; } -osync_bool osync_anchor_compare(OSyncAnchor *anchor, const char *key, const char *value, osync_bool *same, OSyncError **error) +osync_bool osync_sink_state_equal( + OSyncSinkStateDB *sinkStateDB, + const char *key, + const char *value, + osync_bool *same, + OSyncError **error) { char *old_value = NULL; - osync_trace(TRACE_ENTRY, "%s(%p, %s, %s, %p, %p)", __func__, anchor, __NULLSTR(key), __NULLSTR(value), same, error); - osync_assert(anchor); + osync_trace(TRACE_ENTRY, "%s(%p, %s, %s, %p, %p)", __func__, sinkStateDB, __NULLSTR(key), __NULLSTR(value), same, error); + osync_assert(sinkStateDB); osync_assert(key); osync_assert(value); - old_value = osync_anchor_retrieve(anchor, key, error); + old_value = osync_sink_state_get(sinkStateDB, key, error); if (!old_value) goto error; Modified: trunk/opensync/helper/opensync_sink_state_db.h ============================================================================== --- trunk/opensync/helper/opensync_sink_state_db.h Tue Mar 31 11:28:47 2009 (r5479) +++ trunk/opensync/helper/opensync_sink_state_db.h Tue Mar 31 13:29:05 2009 (r5480) @@ -18,18 +18,18 @@ * */ -#ifndef OPENSYNC_ANCHOR_H_ -#define OPENSYNC_ANCHOR_H_ +#ifndef OPENSYNC_SINK_STATE_DB_H_ +#define OPENSYNC_SINK_STATE_DB_H_ /** * @defgroup OSyncHelper OpenSync Helper Module * @ingroup OSyncPublic - * @defgroup OSyncAnchorAPI OpenSync Anchor + * @defgroup OSyncSinkStateDatabaseAPI OpenSync Sink State Database * @ingroup OSyncHelper * @brief Functions to deal with anchors * * The Anchor module stores anchors and peer states from the Member in a - * persistent database (which can be flushed by the Engien anytime!). + * persistent database (which can be flushed by the Engine anytime!). * This "anchor" shoudl get updated once on each sync. * * Example: @@ -49,41 +49,54 @@ */ /*@{*/ -/** @brief Compares the anchor value of key with the supplied value +/** @brief Compares the anchor/state value of key with the supplied value * - * @param anchor Pointer to the anchor object + * @param sinkStateDB Pointer to the sink state database object * @param key the key of the value to compare - * @param value the value to compare with the stored anchor value + * @param value the value to compare with the stored anchor/state value * @param issame Pointer to osync_bool to determine the comaprsion result * @param error Pointer to error struct, which get set on any error - * @returns TRUE if the anchor compare completed successful, FALSE on error. Not the return value of the comparsion! + * @returns TRUE if the anchor/state compare completed successful, FALSE on error. Not the return value of the comparsion! * */ -OSYNC_EXPORT osync_bool osync_anchor_compare(OSyncAnchor *anchor, const char *key, const char *value, osync_bool *issame, OSyncError **error); +OSYNC_EXPORT osync_bool osync_sink_state_equal( + OSyncSinkStateDB *sinkStateDB, + const char *key, + const char *value, + osync_bool *issame, + OSyncError **error); -/** @brief Updates the anchor value of the key +/** @brief Sets the anchor/state value of the key * - * @param anchor Pointer to the anchor object + * @param sinkStateDB Pointer to the sink state database object * @param key the key of the value to set * @param value the new value to set * @param error Pointer to error struct, which get set on any error - * @returns TRUE if anchor update completed successful, FALSE on error. + * @returns TRUE if anchor/state update completed successful, FALSE on error. * */ -OSYNC_EXPORT osync_bool osync_anchor_update(OSyncAnchor *anchor, const char *key, const char *value, OSyncError **error); +OSYNC_EXPORT osync_bool osync_sink_state_set( + OSyncSinkStateDB *sinkStateDB, + const char *key, + const char *value, + OSyncError **error); -/** @brief Retrieves the anchor value of the supplied key +/** @brief Gets the anchor/state value of the supplied key * - * @param anchor Pointer to the anchor object - * @param key The key as string of the anchor value to retrieve + * @param sinkStateDB Pointer to the sink state database object + * @param key The key as string of the anchor/state value to retrieve * @param error Pointer to error struct, which get set on any error - * @returns the value of the anchor if it was found, otherwise an empty string get retruned. + * @returns the value of the anchor/state if it was found, + * otherwise an empty string get returned. * Caller is responsible for freeing the return value with osync_free(). - * NULL on error of retrieving the anchor information. + * NULL on error of retrieving the anchor/state information. * */ -OSYNC_EXPORT char *osync_anchor_retrieve(OSyncAnchor *anchor, const char *key, OSyncError **error); +OSYNC_EXPORT char *osync_sink_state_get( + OSyncSinkStateDB *sinkStateDB, + const char *key, + OSyncError **error); /*@}*/ -#endif /* OPENSYNC_ANCHOR_H_ */ +#endif /* OPENSYNC_SINK_STATE_DB_H_ */ Modified: trunk/opensync/helper/opensync_sink_state_db_internals.h ============================================================================== --- trunk/opensync/helper/opensync_sink_state_db_internals.h Tue Mar 31 11:28:47 2009 (r5479) +++ trunk/opensync/helper/opensync_sink_state_db_internals.h Tue Mar 31 13:29:05 2009 (r5480) @@ -18,52 +18,45 @@ * */ -#ifndef OPENSYNC_ANCHOR_INTERNALS_H_ -#define OPENSYNC_ANCHOR_INTERNALS_H_ +#ifndef OPENSYNC_SINK_STATE_DB_INTERNALS_H_ +#define OPENSYNC_SINK_STATE_DB_INTERNALS_H_ /** - * @defgroup OSyncAnchorInternalAPI OpenSync Anchor Internals + * @defgroup OSyncSinkStateDatabaseInternalAPI OpenSync Sink State Database Internals * @ingroup OSyncHelperPrivate - * @brief Internal functions to deal with anchors + * @brief Internal functions to deal with anchors and other sink related state informations */ /** - * @brief Create the anchor table in the specified database - * - * @param anchor Pointer to the anchor - * @param error Pointer to an error struct - * @returns TRUE if the table was created successfully, FALSE otherwise - * - */ -osync_bool osync_anchor_create(OSyncAnchor *anchor, OSyncError **error); - -/** - * @brief Create an anchor database + * @brief Create an sink state database * * @param filename the full path to the database file to create - * @param objtype Object Type to assoicate this anchor, NULL for main-sink. + * @param objtype Object Type to associate this anchor or state, NULL for main-sink. * @param error Pointer to an error struct * @returns a pointer to the new database, NULL on error * */ -OSyncAnchor *osync_anchor_new(const char *filename, const char *objtype, OSyncError **error); +OSyncSinkStateDB *osync_sink_state_db_new( + const char *filename, + const char *objtype, + OSyncError **error); /** - * @brief Increase the reference count on an anchor + * @brief Increase the reference count on a database * - * @param anchor Pointer to the anchor + * @param sinkStateDB Pointer to the database * */ -OSyncAnchor *osync_anchor_ref(OSyncAnchor *anchor); +OSyncSinkStateDB *osync_sink_state_db_ref(OSyncSinkStateDB *sinkStateDB); /** - * @brief Decrease the reference count on an anchor + * @brief Decrease the reference count on a database * - * @param anchor Pointer to the anchor + * @param sinkStateDB Pointer to the database * */ -void osync_anchor_unref(OSyncAnchor *anchor); +void osync_sink_state_db_unref(OSyncSinkStateDB *sinkStateDB); /*@}*/ -#endif /* OPENSYNC_ANCHOR_INTERNALS_H_ */ +#endif /* OPENSYNC_SINK_STATE_DB_INTERNALS_H_ */ Modified: trunk/opensync/helper/opensync_sink_state_db_private.h ============================================================================== --- trunk/opensync/helper/opensync_sink_state_db_private.h Tue Mar 31 11:28:47 2009 (r5479) +++ trunk/opensync/helper/opensync_sink_state_db_private.h Tue Mar 31 13:29:05 2009 (r5480) @@ -18,23 +18,23 @@ * */ -#ifndef OPENSYNC_ANCHOR_PRIVATE_H_ -#define OPENSYNC_ANCHOR_PRIVATE_H_ +#ifndef OPENSYNC_SINK_STATE_DB_PRIVATE_H_ +#define OPENSYNC_SINK_STATE_DB_PRIVATE_H_ /** * @defgroup OSyncHelperPrivate OpenSync Helper Module Private * @ingroup OSyncPrivate - * @defgroup OSyncAnchorPrivateAPI OpenSync Anchor Private + * @defgroup OSyncSinkStateDatabasePrivateAPI OpenSync Sink State Database Private * @ingroup OSyncHelperPrivate - * @brief Internal functions to deal with anchors + * @brief Internal functions to deal with anchors and other sink related state informations */ /*@{*/ /** - * @brief OSyncAnchor struct + * @brief OSyncSinkStateDB struct */ -struct OSyncAnchor { +struct OSyncSinkStateDB { /* Reference counting */ int ref_count; /* Pointer to the OSyncDatabase */ @@ -45,4 +45,4 @@ /*@}*/ -#endif /* OPENSYNC_ANCHOR_PRIVATE_H_ */ +#endif /* OPENSYNC_SINK_STATE_DB_PRIVATE_H_ */ |
From: <svn...@op...> - 2009-03-31 09:28:57
|
Author: bellmich Date: Tue Mar 31 11:28:47 2009 New Revision: 5479 URL: http://www.opensync.org/changeset/5479 Log: fixed the includes for the OSyncAnchor to OSyncSinkStateDB migration Modified: trunk/opensync/helper/opensync_sink_state_db.c trunk/opensync/opensync-helper.h trunk/opensync/plugin/opensync_objtype_sink.c Modified: trunk/opensync/helper/opensync_sink_state_db.c ============================================================================== --- trunk/opensync/helper/opensync_sink_state_db.c Tue Mar 31 11:26:16 2009 (r5478) +++ trunk/opensync/helper/opensync_sink_state_db.c Tue Mar 31 11:28:47 2009 (r5479) @@ -24,8 +24,8 @@ #include "opensync-helper.h" #include "db/opensync_db_internals.h" -#include "opensync_anchor_internals.h" -#include "opensync_anchor_private.h" +#include "opensync_sink_state_db_internals.h" +#include "opensync_sink_state_db_private.h" osync_bool osync_anchor_create(OSyncAnchor *anchor, OSyncError **error) { Modified: trunk/opensync/opensync-helper.h ============================================================================== --- trunk/opensync/opensync-helper.h Tue Mar 31 11:26:16 2009 (r5478) +++ trunk/opensync/opensync-helper.h Tue Mar 31 11:28:47 2009 (r5479) @@ -23,7 +23,7 @@ OPENSYNC_BEGIN_DECLS -#include "helper/opensync_anchor.h" +#include "helper/opensync_sink_state_db.h" #include "helper/opensync_hashtable.h" OPENSYNC_END_DECLS Modified: trunk/opensync/plugin/opensync_objtype_sink.c ============================================================================== --- trunk/opensync/plugin/opensync_objtype_sink.c Tue Mar 31 11:26:16 2009 (r5478) +++ trunk/opensync/plugin/opensync_objtype_sink.c Tue Mar 31 11:28:47 2009 (r5479) @@ -25,7 +25,7 @@ #include "opensync-helper.h" #include "opensync-plugin.h" -#include "opensync/helper/opensync_anchor_internals.h" +#include "opensync/helper/opensync_sink_state_db_internals.h" #include "opensync/helper/opensync_hashtable_internals.h" #include "opensync_plugin_info_internals.h" /* due to osync_plugin_info_get_configdir() */ |
From: <svn...@op...> - 2009-03-31 09:26:22
|
Author: dgollub Date: Tue Mar 31 11:26:16 2009 New Revision: 5478 URL: http://www.opensync.org/changeset/5478 Log: Make sure that generate fiels from tempaltes get generated outside the current working directory (e.g. config.h). e.g. cmake -B/tmp/build/ Spotted by bellmich Modified: trunk/CMakeLists.txt Modified: trunk/CMakeLists.txt ============================================================================== --- trunk/CMakeLists.txt Tue Mar 31 11:11:44 2009 (r5477) +++ trunk/CMakeLists.txt Tue Mar 31 11:26:16 2009 (r5478) @@ -112,8 +112,8 @@ IF ( DOXYGEN_DOT_EXECUTABLE ) SET( HAVE_DOT "YES" ) ENDIF ( DOXYGEN_DOT_EXECUTABLE ) - CONFIGURE_FILE( "Doxyfile.in" "Doxyfile" ) - CONFIGURE_FILE( "misc/doxygen.css" "misc/doxygen.css" ) + CONFIGURE_FILE( "Doxyfile.in" "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" ) + CONFIGURE_FILE( "misc/doxygen.css" "${CMAKE_CURRENT_BINARY_DIR}/misc/doxygen.css" ) ADD_CUSTOM_TARGET( DoxygenDoc ${DOXYGEN_EXECUTABLE} ) ENDIF ( BUILD_DOCUMENTATION ) @@ -134,7 +134,7 @@ ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") -CONFIGURE_FILE( "config.h.cmake" "config.h" ) +CONFIGURE_FILE( "config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/config.h" ) CONFIGURE_FILE( "libopensync.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libopensync.pc" ) ########## INSTALL ############################## |
From: <svn...@op...> - 2009-03-31 09:11:48
|
Author: bellmich Date: Tue Mar 31 11:11:44 2009 New Revision: 5477 URL: http://www.opensync.org/changeset/5477 Log: replaced opensync_anchor.c by opensync_sink_state_db.c Modified: trunk/opensync/CMakeLists.txt Modified: trunk/opensync/CMakeLists.txt ============================================================================== --- trunk/opensync/CMakeLists.txt Tue Mar 31 11:09:47 2009 (r5476) +++ trunk/opensync/CMakeLists.txt Tue Mar 31 11:11:44 2009 (r5477) @@ -38,7 +38,7 @@ group/opensync_group_env.c group/opensync_member.c group/opensync_updater.c - helper/opensync_anchor.c + helper/opensync_sink_state_db.c helper/opensync_hashtable.c ipc/opensync_message.c ipc/opensync_queue.c |
From: <svn...@op...> - 2009-03-31 09:09:53
|
Author: bellmich Date: Tue Mar 31 11:09:47 2009 New Revision: 5476 URL: http://www.opensync.org/changeset/5476 Log: renamed source files to prepare the renaming from OSyncAnchor to OSyncSinkStateDB Added: trunk/opensync/helper/opensync_sink_state_db.c (props changed) - copied unchanged from r5475, trunk/opensync/helper/opensync_anchor.c trunk/opensync/helper/opensync_sink_state_db.h (props changed) - copied unchanged from r5475, trunk/opensync/helper/opensync_anchor.h trunk/opensync/helper/opensync_sink_state_db_internals.h (props changed) - copied unchanged from r5475, trunk/opensync/helper/opensync_anchor_internals.h trunk/opensync/helper/opensync_sink_state_db_private.h (props changed) - copied unchanged from r5475, trunk/opensync/helper/opensync_anchor_private.h Deleted: trunk/opensync/helper/opensync_anchor.c trunk/opensync/helper/opensync_anchor.h trunk/opensync/helper/opensync_anchor_internals.h trunk/opensync/helper/opensync_anchor_private.h |
From: <svn...@op...> - 2009-03-30 20:41:02
|
Author: henrik Date: Mon Mar 30 22:40:46 2009 New Revision: 5475 URL: http://www.opensync.org/changeset/5475 Log: Request a hashtable from OpenSync Modified: plugins/mozilla-sync/trunk/src/mozilla-sync.cpp Modified: plugins/mozilla-sync/trunk/src/mozilla-sync.cpp ============================================================================== --- plugins/mozilla-sync/trunk/src/mozilla-sync.cpp Mon Mar 30 22:26:32 2009 (r5474) +++ plugins/mozilla-sync/trunk/src/mozilla-sync.cpp Mon Mar 30 22:40:46 2009 (r5475) @@ -1052,6 +1052,9 @@ // Request anchor functionality from OpenSync osync_objtype_sink_enable_anchor(sink, TRUE); + // Request a hashtable from OpenSync + osync_objtype_sink_enable_hashtable(sink, TRUE); + // TODO: Check the exact meaning of each timeout, and ajust accordingly osync_objtype_sink_set_connect_timeout(sink, 5*60); // 4 minutes osync_objtype_sink_set_disconnect_timeout(sink, 5*60); // 4 minutes |