示例#1
0
GError*
meta0_remote_fill_v2(const char *m0, guint nbreplicas, gboolean nodist)
{
	if (nbreplicas < 1)
		return NEWERROR(CODE_BAD_REQUEST, "Too few replicas");
	MESSAGE request = metautils_message_create_named(NAME_MSGNAME_M0_V2_FILL);
	metautils_message_add_field_strint64(request, NAME_MSGKEY_REPLICAS, nbreplicas);
	if (nodist)
		metautils_message_add_field_struint(request, NAME_MSGKEY_NODIST, nodist);
	return _m0_remote_no_return (m0, message_marshall_gba_and_clean(request));
}
示例#2
0
static GByteArray*
m2v2_remote_pack_BEANS(struct oio_url_s *url, const char *pol, gint64 size, gboolean append)
{
	MESSAGE msg = _m2v2_build_request(NAME_MSGNAME_M2V2_BEANS, url, NULL);
	metautils_message_add_field_strint64 (msg, NAME_MSGKEY_CONTENTLENGTH, size);
	metautils_message_add_field_str (msg, NAME_MSGKEY_STGPOLICY, pol);
	if (append)
		metautils_message_add_field_str (msg, NAME_MSGKEY_APPEND, "true");

	/* si policy est NULL, le paramètre ne sera pas ajouté. On profite que
	 * ce soit ldernier argument de la liste */
	return message_marshall_gba_and_clean(msg);
}
示例#3
0
GError*
meta0_remote_fill(const char *m0, gchar **urls, guint nbreplicas)
{
	if (nbreplicas < 1)
		return NEWERROR(CODE_BAD_REQUEST, "Too few replicas");
	if (!urls || !*urls)
		return NEWERROR(CODE_BAD_REQUEST, "Too few URL's");
	if (nbreplicas > g_strv_length(urls))
		return NEWERROR(CODE_BAD_REQUEST, "Too many replicas for the URL's set");

	MESSAGE request = metautils_message_create_named(NAME_MSGNAME_M0_FILL);
	metautils_message_add_field_strint64(request, NAME_MSGKEY_REPLICAS, nbreplicas);
	gchar *body = g_strjoinv("\n", urls);
	metautils_message_set_BODY(request, body, strlen(body));
	g_free(body);
	return _m0_remote_no_return (m0, message_marshall_gba_and_clean(request));
}
示例#4
0
static void
_pack_list_params (MESSAGE msg, struct list_params_s *p)
{
	guint32 flags = 0;
	if (p->flag_allversion)
		flags |= M2V2_FLAG_ALLVERSION;
	if (p->flag_headers)
		flags |= M2V2_FLAG_HEADERS;
	if (p->flag_nodeleted)
		flags |= M2V2_FLAG_NODELETED;
	flags = g_htonl(flags);
	metautils_message_add_field(msg, NAME_MSGKEY_FLAGS, &flags, sizeof(flags));

	metautils_message_add_field_str(msg, NAME_MSGKEY_PREFIX, p->prefix);
	metautils_message_add_field_str(msg, NAME_MSGKEY_MARKER, p->marker_start);
	metautils_message_add_field_str(msg, NAME_MSGKEY_MARKER_END, p->marker_end);
	if (p->maxkeys > 0)
		metautils_message_add_field_strint64(msg, NAME_MSGKEY_MAX_KEYS, p->maxkeys);
}