当前位置: 首页>>代码示例>>C++>>正文


C++ GRID_WARN函数代码示例

本文整理汇总了C++中GRID_WARN函数的典型用法代码示例。如果您正苦于以下问题:C++ GRID_WARN函数的具体用法?C++ GRID_WARN怎么用?C++ GRID_WARN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GRID_WARN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _manage_requests

static void
_manage_requests(struct gridd_client_pool_s *pool)
{
	struct event_client_s *ec;

	EXTRA_ASSERT(pool != NULL);

	while (pool->active_count < pool->active_max) {
		ec = g_async_queue_try_pop(pool->pending_clients);
		if (NULL == ec)
			return;
		EXTRA_ASSERT(ec->client != NULL);

		if (!gridd_client_start(ec->client)) {
			GError *err = gridd_client_error(ec->client);
			if (NULL != err) {
				GRID_WARN("STARTUP Client fd=%d [%s] : (%d) %s",
						gridd_client_fd(ec->client), gridd_client_url(ec->client),
						err->code, err->message);
				g_clear_error(&err);
			}
			else {
				GRID_WARN("STARTUP Client fd=%d [%s] : already started",
						gridd_client_fd(ec->client), gridd_client_url(ec->client));
				EXTRA_ASSERT(err != NULL);
			}
			event_client_free(ec);
		}
		else if (!event_client_monitor(pool, ec))
			event_client_free(ec);
	}
}
开发者ID:korween,项目名称:oio-sds,代码行数:32,代码来源:gridd_client_pool.c

示例2: _manage_prefix

static void
_manage_prefix(struct meta1_backend_s *m1, guint8 *prefix, sqlite3 *tmpdb)
{
	gchar sql[LIMIT_LENGTH_NSNAME + 128];

	int cb(void * u, int nbcols, char **vals, char **cols) {
		char *err_msg2 = NULL;

		(void) u;
		(void) nbcols;
		(void) cols;

		memset(sql, 0, sizeof(sql));
		g_snprintf(sql, sizeof(sql), "UPDATE vns SET size = size + %s "
				"WHERE vns = '%s'", vals[1], vals[0]);
		GRID_TRACE("_manage_prefix executing [%s]", sql);
		if (sqlite3_exec(tmpdb, sql, NULL, NULL, &err_msg2) != SQLITE_OK) {
			GRID_WARN("Could not update size for VNS %s: %s", vals[0], err_msg2);
		}
		sqlite3_free(err_msg2);
		err_msg2 = NULL;

		if (!sqlite3_changes(tmpdb)) { /* VNS not found */
			g_snprintf(sql, sizeof(sql), "INSERT INTO vns (vns,size) "
					"VALUES ('%s',%s)", vals[0], vals[1]);
			GRID_TRACE("_manage_prefix VNS not found, executing [%s]", sql);
			if (sqlite3_exec(tmpdb, sql, NULL, NULL, &err_msg2) != SQLITE_OK) {
				GRID_WARN("Could not set size for VNS %s: %s", vals[0], err_msg2);
			}
			sqlite3_free(err_msg2);
		}
		return 0;
	}
开发者ID:amogrid,项目名称:redcurrant,代码行数:33,代码来源:meta1_gridd_dispatcher.c

示例3: _post_config

static gboolean
_post_config(struct sqlx_service_s *ss)
{
	GError *err = NULL;

	if (err != NULL) {
		GRID_WARN("%s", err->message);
		g_clear_error(&err);
		return FALSE;
	}

	// prepare a meta2 backend
	err = meta2_backend_init(&m2, ss->repository, ss->ns_name, ss->lb, ss->resolver);
	if (NULL != err) {
		GRID_WARN("META2 backend init failure: (%d) %s", err->code, err->message);
		g_clear_error(&err);
		return FALSE;
	}

	/* Make deleted bases exit the cache */
	sqlx_repository_configure_close_callback(ss->repository, meta2_on_close, ss);

	/* Register meta2 requests handlers */
	transport_gridd_dispatcher_add_requests(ss->dispatcher,
			meta2_gridd_get_v2_requests(), m2);

	/* Register few meta2 tasks */
	grid_task_queue_register(ss->gtq_reload, 5,
			_task_reconfigure_m2, NULL, ss);
	grid_task_queue_register(ss->gtq_reload, 1,
			(GDestroyNotify)sqlx_task_reload_lb, NULL, ss);

	m2->notifier = ss->events_queue;
	return TRUE;
}
开发者ID:InGenious-Justice,项目名称:oio-sds,代码行数:35,代码来源:meta2_server.c

示例4: _check

static GError*
_check(GList *working_m1list) {
	GError *error = NULL;

	if ( working_m1list ) {

		working_m1list=g_list_sort(working_m1list,meta0_assign_sort_by_score);
		struct meta0_assign_meta1_s *hM1 = working_m1list->data;
		struct meta0_assign_meta1_s *lM1 = (g_list_last(working_m1list))->data;
		guint highscore = hM1->score;
		guint lowscore = lM1->score;
		GRID_TRACE("check delta highscore %d ,lowscore %d",highscore,lowscore);
		if ( (highscore - lowscore) < (context->avgscore * trigger_assignment )/ 100  ) {
			GRID_WARN("New assign not necessary, high score %d , low score %d, average %d", highscore, lowscore, context->avgscore);
			error = NEWERROR(0, "New assign not necessary");
			return error;
		}
	}

	if ( context->lastAssignTime ) {
		GRID_TRACE("last time %s",g_date_time_format (context->lastAssignTime,"%Y-%m-%d %H:%M"));
		GDateTime *currentTime, *ltime;
		currentTime=g_date_time_new_now_local();
		ltime = g_date_time_add_minutes(context->lastAssignTime,period_between_two_assign);
		GRID_TRACE("currentTime :%s , last time + %d min :%s, comp :%d",g_date_time_format (currentTime,"%Y-%m-%d %H:%M"),period_between_two_assign,g_date_time_format (ltime,"%Y-%m-%d %H:%M"), g_date_time_compare(ltime,currentTime));
		if (g_date_time_compare(ltime,currentTime) > 0 ) {
			GRID_WARN("delay between two meta1 assign  not respected. Try later. last date [%s]",g_date_time_format (context->lastAssignTime,"%Y-%m-%d %H:%M"));
			error = NEWERROR(0,"delay between two meta1 assign  not respected. Try later.");
			return error;
		}
	}

	return NULL;
}
开发者ID:korween,项目名称:oio-sds,代码行数:34,代码来源:meta0_prefixassign.c

示例5: _curl_url_prefix

static GString *
_curl_url_prefix (const char *ns, enum _prefix_e which)
{
	if (!ns) {
		GRID_WARN ("BUG No namespace configured!");
		return NULL;
	}

	gchar *s = NULL;

	if (which == PREFIX_CONSCIENCE)
		s = oio_cfg_get_proxy_conscience (ns);
	else if (which == PREFIX_CONTAINER)
		s = oio_cfg_get_proxy_containers (ns);
	else if (which == PREFIX_REFERENCE)
		s = oio_cfg_get_proxy_directory (ns);
	if (!s)
		s = oio_cfg_get_proxy (ns);
	if (!s) {
		GRID_WARN ("No proxy configured!");
		return NULL;
	}

	GString *hu = g_string_new("http://");
	g_string_append (hu, s);
	g_free (s);
	return hu;
}
开发者ID:carriercomm,项目名称:oio-sds,代码行数:28,代码来源:proxy.c

示例6: gridd_client_pool_create

struct gridd_client_pool_s *
gridd_client_pool_create(void)
{
	int fdmon, fd[2];
	struct gridd_client_pool_s *pool;

	if (0 != pipe(fd)) {
		GRID_WARN("pipe() error: (%d) %s", errno, strerror(errno));
		metautils_pclose(&(fd[0]));
		metautils_pclose(&(fd[1]));
		return NULL;
	}

	if (0 > (fdmon = epoll_create(64))) {
		GRID_WARN("epoll_create error: (%d) %s", errno, strerror(errno));
		metautils_pclose(&(fd[0]));
		metautils_pclose(&(fd[1]));
		return NULL;
	}

	// TODO FIXME factorize this in metautils
	struct rlimit limit;
	memset(&limit, 0, sizeof(limit));
	if (0 != getrlimit(RLIMIT_NOFILE, &limit))
		limit.rlim_cur = limit.rlim_max = 32768;

	pool = g_malloc0(sizeof(*pool));
	pool->pending_clients = g_async_queue_new();

	pool->fdmon = fdmon;
	pool->active_max = limit.rlim_cur;
	pool->active_clients_size = limit.rlim_cur;
	pool->active_clients = g_malloc0(pool->active_clients_size
			* sizeof(struct event_client_s*));

	pool->fd_in = fd[0];
	fd[0] = -1;
	metautils_syscall_shutdown(pool->fd_in, SHUT_WR);
	sock_set_non_blocking(pool->fd_in, TRUE);

	pool->fd_out = fd[1];
	fd[1] = -1;
	metautils_syscall_shutdown(pool->fd_out, SHUT_RD);
	sock_set_non_blocking(pool->fd_out, TRUE);

	/* then monitors at least the notifications pipe's output */
	struct epoll_event ev;
	memset(&ev, 0, sizeof(ev));
	ev.events = EPOLLIN;
	ev.data.fd = pool->fd_in;
	if (0 > epoll_ctl(pool->fdmon, EPOLL_CTL_ADD, pool->fd_in, &ev)) {
		GRID_ERROR("epoll error: (%d) %s", errno, strerror(errno));
		gridd_client_pool_destroy(pool);
		return NULL;
	}

	pool->vtable = &VTABLE;
	return pool;
}
开发者ID:korween,项目名称:oio-sds,代码行数:59,代码来源:gridd_client_pool.c

示例7: _configure_with_arguments

static gboolean
_configure_with_arguments(struct sqlx_service_s *ss, int argc, char **argv)
{
	// Sanity checks
	if (ss->sync_mode_solo > SQLX_SYNC_FULL) {
		GRID_WARN("Invalid SYNC mode for not-replicated bases");
		return FALSE;
	}
	if (ss->sync_mode_repli > SQLX_SYNC_FULL) {
		GRID_WARN("Invalid SYNC mode for replicated bases");
		return FALSE;
	}
	if (!ss->url) {
		GRID_WARN("No URL!");
		return FALSE;
	}
	if (!ss->announce) {
		ss->announce = g_string_new(ss->url->str);
		GRID_DEBUG("No announce set, using endpoint [%s]", ss->announce->str);
	}
	if (!metautils_url_valid_for_bind(ss->url->str)) {
		GRID_ERROR("Invalid URL as a endpoint [%s]", ss->url->str);
		return FALSE;
	}
	if (!metautils_url_valid_for_connect(ss->announce->str)) {
		GRID_ERROR("Invalid URL to be announced [%s]", ss->announce->str);
		return FALSE;
	}
	if (argc < 2) {
		GRID_ERROR("Not enough options, see usage.");
		return FALSE;
	}

	// Positional arguments
	gsize s = g_strlcpy(ss->ns_name, argv[0], sizeof(ss->ns_name));
	if (s >= sizeof(ss->ns_name)) {
		GRID_WARN("Namespace name too long (given=%"G_GSIZE_FORMAT" max=%u)",
				s, (unsigned int)sizeof(ss->ns_name));
		return FALSE;
	}
	GRID_DEBUG("NS configured to [%s]", ss->ns_name);

	ss->lb_world = oio_lb_local__create_world();
	ss->lb = oio_lb__create();

	s = g_strlcpy(ss->volume, argv[1], sizeof(ss->volume));
	if (s >= sizeof(ss->volume)) {
		GRID_WARN("Volume name too long (given=%"G_GSIZE_FORMAT" max=%u)",
				s, (unsigned int) sizeof(ss->volume));
		return FALSE;
	}
	GRID_DEBUG("Volume configured to [%s]", ss->volume);

	ss->zk_url = gridcluster_get_zookeeper(ss->ns_name);

	return TRUE;
}
开发者ID:carriercomm,项目名称:oio-sds,代码行数:57,代码来源:sqlx_service.c

示例8: network_server_clean

void
network_server_clean(struct network_server_s *srv)
{
	if (!srv)
		return;

	if (srv->thread_events != NULL) {
		GRID_WARN("EventThread not joined!");
		g_error("EventThread not joined!");
	}
	if (srv->thread_first_worker) {
		GRID_WARN("FirstThread not joined!");
		g_error("FirstThread not joined!");
	}

	g_mutex_clear(&srv->lock_threads);

	network_server_close_servers(srv);

	if (srv->endpointv) {
		struct endpoint_s **u;
		for (u=srv->endpointv; *u ;u++)
			g_free(*u);
		g_free(srv->endpointv);
	}

	if (srv->stats) {
		grid_stats_holder_clean(srv->stats);
	}

	metautils_pclose(&(srv->wakeup[0]));
	metautils_pclose(&(srv->wakeup[1]));

	if (srv->queue_monitor) {
		g_async_queue_unref(srv->queue_monitor);
		srv->queue_monitor = NULL;
	}

	if (srv->queue_events) {
		g_async_queue_unref(srv->queue_events);
		srv->queue_events = NULL;
	}

	if (srv->workers_active_1) {
		grid_single_rrd_destroy(srv->workers_active_1);
		srv->workers_active_1 = NULL;
	}
	if (srv->workers_active_60) {
		grid_single_rrd_destroy(srv->workers_active_60);
		srv->workers_active_60 = NULL;
	}

	g_free(srv);
}
开发者ID:Narthorn,项目名称:oio-sds,代码行数:54,代码来源:network_server.c

示例9: _post_config

static gboolean
_post_config(struct sqlx_service_s *ss)
{
	GError *err;

	// Create the backend
	m0 = meta0_backend_init(ss->ns_name, ss->url->str, ss->repository);
	if (!m0) {
		GRID_WARN("META0 backend init failure");
		return FALSE;
	}

	// Create the zookeeper poller
	if (ss->zk_url) {
		err = zk_srv_manager_create(ss->ns_name, ss->zk_url,
				NAME_SRVTYPE_META0, &m0zkmanager);
		if (err) {
			GRID_WARN("Zk manager init failed : (%d) %s",err->code, err->message);
			g_clear_error(&err);
			return FALSE;
		}
		for (;;) {
			err = create_zk_node(m0zkmanager, NULL, ss->url->str, ss->url->str);
			if (!err)
				break;
			GRID_DEBUG("Meta0's zookeeper node creation failure : (%d) %s",
				err->code, err->message);
			g_clear_error(&err);
			sleep(1);
		}
	}

	m0disp = meta0_gridd_get_dispatcher(m0, m0zkmanager, ss->ns_name);

	transport_gridd_dispatcher_add_requests(ss->dispatcher,
			meta0_gridd_get_requests(), m0disp);

	meta0_backend_migrate(m0);

	meta0_gridd_requested_reload(m0disp);

	sqlx_repository_configure_change_callback(ss->repository,
			_callback_change, NULL);

	grid_task_queue_register(ss->gtq_register, 3,
			_task_zk_registration, NULL, ss);

	return TRUE;
}
开发者ID:korween,项目名称:oio-sds,代码行数:49,代码来源:meta0_server.c

示例10: __del_container_properties

static GError *
__del_container_properties(struct sqlx_sqlite3_s *sq3, struct oio_url_s *url,
		gchar **names)
{
	GError *err = NULL;
	gchar **p_name;

	if (!names || !*names)
		__exec_cid(sq3->db, "DELETE FROM properties WHERE cid = ?", oio_url_get_id(url));
	else {
		for (p_name=names; !err && p_name && *p_name ;p_name++) {
			sqlite3_stmt *stmt = NULL;
			gint rc;

			sqlite3_prepare_debug(rc, sq3->db, "DELETE FROM properties WHERE cid = ? AND name = ?", -1, &stmt, NULL);
			if (rc != SQLITE_OK && rc != SQLITE_DONE)
				err = M1_SQLITE_GERROR(sq3->db, rc);
			else {
				(void) sqlite3_bind_blob(stmt, 1, oio_url_get_id(url), oio_url_get_id_size(url), NULL);
				(void) sqlite3_bind_text(stmt, 2, *p_name, strlen(*p_name), NULL);
				sqlite3_step_debug_until_end (rc, stmt);
				if (rc != SQLITE_DONE)
					GRID_WARN("SQLite error rc=%d", rc);
				sqlite3_finalize_debug(rc, stmt);
			}
		}
	}

	return err;
}
开发者ID:GuillaumeDelaporte,项目名称:oio-sds,代码行数:30,代码来源:meta1_backend_properties.c

示例11: sqlx_pack_REPLICATE

GByteArray*
sqlx_pack_REPLICATE(struct sqlx_name_s *name, struct TableSequence *tabseq)
{
	GError *err = NULL;
	GByteArray *body, *encoded;
	MESSAGE req;

	EXTRA_ASSERT(name != NULL);
	EXTRA_ASSERT(tabseq != NULL);

	body = sqlx_encode_TableSequence(tabseq, &err);
	if (!body) {
		GRID_WARN("Transaction encoding error : (%d) %s",
				err->code, err->message);
		return NULL;
	}

	req = make_request("SQLX_REPLICATE", name);
	(void) message_set_BODY(req, body->data, body->len, NULL);
	encoded = message_marshall_gba(req, NULL);
	g_byte_array_free(body, TRUE);
	(void) message_destroy(req, NULL);

	return encoded;
}
开发者ID:amogrid,项目名称:redcurrant,代码行数:25,代码来源:sqlx_remote.c

示例12: _create_container

static int
_create_container(struct gridd_filter_ctx_s *ctx)
{
	struct m2v2_create_params_s params;
	struct meta2_backend_s *m2b = meta2_filter_ctx_get_backend(ctx);
	struct hc_url_s *url = meta2_filter_ctx_get_url(ctx);
	GError *err = NULL;
	int retry = 2;

	params.storage_policy = meta2_filter_ctx_get_param(ctx, M2_KEY_STORAGE_POLICY);
	params.version_policy = meta2_filter_ctx_get_param(ctx, M2_KEY_VERSION_POLICY);
	params.local = (meta2_filter_ctx_get_param(ctx, "LOCAL") != NULL);

retry:
	err = meta2_backend_create_container(m2b, url, &params);
	if (err != NULL && err->code == CODE_REDIRECT && retry-- > 0 &&
			!g_strcmp0(err->message, meta2_backend_get_local_addr(m2b))) {
		GRID_WARN("Redirecting on myself!?! Retrying request immediately");
		g_clear_error(&err);
		hc_decache_reference_service(m2b->resolver, url, META2_TYPE_NAME);
		goto retry;
	}

	if (!err)
		return FILTER_OK;
	meta2_filter_ctx_set_error(ctx, err);
	return FILTER_KO;
}
开发者ID:redcurrant,项目名称:redcurrant,代码行数:28,代码来源:meta2_filters_action_container.c

示例13: meta0_remote_get_meta1_info

GError*
meta0_remote_get_meta1_info(const char *m0, gchar ***out)
{
	GError *e = NULL;
	gchar **result = NULL;

	gboolean on_reply(gpointer c1, MESSAGE reply) {
		(void) c1;

		gchar **tmpResult = NULL;
		if (NULL != (e = metautils_message_extract_body_strv (reply, &tmpResult))) {
			GRID_WARN("GetMeta1Info : invalid reply");
			g_clear_error (&e);
			return FALSE;
		}
		if (tmpResult) {
			guint len,resultlen,i;
			gchar **v0;
			if ( result != NULL )
				resultlen=g_strv_length(result);
			else
				resultlen=0;
			len = g_strv_length(tmpResult);
			v0 = g_realloc(result, sizeof(gchar*) * (len + resultlen+1));
			for ( i=0; i<len ; i++) {
				v0[resultlen+i] = g_strdup(tmpResult[i]);
			}
			v0[len+resultlen]=NULL;
			result = g_strdupv(v0);
			g_strfreev(v0);
			g_strfreev(tmpResult);
		}
		return TRUE;
	}
开发者ID:InGenious-Justice,项目名称:oio-sds,代码行数:34,代码来源:meta0_remote.c

示例14: meta2_filter_action_has_container

int
meta2_filter_action_has_container(struct gridd_filter_ctx_s *ctx,
		struct gridd_reply_ctx_s *reply)
{
	(void) reply;
	struct meta2_backend_s *m2b = meta2_filter_ctx_get_backend(ctx);
	struct hc_url_s *url = meta2_filter_ctx_get_url(ctx);

	if (!url) {
		GRID_WARN("BUG : Checking container's presence : URL not set");
		meta2_filter_ctx_set_error (ctx, NEWERROR(CODE_BAD_REQUEST, "No URL"));
		return FILTER_KO;
	}

	GError *e = meta2_backend_has_container(m2b, url);
	if (NULL != e) {
		GRID_DEBUG("Container test error for [%s] : (%d) %s",
					hc_url_get(url, HCURL_WHOLE), e->code, e->message);
		if (e->code == CODE_CONTAINER_NOTFOUND)
			hc_decache_reference_service(m2b->resolver, url, NAME_SRVTYPE_META2);
		meta2_filter_ctx_set_error(ctx, e);
		return FILTER_KO;
	}

	return FILTER_OK;
}
开发者ID:Narthorn,项目名称:oio-sds,代码行数:26,代码来源:meta2_filters_action_container.c

示例15: sqlx_task_reload_lb

void
sqlx_task_reload_lb (struct sqlx_service_s *ss)
{
	static volatile gboolean already_succeeded = FALSE;
	static volatile guint tick_reload = 0;
	static volatile guint period_reload = 1;

	EXTRA_ASSERT(ss != NULL);
	if (!ss->lb || !ss->nsinfo)
		return;

	if (already_succeeded && 0 != (tick_reload++ % period_reload))
		return;

	GError *err = _reload_lbpool(ss->lb, FALSE);
	if (!err) {
		already_succeeded = TRUE;
		period_reload ++;
		period_reload = CLAMP(period_reload,2,10);
		tick_reload = 1;
	} else {
		GRID_WARN("Failed to reload the LB pool services: (%d) %s",
				err->code, err->message);
		g_clear_error(&err);
	}

	grid_lbpool_reconfigure(ss->lb, ss->nsinfo);
}
开发者ID:racciari,项目名称:oio-sds,代码行数:28,代码来源:sqlx_service.c


注:本文中的GRID_WARN函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。