Пример #1
0
static void dump_hash(OSyncGroupEnv *env, const char *objtype, const char *groupname, char *memberid)
{
	OSyncGroup *group = osync_group_env_find_group(env, groupname);
#if 0 /* Unused */	
	OSyncError *error = NULL;
	long long int id = 0;
	OSyncMember *member = NULL;
	char *path = NULL;
	OSyncHashTable *table = NULL;
#endif	
	
	if (!group) {
		printf("Unable to find group with name \"%s\"\n", groupname);
		return;
	}

	printf("Dumping hashtable is currently not implemented!\n");
	
	return;

/* FIXME: public interface osync_hashltable_new() is gone!
 * no interface to access the disk directly!
 * */
#if 0	
	id = atoi(memberid);
	member = osync_group_find_member(group, id);
	if (!member) {
		printf("Unable to find member with id %s\n", memberid);
		return;
	}
	
	path = g_strdup_printf("%s/hashtable.db", osync_member_get_configdir(member));
	table = osync_hashtable_new(path, objtype, &error);
	if (!table)
		goto error;
	g_free(path);

	if (!osync_hashtable_load(table, &error))
		goto error;
	
	osync_hashtable_foreach(table, print_hashtable, NULL);

	osync_hashtable_unref(table);

 error:
	printf("ERROR: %s", osync_error_print(&error));
	osync_error_unref(&error);

#endif	
}
Пример #2
0
static void dump_hash(OSyncGroupEnv *env, const char *objtype, const char *groupname, char *memberid)
{
  OSyncError *error = NULL;
  OSyncGroup *group = osync_group_env_find_group(env, groupname);
  long long int id = 0;
  OSyncMember *member = NULL;
  char *path = NULL;
  OSyncHashTable *table = NULL;

	
  if (!group) {
    printf("Unable to find group with name \"%s\"\n", groupname);
    return;
  }
	
  id = atoi(memberid);
  member = osync_group_find_member(group, id);
  if (!member) {
    printf("Unable to find member with id %s\n", memberid);
    return;
  }
	
  path = g_strdup_printf("%s/hashtable.db", osync_member_get_configdir(member));
  table = osync_hashtable_new(path, objtype, &error);
  if (!table)
    goto error;
  g_free(path);
	
  osync_hashtable_foreach(table, print_hashtable, NULL);

  osync_hashtable_unref(table);
	
  return;

 error:
  printf("ERROR: %s", osync_error_print(&error));
  osync_error_unref(&error);
}