本文整理汇总了C++中osync_trace函数的典型用法代码示例。如果您正苦于以下问题:C++ osync_trace函数的具体用法?C++ osync_trace怎么用?C++ osync_trace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osync_trace函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: osync_queue_is_alive
osync_bool osync_queue_is_alive(OSyncQueue *queue)
{
OSyncMessage *message = NULL;
osync_trace(TRACE_ENTRY, "%s(%p)", __func__, queue);
// FIXME
/*if (!osync_queue_connect(queue, O_WRONLY | O_NONBLOCK, NULL)) {
osync_trace(TRACE_EXIT_ERROR, "%s: Unable to connect", __func__);
return FALSE;
}*/
message = osync_message_new(OSYNC_MESSAGE_NOOP, 0, NULL);
if (!message) {
osync_trace(TRACE_EXIT_ERROR, "%s: Unable to create new message", __func__);
return FALSE;
}
if (!osync_queue_send_message(queue, NULL, message, NULL)) {
osync_trace(TRACE_EXIT, "%s: Not alive", __func__);
return FALSE;
}
osync_queue_disconnect(queue, NULL);
osync_trace(TRACE_EXIT, "%s", __func__);
return TRUE;
}
开发者ID:ianmartin,项目名称:autoimportopensync,代码行数:27,代码来源:opensync_queue.c
示例2: osync_trace
OSyncSinkEngine *osync_sink_engine_new(int position, OSyncClientProxy *proxy, OSyncObjEngine *objengine, OSyncError **error)
{
OSyncSinkEngine *sinkengine = NULL;
osync_trace(TRACE_ENTRY, "%s(%i, %p, %p, %p)", __func__, position, proxy, objengine, error);
osync_assert(proxy);
osync_assert(objengine);
sinkengine = osync_try_malloc0(sizeof(OSyncSinkEngine), error);
if (!sinkengine)
goto error;
sinkengine->ref_count = 1;
sinkengine->position = position;
/* we dont reference the proxy to avoid circular dependencies. This object is completely
* dependent on the proxy anyways */
sinkengine->proxy = proxy;
sinkengine->engine = objengine;
osync_obj_engine_ref(objengine);
osync_trace(TRACE_EXIT, "%s: %p", __func__, sinkengine);
return sinkengine;
error:
osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error));
return NULL;
}
开发者ID:luizluca,项目名称:opensync-luizluca,代码行数:27,代码来源:opensync_sink_engine.c
示例3: osync_mapping_engine_supports_ignore
osync_bool osync_mapping_engine_supports_ignore(OSyncMappingEngine *engine)
{
OSyncObjEngine *parent = NULL;
osync_bool ignore_supported = TRUE;
GList *s = NULL;
osync_trace(TRACE_ENTRY, "%s(%p)", __func__, engine);
osync_assert(engine);
parent = engine->parent;
for (s = parent->sink_engines; s; s = s->next) {
OSyncSinkEngine *sink_engine = s->data;
OSyncMember *member = osync_client_proxy_get_member(sink_engine->proxy);
OSyncMappingEntryEngine *entry_engine = osync_mapping_engine_get_entry(engine, sink_engine);
/* check if mapping could be solved by "ignore" conflict handler */
const char *objtype = entry_engine->sink_engine->engine->objtype;
OSyncObjTypeSink *objtype_sink = osync_member_find_objtype_sink(member, objtype);
/* if there is no sink read function, ignore is not support for this mapping. */
if (!objtype_sink || !osync_objtype_sink_get_function_read(objtype_sink))
ignore_supported = FALSE;
}
osync_trace(TRACE_EXIT, "%s: conflict handler ignore supported: %s", __func__, ignore_supported ? "TRUE" : "FALSE");
return ignore_supported;
}
开发者ID:ianmartin,项目名称:autoimportopensync,代码行数:29,代码来源:opensync_mapping_engine.c
示例4: _osync_obj_engine_connect_callback
static void _osync_obj_engine_connect_callback(OSyncClientProxy *proxy, void *userdata, osync_bool slowsync, OSyncError *error)
{
OSyncSinkEngine *sinkengine = userdata;
OSyncObjEngine *engine = sinkengine->engine;
OSyncError *locerror = NULL;
osync_trace(TRACE_ENTRY, "%s(%p, %p, %i, %p)", __func__, proxy, userdata, slowsync, error);
if (error) {
osync_trace(TRACE_INTERNAL, "Obj Engine received connect error: %s", osync_error_print(&error));
osync_obj_engine_set_error(engine, error);
engine->sink_errors = engine->sink_errors | (0x1 << sinkengine->position);
osync_status_update_member(engine->parent, osync_client_proxy_get_member(proxy), OSYNC_CLIENT_EVENT_ERROR, engine->objtype, error);
} else {
engine->sink_connects = engine->sink_connects | (0x1 << sinkengine->position);
osync_status_update_member(engine->parent, osync_client_proxy_get_member(proxy), OSYNC_CLIENT_EVENT_CONNECTED, engine->objtype, NULL);
}
if (slowsync) {
osync_obj_engine_set_slowsync(engine, TRUE);
osync_trace(TRACE_INTERNAL, "SlowSync requested during connect.");
}
if (osync_bitcount(engine->sink_errors | engine->sink_connects) == g_list_length(engine->sink_engines)) {
if (osync_bitcount(engine->sink_errors)) {
osync_error_set(&locerror, OSYNC_ERROR_GENERIC, "At least one sink_engine failed while connecting");
osync_obj_engine_set_error(engine, locerror);
}
osync_obj_engine_event(engine, OSYNC_ENGINE_EVENT_CONNECTED, locerror ? locerror : error);
} else
osync_trace(TRACE_INTERNAL, "Not yet: %i", osync_bitcount(engine->sink_errors | engine->sink_connects));
osync_trace(TRACE_EXIT, "%s", __func__);
}
开发者ID:ianmartin,项目名称:autoimportopensync,代码行数:35,代码来源:opensync_obj_engine.c
示例5: osync_status_update_change
void osync_status_update_change(OSyncEngine *engine, OSyncChange *change, OSyncMember *member, OSyncMapping *mapping, OSyncChangeEvent type, OSyncError *error)
{
osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %i, %p)", __func__, engine, change, member, mapping, type, error);
if (engine->changestat_callback) {
OSyncChangeUpdate *update = g_malloc0(sizeof(OSyncChangeUpdate));
if (!update)
return;
update->type = type;
update->change = change;
osync_change_ref(change);
update->member = member;
osync_member_ref(member);
update->error = error;
osync_error_ref(&error);
engine->changestat_callback(update, engine->changestat_userdata);
osync_status_free_change_update(update);
} else
osync_trace(TRACE_INTERNAL, "Status Update Ignored");
osync_trace(TRACE_EXIT, "%s", __func__);
}
开发者ID:ianmartin,项目名称:autoimportopensync,代码行数:28,代码来源:opensync_status.c
示例6: osync_obj_engine_map_changes
osync_bool osync_obj_engine_map_changes(OSyncObjEngine *engine, OSyncError **error)
{
OSyncMappingEngine *mapping_engine = NULL;
GList *new_mappings = NULL, *v = NULL;
osync_trace(TRACE_ENTRY, "%s(%p)", __func__, engine);
//osync_trace_disable();
/* Go through all sink engines that are available */
for (v = engine->sink_engines; v; v = v->next) {
OSyncSinkEngine *sinkengine = v->data;
/* We use a temp list to speed things up. We dont have to compare with newly created mappings for
* the current sinkengine, since there will be only one entry (for the current sinkengine) so there
* is no need to compare */
new_mappings = NULL;
/* For each sinkengine, go through all unmapped changes */
while (sinkengine->unmapped) {
OSyncChange *change = sinkengine->unmapped->data;
OSyncConvCmpResult result = 0;
OSyncMappingEntryEngine *entry_engine = NULL;
osync_trace(TRACE_INTERNAL, "Looking for mapping for change %s, changetype %i from member %lli", osync_change_get_uid(change), osync_change_get_changetype(change), osync_member_get_id(osync_client_proxy_get_member(sinkengine->proxy)));
/* See if there is an exisiting mapping, which fits the unmapped change */
result = _osync_obj_engine_mapping_find(engine, change, sinkengine, &mapping_engine);
if (result == OSYNC_CONV_DATA_MISMATCH) {
/* If there is none, create one */
mapping_engine = _osync_obj_engine_create_mapping_engine(engine, error);
if (!mapping_engine)
goto error;
osync_trace(TRACE_INTERNAL, "Unable to find mapping. Creating new mapping with id %lli", osync_mapping_get_id(mapping_engine->mapping));
new_mappings = g_list_append(new_mappings, mapping_engine);
} else if (result == OSYNC_CONV_DATA_SIMILAR) {
mapping_engine->conflict = TRUE;
}
/* Update the entry which belongs to our sinkengine with the the change */
entry_engine = osync_mapping_engine_get_entry(mapping_engine, sinkengine);
osync_assert(entry_engine);
osync_entry_engine_update(entry_engine, change);
sinkengine->unmapped = g_list_remove(sinkengine->unmapped, sinkengine->unmapped->data);
osync_change_unref(change);
}
engine->mapping_engines = g_list_concat(engine->mapping_engines, new_mappings);
}
//osync_trace_enable();
osync_trace(TRACE_EXIT, "%s", __func__);
return TRUE;
error:
osync_trace_enable();
osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error));
return FALSE;
}
开发者ID:ianmartin,项目名称:autoimportopensync,代码行数:60,代码来源:opensync_obj_engine.c
示例7: _osync_obj_engine_sync_done_callback
static void _osync_obj_engine_sync_done_callback(OSyncClientProxy *proxy, void *userdata, OSyncError *error)
{
OSyncSinkEngine *sinkengine = userdata;
OSyncObjEngine *engine = sinkengine->engine;
OSyncError *locerror = NULL;
osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, proxy, userdata, error);
if (error) {
osync_obj_engine_set_error(engine, error);
engine->sink_errors = engine->sink_errors | (0x1 << sinkengine->position);
osync_status_update_member(engine->parent, osync_client_proxy_get_member(proxy), OSYNC_CLIENT_EVENT_ERROR, engine->objtype, error);
} else {
engine->sink_sync_done = engine->sink_sync_done | (0x1 << sinkengine->position);
osync_status_update_member(engine->parent, osync_client_proxy_get_member(proxy), OSYNC_CLIENT_EVENT_SYNC_DONE, engine->objtype, NULL);
}
if (osync_bitcount(engine->sink_errors | engine->sink_sync_done) == g_list_length(engine->sink_engines)) {
if (osync_bitcount(engine->sink_sync_done) < osync_bitcount(engine->sink_connects)) {
osync_error_set(&locerror, OSYNC_ERROR_GENERIC, "Fewer sink_engines reported sync_done than connected");
osync_obj_engine_set_error(engine, locerror);
}
osync_obj_engine_event(engine, OSYNC_ENGINE_EVENT_SYNC_DONE, locerror ? locerror : error);
} else
osync_trace(TRACE_INTERNAL, "Not yet: %i", osync_bitcount(engine->sink_errors | engine->sink_sync_done));
osync_trace(TRACE_EXIT, "%s", __func__);
}
开发者ID:ianmartin,项目名称:autoimportopensync,代码行数:29,代码来源:opensync_obj_engine.c
示例8: check_mapping
void check_mapping(OSyncMappingTable *maptable, int memberid, int mappingid, unsigned int numentries, const char *uid)
{
unsigned int i = 0;
osync_trace(TRACE_ENTRY, "%s(%p, %i, %i, %i, %s)", __func__, maptable, memberid, mappingid, numentries, uid);
for (i = 0; i < osync_mapping_table_num_mappings(maptable); i++) {
OSyncMapping *mapping = osync_mapping_table_nth_mapping(maptable, i);
OSyncMappingEntry *testentry = osync_mapping_find_entry_by_member_id(mapping, memberid);
if (testentry) {
if ((mappingid != -1 && osync_mapping_get_id(mapping) == mappingid) || (mappingid == -1 && !strcmp(osync_mapping_entry_get_uid(testentry), uid))) {
unsigned int n = 0;
fail_unless(osync_mapping_num_entries(mapping) == numentries);
for (n = 0; n < osync_mapping_num_entries(mapping); n++) {
OSyncMappingEntry *entry = osync_mapping_nth_entry(mapping, n);
if (osync_mapping_entry_get_member_id(entry) == memberid) {
fail_unless(!strcmp(osync_mapping_entry_get_uid(entry), uid), NULL);
goto out;
}
}
fail(NULL);
}
}
}
fail(NULL);
out:
osync_trace(TRACE_EXIT, "%s", __func__);
}
开发者ID:luizluca,项目名称:opensync-luizluca,代码行数:28,代码来源:support.c
示例9: osync_module_load
osync_bool osync_module_load(OSyncModule *module, const char *path, OSyncError **error)
{
osync_trace(TRACE_ENTRY, "%s(%p, %s, %p)", __func__, module, path, error);
osync_assert(module);
osync_assert(!module->module);
if (!g_module_supported()) {
osync_error_set(error, OSYNC_ERROR_GENERIC, "This platform does not support loading of modules");
goto error;
}
/* Try to open the module or fail if an error occurs.
*
* Do local bind to avoid symbol-clashing - i.e. plugins having the same
* functions name - e.g. finalize().
*
* Don't do lazy binding, otherwise symbols of kdepim-sync can't get loaded.
* Related to C++ and dlopen?
*/
module->module = g_module_open(path, G_MODULE_BIND_LOCAL);
if (!module->module) {
osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to open module %s: %s", path, g_module_error());
goto error;
}
module->path = osync_strdup(path);
osync_trace(TRACE_EXIT, "%s", __func__);
return TRUE;
error:
osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error));
return FALSE;
}
开发者ID:luizluca,项目名称:opensync-luizluca,代码行数:34,代码来源:opensync_module.c
示例10: demarshal_file
static osync_bool demarshal_file(OSyncMarshal *marshal, char **output, unsigned int *outpsize, void *user_data, OSyncError **error)
{
OSyncFileFormat *file = NULL;
osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, marshal, output, outpsize, error);
file = osync_try_malloc0(sizeof(OSyncFileFormat), error);
if (!file)
goto error;
if (!osync_marshal_read_string(marshal, &(file->path), error))
goto error;
if (!osync_marshal_read_buffer(marshal, (void *)&(file->data), &(file->size), error))
goto error;
*output = (char *)file;
*outpsize = sizeof(OSyncFileFormat);
osync_trace(TRACE_EXIT, "%s", __func__);
return TRUE;
error:
osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error));
return FALSE;
}
开发者ID:luizluca,项目名称:opensync-file-sync,代码行数:26,代码来源:file.c
示例11: osync_trace
OSyncMappingTable *mappingtable_load(const char *path, const char *objtype, unsigned int num_mappings)
{
OSyncError *error = NULL;
OSyncMappingTable *table = NULL;
OSyncArchive *archive = NULL;
osync_trace(TRACE_ENTRY, "%s(%s, %s, %i)", __func__, path, objtype, num_mappings);
table = osync_mapping_table_new(&error);
fail_unless(table != NULL, NULL);
fail_unless(error == NULL, NULL);
archive = osync_archive_new(path, &error);
fail_unless(archive != NULL, NULL);
fail_unless(error == NULL, NULL);
fail_unless(osync_mapping_table_load(table, archive, objtype, &error), NULL);
fail_unless(error == NULL, NULL);
osync_archive_unref(archive);
fail_unless(osync_mapping_table_num_mappings(table) == num_mappings, NULL);
osync_trace(TRACE_EXIT, "%s: %p", __func__, table);
return table;
}
开发者ID:luizluca,项目名称:opensync-luizluca,代码行数:26,代码来源:support.c
示例12: osync_queue_setup_with_gmainloop
/*! @brief Sets the queue to use the gmainloop with the given context
*
* This function will attach the OSyncQueue as a source to the given context.
* The queue will then be check for new messages and the messages will be
* handled.
*
* @param queue The queue to set up
* @param context The context to use. NULL for default loop
*
*/
void osync_queue_setup_with_gmainloop(OSyncQueue *queue, GMainContext *context)
{
OSyncQueue **queueptr = NULL;
osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, queue, context);
queue->incoming_functions = g_malloc0(sizeof(GSourceFuncs));
queue->incoming_functions->prepare = _incoming_prepare;
queue->incoming_functions->check = _incoming_check;
queue->incoming_functions->dispatch = _incoming_dispatch;
queue->incoming_functions->finalize = NULL;
queue->incoming_source = g_source_new(queue->incoming_functions, sizeof(GSource) + sizeof(OSyncQueue *));
queueptr = (OSyncQueue **)(queue->incoming_source + 1);
*queueptr = queue;
g_source_set_callback(queue->incoming_source, NULL, queue, NULL);
g_source_attach(queue->incoming_source, context);
queue->incomingContext = context;
// For the source
if (context)
g_main_context_ref(context);
//To unref it later
if (context)
g_main_context_ref(context);
osync_trace(TRACE_EXIT, "%s", __func__);
}
开发者ID:ianmartin,项目名称:autoimportopensync,代码行数:37,代码来源:opensync_queue.c
示例13: osync_queue_new_pipes
/* Creates anonymous pipes which dont have to be created and are automatically connected.
*
* Lets assume parent wants to send, child wants to receive
*
* osync_queue_new_pipes()
* fork()
*
* Parent:
* connect(write_queue)
* disconnect(read_queue)
*
* Child:
* connect(read_queue)
* close(write_queue)
*
*
* */
osync_bool osync_queue_new_pipes(OSyncQueue **read_queue, OSyncQueue **write_queue, OSyncError **error)
{
#ifdef _WIN32
return FALSE;
#else
int filedes[2];
osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, read_queue, write_queue, error);
if (pipe(filedes) < 0) {
osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to create pipes");
goto error;
}
*read_queue = osync_queue_new_from_fd(filedes[0], error);
if (!*read_queue)
goto error_close_pipes;
*write_queue = osync_queue_new_from_fd(filedes[1], error);
if (!*write_queue)
goto error_free_read_queue;
osync_trace(TRACE_EXIT, "%s", __func__);
return TRUE;
error_free_read_queue:
osync_queue_free(*read_queue);
error_close_pipes:
close(filedes[0]);
close(filedes[1]);
error:
osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error));
return FALSE;
#endif
}
开发者ID:ianmartin,项目名称:autoimportopensync,代码行数:51,代码来源:opensync_queue.c
示例14: osync_trace
OSyncQueue *osync_queue_new(const char *name, OSyncError **error)
{
OSyncQueue *queue = NULL;
osync_trace(TRACE_ENTRY, "%s(%s, %p)", __func__, name, error);
queue = osync_try_malloc0(sizeof(OSyncQueue), error);
if (!queue)
goto error;
if (name)
queue->name = g_strdup(name);
queue->fd = -1;
if (!g_thread_supported ())
g_thread_init (NULL);
queue->pendingLock = g_mutex_new();
queue->context = g_main_context_new();
queue->outgoing = g_async_queue_new();
queue->incoming = g_async_queue_new();
queue->disconnectLock = g_mutex_new();
osync_trace(TRACE_EXIT, "%s: %p", __func__, queue);
return queue;
error:
osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error));
return NULL;
}
开发者ID:ianmartin,项目名称:autoimportopensync,代码行数:32,代码来源:opensync_queue.c
示例15: check_sync
double check_sync(OSyncEngine *engine, const char *name, int num)
{
int ret;
printf(".");
fflush(stdout);
starttime = _second();
osync_trace(TRACE_INTERNAL, "++++++++++++++++ Test \"%s %i\" starting ++++++++++++++", name, num);
osengine_set_enginestatus_callback(engine, engine_status, NULL);
sync_now(engine);
osengine_set_enginestatus_callback(engine, NULL, NULL);
int wasted = 0;
int alldeciders = 0;
osengine_get_wasted(engine, &alldeciders, &wasted);
osync_trace(TRACE_INTERNAL, "++++++++++++++++ Test \"%s %i\" ended (%i / %i (%i%%)) ++++++++++++++", name, num, wasted, alldeciders, (int)(((float)wasted / (float)alldeciders) * 100));
double thistime = _second() - starttime;
printf(".");
fflush(stdout);
char *tempdir = g_strdup_printf("%s/plgtest.XXXXXX", g_get_tmp_dir());
if (!mkdtemp(tempdir))
{
g_free(tempdir);
osync_trace(TRACE_INTERNAL, "unable to create temporary dir: %s", g_strerror(errno));
abort();
}
char *command = g_strdup_printf("mv %s/* %s &> /dev/null", localdir, tempdir);
ret = system(command);
if (ret)
{
g_free(tempdir);
g_free(command);
osync_trace(TRACE_INTERNAL, "Unable to move files to temporary dir: %d", ret);
abort();
}
g_free(command);
printf(".");
fflush(stdout);
check_empty();
printf(".");
fflush(stdout);
osync_group_set_slow_sync(engine->group, "data", TRUE);
sync_now(engine);
printf(".");
fflush(stdout);
command = g_strdup_printf("test \"x$(diff -x \".*\" %s %s)\" = \"x\"", localdir, tempdir);
int result = system(command);
g_free(command);
g_free(tempdir);
if (result)
abort();
printf(" success\n");
return thistime;
}
开发者ID:luizluca,项目名称:opensync-luizluca,代码行数:60,代码来源:osynctest.c
示例16: osync_capabilities_save
osync_bool osync_capabilities_save(OSyncCapabilities *capabilities, const char *file, OSyncError **error)
{
unsigned int size;
char *buffer;
osync_bool ret;
osync_trace(TRACE_ENTRY, "%s(%p, %s, %p)", __func__, capabilities, __NULLSTR(file), error);
osync_assert(capabilities);
osync_assert(file);
osync_capabilities_sort(capabilities);
ret = osync_capabilities_assemble(capabilities, &buffer, &size, error);
if (!ret)
goto error;
ret = osync_file_write(file, buffer, size, 0600, error);
osync_free(buffer);
if (!ret)
goto error;
osync_trace(TRACE_EXIT, "%s", __func__);
return TRUE;
error:
osync_trace(TRACE_EXIT_ERROR, "%s: %s" , __func__, osync_error_print(error));
return FALSE;
}
开发者ID:luizluca,项目名称:opensync-luizluca,代码行数:30,代码来源:opensync_capabilities.c
示例17: osync_obj_engine_event
void osync_obj_engine_event(OSyncObjEngine *engine, OSyncEngineEvent event, OSyncError *error)
{
osync_trace(TRACE_ENTRY, "%s(%p, %i, %p)", __func__, engine, event, error);
osync_assert(engine);
/* TODO: Create own enum OSyncObjEngine for objengine events. */
osync_assert_msg(event != OSYNC_ENGINE_EVENT_ERROR, "OSyncObjEngine isn't supposed to emit OSYNC_ENGINE_EVENT_ERROR events!");
/* engine event callback gets called with most recent OSyncError or NULL.
Don't use engine->error for the engine event callback. Previous appears errors
in this objengine would get passed to this engine, which will be interpeted by the
engine as error for the current event.
Example:
EVENT_CONNECTED (obj)engine->error: NULL
EVENT_READ **ERROR** (obj)engine->error: 0x....
# OSyncEngine aborts sync and emit disconnect event, we reply with:
EVENT_DISCONNECTED (obj)engine->error: 0x.....
If we would pass in this case enigne->error instead of the most recent
OSyncError, OSyncEngien would interpret this as the disconnect failed as well.
So we just pass the most recent OSyncError pointer, which could be NULL -> no error.
*/
engine->callback(engine, event, error, engine->callback_userdata);
osync_trace(TRACE_EXIT, "%s", __func__);
return;
}
开发者ID:ianmartin,项目名称:autoimportopensync,代码行数:30,代码来源:opensync_obj_engine.c
示例18: osync_trace
OSyncCapabilities *osync_capabilities_load(const char *file, OSyncError **error)
{
unsigned int size;
char *buffer;
OSyncCapabilities *capabilities;
osync_bool b;
osync_trace(TRACE_ENTRY, "%s(%s, %p)", __func__, file, error);
osync_assert(file);
b = osync_file_read(file, &buffer, &size, error);
if(!b) {
osync_trace(TRACE_EXIT_ERROR, "%s: %s" , __func__, osync_error_print(error));
return NULL;
}
capabilities = osync_capabilities_parse(buffer, size, error);
osync_free(buffer);
if(!capabilities) {
osync_trace(TRACE_EXIT_ERROR, "%s: %s" , __func__, osync_error_print(error));
return NULL;
}
osync_trace(TRACE_EXIT, "%s: %p", __func__, capabilities);
return capabilities;
}
开发者ID:luizluca,项目名称:opensync-luizluca,代码行数:26,代码来源:opensync_capabilities.c
示例19: _osync_obj_engine_commit_change_callback
static void _osync_obj_engine_commit_change_callback(OSyncClientProxy *proxy, void *userdata, const char *uid, OSyncError *error)
{
OSyncMappingEntryEngine *entry_engine = userdata;
OSyncObjEngine *engine = entry_engine->objengine;
OSyncSinkEngine *sinkengine = entry_engine->sink_engine;
OSyncError *locerror = NULL;
OSyncMapping *mapping = NULL;
OSyncMember *member = NULL;
OSyncMappingEntry *entry = NULL;
const char *objtype = NULL;
long long int id = 0;
osync_trace(TRACE_ENTRY, "%s(%p, %p, %s, %p)", __func__, proxy, userdata, uid, error);
osync_entry_engine_set_dirty(entry_engine, FALSE);
mapping = entry_engine->mapping_engine->mapping;
member = osync_client_proxy_get_member(proxy);
entry = entry_engine->entry;
objtype = osync_change_get_objtype(entry_engine->change);
id = osync_mapping_entry_get_id(entry);
if (error) {
/* Error handling (tests: single_commit_error, ...) */
/* TODO: Review differences between Mapping and Change status events - Are both really needed?! */
osync_status_update_change(engine->parent, entry_engine->change, osync_client_proxy_get_member(proxy), entry_engine->mapping_engine->mapping, OSYNC_CHANGE_EVENT_ERROR, error);
osync_status_update_mapping(engine->parent, entry_engine->mapping_engine, OSYNC_MAPPING_EVENT_ERROR, error);
osync_obj_engine_set_error(engine, error);
engine->sink_errors = engine->sink_errors | (0x1 << sinkengine->position);
goto error;
}
if (uid)
osync_change_set_uid(entry_engine->change, uid);
if (engine->archive) {
if (osync_change_get_changetype(entry_engine->change) == OSYNC_CHANGE_TYPE_DELETED) {
/* TODO error handling */
osync_archive_delete_change(engine->archive, id, objtype, &locerror);
} else {
/* TODO error handling */
osync_archive_save_change(engine->archive, id, osync_change_get_uid(entry_engine->change), objtype, osync_mapping_get_id(mapping), osync_member_get_id(member), &locerror);
}
}
osync_assert(entry_engine->mapping_engine);
osync_status_update_change(engine->parent, entry_engine->change, osync_client_proxy_get_member(proxy), entry_engine->mapping_engine->mapping, OSYNC_CHANGE_EVENT_WRITTEN, NULL);
osync_entry_engine_update(entry_engine, NULL);
osync_trace(TRACE_EXIT, "%s", __func__);
return;
error:
_osync_obj_engine_generate_written_event(engine, error);
osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error));
}
开发者ID:ianmartin,项目名称:autoimportopensync,代码行数:60,代码来源:opensync_obj_engine.c
示例20: _inject_changelog_entries
static osync_bool _inject_changelog_entries(OSyncObjEngine *engine, OSyncError **error) {
OSyncList *ids = NULL;
OSyncList *changetypes = NULL;
OSyncList *j = NULL, *t = NULL;
osync_trace(TRACE_ENTRY, "%s(%p)", __func__, engine);
osync_assert(engine);
osync_assert(engine->archive);
osync_assert(engine->objtype);
if (!osync_archive_load_ignored_conflicts(engine->archive, engine->objtype, &ids, &changetypes, error)) {
osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error));
return FALSE;
}
t = changetypes;
for (j = ids; j; j = j->next) {
long long int id = (long long int)GPOINTER_TO_INT(j->data);
OSyncMapping *ignored_mapping = osync_mapping_table_find_mapping(engine->mapping_table, id);
GList *e;
for (e = engine->mapping_engines; e; e = e->next) {
OSyncMappingEngine *mapping_engine = e->data;
if (mapping_engine->mapping == ignored_mapping) {
GList *m;
for (m = mapping_engine->entries; m; m = m->next) {
OSyncMappingEntryEngine *entry = m->data;
OSyncChangeType changetype = (OSyncChangeType) t->data;
OSyncChange *ignored_change = osync_change_new(error);
OSyncObjFormat *dummyformat = NULL;
OSyncData *data = NULL;
osync_change_set_changetype(ignored_change, changetype);
osync_entry_engine_update(entry, ignored_change);
dummyformat = osync_objformat_new("plain", engine->objtype, NULL);
data = osync_data_new(NULL, 0, dummyformat, NULL);
osync_change_set_data(ignored_change, data);
osync_objformat_unref(dummyformat);
osync_change_set_uid(ignored_change, osync_mapping_entry_get_uid(entry->entry));
osync_trace(TRACE_INTERNAL, "CHANGE: %p", entry->change);
}
break;
}
}
t = t->next;
}
osync_list_free(ids);
osync_list_free(changetypes);
osync_trace(TRACE_EXIT, "%s", __func__);
return TRUE;
}
开发者ID:ianmartin,项目名称:autoimportopensync,代码行数:60,代码来源:opensync_obj_engine.c
注:本文中的osync_trace函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论