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


C++ GRID_DEBUG函数代码示例

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


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

示例1: _configure_events_queue

static gboolean
_configure_events_queue (struct sqlx_service_s *ss)
{
	if (ss->flag_no_event) {
		GRID_DEBUG("Events queue disabled, the service disabled it");
		return TRUE;
	}

	gchar *url =  gridcluster_get_eventagent (SRV.ns_name);
	STRING_STACKIFY (url);

	if (!url) {
		GRID_DEBUG("Events queue disabled, no URL configured");
		return TRUE;
	}

	GError *err = oio_events_queue_factory__create(url, &ss->events_queue);

	if (!ss->events_queue) {
		GRID_WARN("Events queue creation failure: (%d) %s", err->code, err->message);
		return FALSE;
	}

	GRID_INFO("Event queue ready, connected to [%s]", url);
	return TRUE;
}
开发者ID:live-for-dream,项目名称:oio-sds,代码行数:26,代码来源:sqlx_service.c

示例2: hc_delete_container

gs_error_t *
hc_delete_container(gs_grid_storage_t *hc, struct hc_url_s *url, int force, int flush)
{
	gs_error_t *e = NULL;
	gs_container_t *c = NULL;
	unsigned int flags = 0;

	if (force) flags |= M2V2_DESTROY_FORCE;

	// to flush by meta2, but without event generated
	//if (flush) flags |= M2V2_DESTROY_FLUSH;

	c = gs_get_storage_container(hc, hc_url_get(url, HCURL_REFERENCE), NULL, 0, &e);
	if(NULL != c) {

		// to flush by this process, but with event generated
		if (flush) {
			if (gs_flush_container(c, &e)) {
				GRID_DEBUG("Container flushed\n");
		    }
		}

		// destroy container
		if (!e) {
			if (gs_destroy_container_flags (c, flags, &e)) {
				GRID_DEBUG("Container deleted\n");
			}
		}
		gs_container_free(c);
	}
	return e;
}
开发者ID:amogrid,项目名称:redcurrant,代码行数:32,代码来源:hc_func.c

示例3: hc_upload_content

static gs_error_t *
hc_upload_content(gs_grid_storage_t *hc, struct hc_url_s *url, const char *local_path,
		const char *stgpol, const char *sys_metadata, int ac, gboolean is_append)
{
	int in = -1;
	struct stat64 s;
	gs_container_t *c = NULL;
	gs_error_t *e = NULL;

	/*init the local path */
	if (-1 == stat64(local_path, &s)) {
		e = g_malloc0(sizeof(gs_error_t));
		e->code = errno;
		e->msg = g_strdup_printf("Cannot stat the local file (%s)\n", strerror(errno));
		return e;
	}
	GRID_DEBUG("Local path %s found\n", local_path);

	if (-1 == (in = open(local_path, O_RDONLY|O_LARGEFILE))) {
		e = g_malloc0(sizeof(gs_error_t));
		e->code = errno;
		e->msg = g_strdup_printf("Cannot open the local file (%s)\n", strerror(errno));
		goto end_put;
	}
	GRID_DEBUG("Local path %s found and opened\n", local_path);

	if(!(c = gs_get_storage_container(hc, hc_url_get(url, HCURL_REFERENCE), NULL, ac, &e))) {
		g_printerr("Failed to resolve and/or create meta2 entry for reference %s\n",
				hc_url_get(url, HCURL_REFERENCE));
		goto end_put;
	}

	/*upload the content */
	if (is_append) {
		if (!gs_append_content(c, hc_url_get(url, HCURL_PATH), s.st_size, _feed_from_fd, &in, &e)) {
			goto end_put;
		}
	} else {
		if (!gs_upload(c, hc_url_get(url, HCURL_PATH), s.st_size, _feed_from_fd,
				&in, NULL, sys_metadata, stgpol, &e)) {
			goto end_put;
		}
	}
	GRID_INFO("Uploaded a new version of content [%s] in container [%s]\n\n",
			hc_url_get(url, HCURL_PATH), hc_url_get(url, HCURL_REFERENCE));
	GRID_DEBUG("Content successfully uploaded!\n");

end_put:

	/** FIXME TODO XXX why not (in >= 0) or (in > -1) ? */
	if (in > 1)
		metautils_pclose(&in);

	if(NULL != c) {
		gs_container_free(c);
		c = NULL;
	}

	return e;
}
开发者ID:amogrid,项目名称:redcurrant,代码行数:60,代码来源:hc_func.c

示例4: _zmq2agent_send_event

static gboolean
_zmq2agent_send_event (time_t now, struct _zmq2agent_ctx_s  *ctx,
		struct event_s *evt, const char *dbg)
{
	int rc;

	if (ctx->last_error == now) {
		GRID_DEBUG("ZMQ2AGENT event delayed, stream paused");
		return FALSE;
	}

	evt->last_sent = now;
retry:
	rc = zmq_send (ctx->zagent, "", 0, more|ZMQ_DONTWAIT);
	if (rc == 0) {
		rc = zmq_send (ctx->zagent, evt, HEADER_SIZE, more|ZMQ_DONTWAIT);
		if (rc == HEADER_SIZE)
			rc = zmq_send (ctx->zagent, evt->message, evt->size, ZMQ_DONTWAIT);
	}

	if (rc < 0) {
		if (EINTR == (rc = zmq_errno ()))
			goto retry;
		ctx->last_error = evt->last_sent;
		GRID_INFO("EVT:ERR %s (%d) %s", dbg, rc, zmq_strerror(rc));
		return FALSE;
	} else {
		++ ctx->q->counter_sent;
		ctx->last_error = 0;
		GRID_DEBUG("EVT:SNT %s", dbg);
		return TRUE;
	}
}
开发者ID:live-for-dream,项目名称:oio-sds,代码行数:33,代码来源:oio_events_queue_zmq.c

示例5: _meta2_filter_check_ns_name

static int
_meta2_filter_check_ns_name(struct gridd_filter_ctx_s *ctx,
		struct gridd_reply_ctx_s *reply, int optional)
{
	(void) reply;
	TRACE_FILTER();
	const struct meta2_backend_s *backend = meta2_filter_ctx_get_backend(ctx);
	const char *req_ns = oio_url_get(meta2_filter_ctx_get_url(ctx), OIOURL_NS);

	if (!backend || !backend->ns_name[0]) {
		GRID_DEBUG("Missing information for namespace checking");
		meta2_filter_ctx_set_error(ctx, SYSERR("backend not ready"));
		return FILTER_KO;
	}

	if (!req_ns) {
		if (optional)
			return FILTER_OK;
		GRID_DEBUG("Missing namespace name in request");
		meta2_filter_ctx_set_error(ctx, BADREQ("No namespace"));
		return FILTER_KO;
	}

	if (0 != g_ascii_strcasecmp(backend->ns_name, req_ns)) {
		meta2_filter_ctx_set_error(ctx, BADNS());
		return FILTER_KO;
	}

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

示例6: _sqlx_exec

/* XXX JFS dupplicated from sqliterepo/sqlite_utils.c */
static int
_sqlx_exec(sqlite3 *handle, const char *sql)
{
	int rc, grc = SQLITE_OK;
	sqlite3_stmt *stmt = NULL;

	while ((grc == SQLITE_OK) && sql && *sql) {
		const char *next = NULL;
		rc = sqlite3_prepare(handle, sql, -1, &stmt, &next);
		GRID_DEBUG("sqlite3_prepare(%s) = %d", sql, rc);
		sql = next;
		if (rc != SQLITE_OK && rc != SQLITE_DONE)
			grc = rc;
		else {
			if (stmt) {
				do {
					rc = sqlite3_step(stmt);
					GRID_DEBUG("sqlite3_step() = %d", rc);
				} while (rc == SQLITE_ROW);
				if (rc != SQLITE_OK && rc != SQLITE_DONE)
					grc = rc;
			}
		}
		if (stmt) {
			rc = sqlite3_finalize(stmt);
			GRID_DEBUG("sqlite3_finalize() = %d", rc);
			stmt = NULL;
			if (rc != SQLITE_OK && rc != SQLITE_DONE)
				grc = rc;
		}
	}

	return grc;
}
开发者ID:chrisz,项目名称:oio-sds,代码行数:35,代码来源:sqlx_client_local.c

示例7: _meta2_filter_check_ns_name

static int
_meta2_filter_check_ns_name(struct gridd_filter_ctx_s *ctx,
		struct gridd_reply_ctx_s *reply, int optional)
{
	(void) reply;
	TRACE_FILTER();
	const struct meta2_backend_s *backend = meta2_filter_ctx_get_backend(ctx);
	const char *req_ns = oio_url_get(meta2_filter_ctx_get_url(ctx), OIOURL_NS);

	if (!backend || !backend->ns_name[0]) {
		GRID_DEBUG("Missing information for namespace checking");
		meta2_filter_ctx_set_error(ctx, NEWERROR(CODE_INTERNAL_ERROR,
					"Missing backend information, cannot check namespace"));
		return FILTER_KO;
	}

	if (!req_ns) {
		if (optional)
			return FILTER_OK;
		GRID_DEBUG("Missing namespace name in request");
		meta2_filter_ctx_set_error(ctx, NEWERROR(CODE_BAD_REQUEST,
					"Bad Request: Missing namespace name information"));
		return FILTER_KO;
	}

	if (0 != g_ascii_strcasecmp(backend->ns_name, req_ns)) {
		meta2_filter_ctx_set_error(ctx, NEWERROR(CODE_BAD_REQUEST,
					"Request namespace [%s] does not match server namespace [%s]",
					req_ns, backend->ns_name));
		return FILTER_KO;
	}

	return FILTER_OK;
}
开发者ID:InGenious-Justice,项目名称:oio-sds,代码行数:34,代码来源:meta2_filters_check.c

示例8: 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");
		return FILTER_OK;
	}

	GError *e = meta2_backend_has_container(m2b, url);
	if(NULL != e) {
		if (e->code == CODE_UNAVAILABLE)
			GRID_DEBUG("Container %s exists but could not open it: %s",
					hc_url_get(url, HCURL_WHOLE), e->message);
		else
			GRID_DEBUG("No such container (%s)", hc_url_get(url, HCURL_WHOLE));
		if (e->code == CODE_CONTAINER_NOTFOUND) {
			hc_decache_reference_service(m2b->resolver, url, META2_TYPE_NAME);
		}
		meta2_filter_ctx_set_error(ctx, e);
		return FILTER_KO;
	}
	return FILTER_OK;
}
开发者ID:redcurrant,项目名称:redcurrant,代码行数:28,代码来源:meta2_filters_action_container.c

示例9: network_server_run

GError *
network_server_run(struct network_server_s *srv)
{
	struct endpoint_s **pu, *u;
	time_t now, last_update;
	GError *err = NULL;

	/* Sanity checks */
	EXTRA_ASSERT(srv != NULL);
	for (pu=srv->endpointv; (u = *pu) ;pu++) {
		if (u->fd < 0)
			return NEWERROR(EINVAL,
					"DESIGN ERROR : some servers are not open");
	}
	if (!srv->flag_continue)
		return NULL;

	for (pu=srv->endpointv; srv->flag_continue && (u = *pu) ;pu++)
		ARM_ENDPOINT(srv, u, EPOLL_CTL_ADD);
	ARM_WAKER(srv, EPOLL_CTL_ADD);

	_server_start_one_worker(srv, FALSE);
	srv->thread_events = g_thread_new("events", _thread_cb_events, srv);

	clock_gettime(CLOCK_MONOTONIC_COARSE, &srv->now);
	last_update = network_server_bogonow(srv);
	while (srv->flag_continue) {
		now = network_server_bogonow(srv);
		if (last_update < now) {
			_server_update_main_stats(srv);
			last_update = now;
		}
		usleep(_start_necessary_threads(srv) ? 50000 : 500000);
		clock_gettime(CLOCK_MONOTONIC_COARSE, &srv->now);
	}

	network_server_close_servers(srv);

	/* Wait for all the workers */
	while (srv->workers_total) {
		GRID_DEBUG("Waiting for %u workers to die", srv->workers_total);
		usleep(200000);
		clock_gettime(CLOCK_MONOTONIC_COARSE, &srv->now);
	}
	srv->thread_first_worker = NULL;

	/* wait for the first event thread */
	if (srv->thread_events) {
		g_thread_join(srv->thread_events);
		srv->thread_events = NULL;
	}

	ARM_WAKER(srv, EPOLL_CTL_DEL);

	GRID_DEBUG("Server %p exiting its main loop", srv);
	return err;
}
开发者ID:Narthorn,项目名称:oio-sds,代码行数:57,代码来源:network_server.c

示例10: _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

示例11: monitoring_loop

static void
monitoring_loop(service_info_t *si)
{
	long jiffies = 0;
	GTimer *timer;
	GError *error = NULL;
	guint proc_count;

	timer = g_timer_new();
	monitor_get_status(svc_mon, si);
	_add_custom_tags(si);

	proc_count = supervisor_children_startall(NULL, NULL);
	GRID_DEBUG("First started %u processes", proc_count);

	while (flag_running) { /* main loop */

		if (flag_restart_children) {
			if (auto_restart_children) {
				supervisor_children_repair(CHILD_KEY);
				supervisor_children_enable(CHILD_KEY, TRUE);
				proc_count = supervisor_children_startall(NULL,NULL);

				GRID_DEBUG("Started %u processes", proc_count);
				flag_restart_children = !!proc_count;
			} else {
				GRID_DEBUG("One of my children died, I will die too (auto_restart_children=%d)", auto_restart_children);
				break;
			}
		}

		if (!flag_running)
			break;

		gdouble elapsed = g_timer_elapsed(timer, NULL);
		if (elapsed >= 1.0) {
			if (!((++jiffies) % monitor_period)) {
				monitor_get_status(svc_mon, si);
				_add_custom_tags(si);
			}
			if (!register_namespace_service(si, &error)) {
				GRID_WARN("Failed to register the service: %s", gerror_get_message(error));
				g_clear_error(&error);
			}
			g_timer_reset(timer);
			elapsed = 0.0;
		}

		g_usleep (1000000UL - ((gulong)elapsed));
	}

	supervisor_children_stopall(4);
	supervisor_children_catharsis(NULL, NULL);

	g_free(timer);
}
开发者ID:korween,项目名称:oio-sds,代码行数:56,代码来源:main.c

示例12: hc_list_contents

gs_error_t *
hc_list_contents(gs_grid_storage_t *hc, struct hc_url_s *url, int output_xml, int show_info,
		char **result)
{
	gs_error_t *e = NULL;
	gs_container_t *c = NULL;
	const gchar *snapshot = hc_url_get(url, HCURL_SNAPORVERS);
	struct list_content_s lc;

	c = gs_get_storage_container(hc, hc_url_get(url, HCURL_REFERENCE), NULL, 0, &e);

	if (NULL != c) {
		GRID_DEBUG("%s found\n", hc_url_get(url, HCURL_REFERENCE));

		lc.nb_elts = 0;
		lc.xml = output_xml;
		lc.show_info = show_info;
		lc.buffer = g_string_new("");
		lc.listed = NULL;

		if(output_xml) {
			g_string_append_printf(lc.buffer,
					"<Container>\n"
					" <Name>%s</Name>\n"
					" <Contents>\n",
					hc_url_get(url, HCURL_REFERENCE));
		} else {
			g_string_append_printf(lc.buffer, "#Listing container=[%s]\n", hc_url_get(url, HCURL_REFERENCE));
		}

		if (!gs_list_container_snapshot(c, NULL, _my_content_filter, &lc,
				snapshot, &e)) {
			g_printerr("Cannot list %s\n", hc_url_get(url, HCURL_REFERENCE));
			g_string_free(lc.buffer, TRUE);
		} else {
			_sort_listed(&lc);
			GRID_DEBUG("%s listed\n", hc_url_get(url, HCURL_REFERENCE));
			if(output_xml) {
				lc.buffer = g_string_append(lc.buffer,
					" </Contents>\n"
					"</Container>\n");
			} else {
				g_string_append_printf(lc.buffer, "#Total in [%s]: %i elements\n",
						hc_url_get(url, HCURL_REFERENCE), lc.nb_elts);
			}
			*result = g_string_free(lc.buffer, FALSE);
		}

		gs_container_free(c);
		return e;
	}

	g_printerr("Cannot find %s\n", hc_url_get(url, HCURL_REFERENCE));
	return e;
}
开发者ID:amogrid,项目名称:redcurrant,代码行数:55,代码来源:hc_func.c

示例13: _thread_cb_worker

static gpointer
_thread_cb_worker(gpointer td)
{
	struct grid_stats_holder_s *local_stats = NULL;
	time_t last_update, last_not_idle;
	struct network_server_s *srv = td;

	metautils_ignore_signals();
	_thread_maybe_become_first(srv);
	last_update = last_not_idle = network_server_bogonow(srv);
	local_stats = grid_stats_holder_init();
	GRID_DEBUG("Thread starting for srv %p", srv);

	while (srv->flag_continue || srv->cnx_clients > 0) {
		struct network_client_s *clt = get_next_client(srv);
		if (!clt) {
			gboolean expired = network_server_bogonow(srv) >
				(last_not_idle + srv->workers_max_idle_delay);
			if (expired && _thread_can_die(srv)) {
				GRID_DEBUG("Thread idle for too long, exiting!");
				goto label_exit;
			}
		}
		else { /* something happened */
			EXTRA_ASSERT(clt->server == srv);

			_thread_become_active(srv);
			last_not_idle = network_server_bogonow(srv);
			clt->local_stats = local_stats;
			_work_on_client(srv, clt);
			_thread_become_inactive(srv);
		}

		/* periodically merge the local stats in the main stats */
		if (last_update < network_server_bogonow(srv)) {
			grid_stats_holder_increment_merge(srv->stats, local_stats);
			grid_stats_holder_zero(local_stats);
			last_update = network_server_bogonow(srv);
		}
	}

	/* thread exiting due to a server stop */
	GRID_DEBUG("Thread exiting for srv %p", srv);
	_thread_stop(srv);

label_exit:
	if (local_stats) {
		grid_stats_holder_increment_merge(srv->stats, local_stats);
		grid_stats_holder_clean(local_stats);
	}
	return td;
}
开发者ID:Narthorn,项目名称:oio-sds,代码行数:52,代码来源:network_server.c

示例14: __test_location

static gboolean
__test_location(gchar *loc, GSList *used_loc, gint64 distance)
{
	GRID_DEBUG("Required distance is %ld", distance);
	GSList *l = NULL;
	for (l = used_loc; l && l->data; l = l->next) {
		gint64 d = distance_between_location(loc, (gchar*) l->data);
		GRID_DEBUG("-> found distance %ld", d);
		if(d < distance)
			return FALSE;
	}
	return TRUE;
}
开发者ID:redcurrant,项目名称:redcurrant,代码行数:13,代码来源:content_check.c

示例15: _find_matching_rawx

static service_info_t *
_find_matching_rawx(GSList *rawx, GSList *used_loc, gint64 distance,
		const gchar *stg_class, GSList **rawx_garbage)
{
	GRID_DEBUG("Searching rawx distant of %"G_GINT64_FORMAT
			" with storage class '%s'", distance, stg_class);
	GSList *l = NULL;
	gchar loc[1024];
	struct service_tag_s * loc_tag = NULL;
	GRID_DEBUG("Checking for an available rawx in a list of %d elements",
			g_slist_length(rawx));
	for (l = rawx; l && l->data; l = l->next) {
		GRID_DEBUG("Checking one rawx...");
		/* ensure service score */
		if(((service_info_t*)l->data)->score.value <= 0) {
			GRID_DEBUG("Rawx score <= 0");
			continue;
		}
		/* ensure not spotted as unreachable */
		if(_is_rawx_in_garbage((service_info_t*)l->data, *rawx_garbage)) {
			GRID_DEBUG("Rawx already in unreachable list");
			continue;
		}
		/* check rawx reachable */
		if(!is_rawx_reachable((service_info_t*)l->data)) {
			GRID_DEBUG("Rawx unreachable");
			*rawx_garbage = g_slist_prepend(*rawx_garbage, l->data);
			continue;
		}

		/* check rawx has appropriate storage class (strictly) */
		if (!service_info_check_storage_class(l->data, stg_class)) {
			GRID_DEBUG(MSG_DONT_MATCH_CRITERIA, "storage class");
			continue;
		}

		/* ensure distance match with our policy */
		bzero(loc, sizeof(loc));
		loc_tag = service_info_get_tag(((service_info_t*)l->data)->tags, NAME_TAGNAME_RAWX_LOC);
		GRID_DEBUG("service tag extracted");
		if(!loc_tag) {
			if(distance > 1) {
				continue;
			}
			return ((service_info_t*)l->data);
		}
		service_tag_get_value_string(loc_tag, loc, sizeof(loc), NULL);
		if(__test_location(loc, used_loc, distance)) {
			return ((service_info_t*)l->data);
		} else {
			GRID_DEBUG(MSG_DONT_MATCH_CRITERIA, "distance");
		}
	}
	return NULL;
}
开发者ID:redcurrant,项目名称:redcurrant,代码行数:55,代码来源:content_check.c


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