コード例 #1
0
ファイル: cs_actions.c プロジェクト: shiditime/oio-sds
GError *
conscience_remote_push_services(const char *cs, GSList *ls)
{
	MESSAGE req = metautils_message_create_named (NAME_MSGNAME_CS_PUSH_SRV);
	metautils_message_add_body_unref (req, service_info_marshall_gba (ls, NULL));
	return gridd_client_exec (cs, CS_CLIENT_TIMEOUT,
			message_marshall_gba_and_clean(req));
}
コード例 #2
0
ファイル: cs_actions.c プロジェクト: shiditime/oio-sds
GError*
conscience_remote_remove_services(const char *cs, const char *type, GSList *ls)
{
	MESSAGE req = metautils_message_create_named (NAME_MSGNAME_CS_RM_SRV);
	if (ls)
		metautils_message_add_body_unref (req, service_info_marshall_gba (ls, NULL));
	if (type) metautils_message_add_field_str (req, NAME_MSGKEY_TYPENAME, type);
	return gridd_client_exec (cs, CS_CLIENT_TIMEOUT,
			message_marshall_gba_and_clean(req));
}
コード例 #3
0
ファイル: gridcluster_remote.c プロジェクト: korween/oio-sds
GError *
gcluster_push_services(addr_info_t * addr, long timeout, GSList *ls)
{
	EXTRA_ASSERT (addr != NULL);
	gchar target[STRLEN_ADDRINFO];
	grid_addrinfo_to_string (addr, target, sizeof(target));

	MESSAGE req = metautils_message_create_named (NAME_MSGNAME_CS_PUSH_SRV);
	metautils_message_add_body_unref (req, service_info_marshall_gba (ls, NULL));
	return gridd_client_exec (target, ((gdouble)timeout)/1000.0,
			message_marshall_gba_and_clean(req));
}
コード例 #4
0
gint
gcluster_push_services(addr_info_t * addr, long timeout, GSList * services_list, gboolean lock_action, GError ** error)
{
	static struct code_handler_s codes[] = {
		{200, REPSEQ_FINAL, NULL, NULL},
		{0, 0, NULL, NULL}
	};
	struct reply_sequence_data_s data = { NULL, 0, codes };
	MESSAGE req = NULL;
	GByteArray *buf = NULL;

	buf = service_info_marshall_gba(services_list, error);
	if (!buf) {
		GSETERROR(error, "Failed to marshall services list");
		goto error_marshall;
	}

	req = build_request(NAME_MSGNAME_CS_PUSH_SRV, buf->data, buf->len, error);
	if (req == NULL) {
		GSETERROR(error, "Failed to build request %s", NAME_MSGNAME_CS_PUSH_SRV);
		goto error_buildreq;
	}

	if (lock_action)
		message_add_field(req, "LOCK", sizeof("LOCK") - 1, "true", sizeof("true") - 1, NULL);

	/*reads the answers */
	if (!metaXClient_reply_sequence_run_from_addrinfo(error, req, addr, timeout, &data)) {
		GSETERROR(error, "Cannot execute the query %s and receive all the responses", NAME_MSGNAME_CS_PUSH_SRV);
		goto error_reply;
	}

	message_destroy(req, NULL);
	g_byte_array_free(buf, TRUE);

	return (1);

error_reply:
	message_destroy(req, NULL);
error_buildreq:
	g_byte_array_free(buf, TRUE);
error_marshall:

	return (0);
}
コード例 #5
0
int
services_worker_list_local(worker_t * worker, GError ** error)
{
	GSList *services;
	GByteArray *gba;
	response_t response;


	memset(&response, 0, sizeof(response_t));

	services = build_local_service_info_list();
	gba = service_info_marshall_gba(services, error);
	g_slist_free(services);

	if (!gba) {
		GSETERROR(error, "service_info list serialization error");
		return __respond_error(worker, error ? *error : NULL, NULL);
	}

	return __respond(worker, 1, gba, error);
}