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


C++ cf_debug函数代码示例

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


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

示例1: as_proxy_send_response

// Looked up the message in the store. Time to send the response value back to
// the requester. The CF_BYTEARRAY is handed off in this case. If you want to
// keep a reference, then keep the reference yourself.
int
as_proxy_send_response(cf_node dst, msg *m, uint32_t result_code, uint32_t generation,
		uint32_t void_time, as_msg_op **ops, as_bin **bins, uint16_t bin_count,
		as_namespace *ns, uint64_t trid, const char *setname)
{
	uint32_t tid;
	msg_get_uint32(m, PROXY_FIELD_TID, &tid);

#ifdef DEBUG
	cf_debug(AS_PROXY, "proxy send response: message %p bytearray %p tid %d", m, result_code, tid);
#endif

	msg_reset(m);

	msg_set_uint32(m, PROXY_FIELD_OP, PROXY_OP_RESPONSE);
	msg_set_uint32(m, PROXY_FIELD_TID, tid);

	size_t msg_sz = 0;
	cl_msg * msgp = as_msg_make_response_msg(result_code, generation, void_time, ops,
			bins, bin_count, ns, 0, &msg_sz, trid, setname);

	msg_set_buf(m, PROXY_FIELD_AS_PROTO, (byte *) msgp, msg_sz, MSG_SET_HANDOFF_MALLOC);

	int rv = as_fabric_send(dst, m, AS_FABRIC_PRIORITY_MEDIUM);
	if (rv != 0) {
		cf_debug(AS_PROXY, "sending proxy response: fabric send err %d, catch you on the retry", rv);
		as_fabric_msg_put(m);
	}

	return 0;
} // end as_proxy_send_response()
开发者ID:rtdavis1964,项目名称:aerospike-server,代码行数:34,代码来源:thr_proxy.c

示例2: as_proxy_send_ops_response

int
as_proxy_send_ops_response(cf_node dst, msg *m, cf_dyn_buf *db)
{
	uint32_t tid;
	msg_get_uint32(m, PROXY_FIELD_TID, &tid);

#ifdef DEBUG
	cf_debug(AS_PROXY, "proxy send response: message %p bytearray %p tid %d", m, result_code, tid);
#endif

	msg_reset(m);

	msg_set_uint32(m, PROXY_FIELD_OP, PROXY_OP_RESPONSE);
	msg_set_uint32(m, PROXY_FIELD_TID, tid);

	uint8_t *msgp = db->buf;
	size_t msg_sz = db->used_sz;

	if (db->is_stack) {
		msg_set_buf(m, PROXY_FIELD_AS_PROTO, msgp, msg_sz, MSG_SET_COPY);
	}
	else {
		msg_set_buf(m, PROXY_FIELD_AS_PROTO, msgp, msg_sz, MSG_SET_HANDOFF_MALLOC);
		db->buf = NULL; // the fabric owns the buffer now
	}

	int rv = as_fabric_send(dst, m, AS_FABRIC_PRIORITY_MEDIUM);
	if (rv != 0) {
		cf_debug(AS_PROXY, "sending proxy response: fabric send err %d, catch you on the retry", rv);
		as_fabric_msg_put(m);
	}

	return 0;
} // end as_proxy_send_ops_response()
开发者ID:rtdavis1964,项目名称:aerospike-server,代码行数:34,代码来源:thr_proxy.c

示例3: udf_record_param_check

/*
 * Check and validate parameter before performing operation
 *
 * return:
 *      2 : UDF_ERR_INTERNAL_PARAM
 *      3 : UDF_ERR_RECORD_IS_NOT_VALID
 *      4 : UDF_ERR_PARAMETER
 *      0 : Success
 *
 */
int
udf_record_param_check(const as_rec *rec, const char *bname, char *fname, int lineno)
{
	if (!rec || !bname) {
		cf_warning(AS_UDF, "Invalid Paramters: record=%p bname=%p", rec, bname);
		return UDF_ERR_INTERNAL_PARAMETER;
	} 

	udf_record * urecord = (udf_record *) as_rec_source(rec);
	if (!urecord) {
		return UDF_ERR_INTERNAL_PARAMETER;;
	}

	if (!(urecord->flag & UDF_RECORD_FLAG_ISVALID)) {
		if (!(urecord->flag & UDF_RECORD_FLAG_IS_SUBRECORD)) {
			cf_debug(AS_UDF, "(%s:%d): Trying to Open Invalid Record ", fname, lineno);
		} else {
			cf_debug(AS_UDF, "(%s:%d): Trying to Open Invalid SubRecord ", fname, lineno);
		}
		return UDF_ERR_RECORD_NOT_VALID;
	}

	as_namespace  * ns = urecord->tr->rsv.ns;
	if (strlen(bname) >= AS_ID_BIN_SZ || !as_bin_name_within_quota(ns, bname)) {
		cf_debug(AS_UDF, "Invalid Parameter: bin name %s too big", bname);
		return UDF_ERR_PARAMETER;
	}
	return 0;
}
开发者ID:farvour,项目名称:aerospike-server,代码行数:39,代码来源:udf_record.c

示例4: udf_record_cache_free

void
udf_record_cache_free(udf_record * urecord)
{
	cf_debug(AS_UDF, "[ENTER] NumUpdates(%d) ", urecord->nupdates );

	for (uint32_t i = 0; i < urecord->nupdates; i ++ ) {
		udf_record_bin * bin = &urecord->updates[i];
		if ( bin->name[0] != '\0' && bin->value != NULL ) {
			bin->name[0] = '\0';
			as_val_destroy(bin->value);
			bin->value = NULL;
		}
		if ( bin->name[0] != '\0' && bin->oldvalue != NULL ) {
			bin->name[0] = '\0';
			as_val_destroy(bin->oldvalue);
			bin->oldvalue = NULL;
		}
	}

	for (uint32_t i = 0; i < UDF_RECORD_BIN_ULIMIT; i++) {
		if (urecord->updates[i].particle_buf) {
			cf_free(urecord->updates[i].particle_buf);
			urecord->updates[i].particle_buf = NULL;
		}
	}
	urecord->nupdates = 0;
	urecord->flag &= ~UDF_RECORD_FLAG_TOO_MANY_BINS;
}
开发者ID:farvour,项目名称:aerospike-server,代码行数:28,代码来源:udf_record.c

示例5: cc_add_fullnode_group_entry

/**
 * Add a FULL NODE Entry, which has port, group and node id inside
 * Add a Node and Group to the Topology Info.
 */
int
cc_add_fullnode_group_entry(cluster_config_t * cc, cf_node fullnode ) {
	static char * meth = "add_fullnode_group_entry()";
	int rc = 0;
//	printf("[ENTER]<%s:%s> fullnode(%"PRIx64")\n", MOD, meth, fullnode );

	// Look for the group -- if found, then save the index.
	// And, if not found, add it, and save the index.
	cc_group_t group_id = cc_compute_group_id( fullnode );
	int group_ndx = cc_add_group( cc, group_id );

	// Group is all set.  Now add the node (we shouldn't have one already).
	int node_ndx = cc_add_fullnode( cc, fullnode );

	// Quick validation step -- if the membership array shows a NON-negative
	// entry, point that out, but ALSO
	if( cc->membership[node_ndx]  > 0 && cc->membership[node_ndx] != group_ndx) {
		cf_debug(AS_PARTITION, "[ERROR]<%s:%s>Adding FULLNODE[%d](%"PRIx64") MEMBER(%d) \n",
				MOD, meth, node_ndx, fullnode, cc->membership[node_ndx] );
		rc = -1;
	}

	// Just overwrite the weird case for now -- and we'll figure it out later.
	// TODO: Handle the overwrite error if it ever comes up.  It would probably
	// be ONLY a user error -- but it most likely shows that the user screwed
	// up the config file.
	cc->membership[node_ndx] = group_ndx;
	cc->group_node_count[group_ndx]++; // One more in this group

	return rc;
} // end add_node_group_entry()
开发者ID:Abioy,项目名称:aerospike-server,代码行数:35,代码来源:cluster_config.c

示例6: cf_mcastsocket_init

/* cf_svcmsocket_init
 * Initialize a multicast service/receive socket
 * Bind is done to INADDR_ANY - all interfaces
 *  */
int
cf_mcastsocket_init(cf_mcastsocket_cfg *ms)
{
    cf_socket_cfg *s = &(ms->s);

    if (0 > (s->sock = socket(AF_INET, SOCK_DGRAM, 0))) {
        cf_warning(CF_SOCKET, "multicast socket open error: %d %s", errno, cf_strerror(errno));
        return(-1);
    }

    cf_debug(CF_SOCKET, "mcast_socket init: socket %d",s->sock);

    // allows multiple readers on the same address
    uint yes=1;
    if (setsockopt(s->sock, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0) {
        cf_warning(CF_SOCKET, "multicast socket reuse failed: %d %s", errno, cf_strerror(errno));
        return(-1);
    }

    /* Set close-on-exec */
    fcntl(s->sock, F_SETFD, 1);

    // Bind to the incoming port on inaddr any
    memset(&s->saddr, 0, sizeof(s->saddr));
    s->saddr.sin_family = AF_INET;
    s->saddr.sin_addr.s_addr = INADDR_ANY;
    s->saddr.sin_port = htons(s->port);
    if (ms->tx_addr) {
        struct in_addr iface_in;
        memset((char *)&iface_in,0,sizeof(iface_in));
        iface_in.s_addr = inet_addr(ms->tx_addr);

        if(setsockopt(s->sock, IPPROTO_IP, IP_MULTICAST_IF, (const char*)&iface_in, sizeof(iface_in)) == -1) {
            cf_warning(CF_SOCKET, "IP_MULTICAST_IF: %d %s", errno, cf_strerror(errno));
            return(-1);
        }
    }
    unsigned char ttlvar = ms->mcast_ttl;
    if (ttlvar>0) {
        if (setsockopt(s->sock,IPPROTO_IP,IP_MULTICAST_TTL,(char *)&ttlvar,
                       sizeof(ttlvar)) == -1) {
            cf_warning(CF_SOCKET, "IP_MULTICAST_TTL: %d %s", errno, cf_strerror(errno));
        } else {
            cf_info(CF_SOCKET, "setting multicast TTL to be %d",ttlvar);
        }
    }
    while (0 > (bind(s->sock, (struct sockaddr *)&s->saddr, sizeof(struct sockaddr)))) {
        cf_info(CF_SOCKET, "multicast socket bind failed: %d %s", errno, cf_strerror(errno));
    }

    // Register for the multicast group
    inet_pton(AF_INET, s->addr, &ms->ireq.imr_multiaddr.s_addr);
    ms->ireq.imr_interface.s_addr = htonl(INADDR_ANY);
    if (ms->tx_addr) {
        ms->ireq.imr_interface.s_addr = inet_addr(ms->tx_addr);
    }
    setsockopt(s->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const void *)&ms->ireq, sizeof(struct ip_mreq));

    return(0);
}
开发者ID:think-css,项目名称:aerospike-server,代码行数:64,代码来源:socket.c

示例7: cc_add_node_group_entry

/**
 * Add Node/Group Entry
 * Add a Node and Group to the Topology Info.
 */
int
cc_add_node_group_entry(cluster_config_t *cc, const cc_node_t node,
		const cc_group_t group) {
	int rc = 0;

	// Look for the group -- if found, then save the index.
	// And, if not found, add it, and save the index.
	int group_ndx = cc_add_group(cc, group);

	// Group is all set.  Now add the node (we shouldn't have one already).
	int node_ndx = cc_add_node(cc, node);

	// Quick validation step -- if the membership array shows a NON-negative
	// entry, point that out, but ALSO
	if (cc->membership[node_ndx]  > 0
			&& cc->membership[node_ndx] != group_ndx) {
		cf_debug(AS_PARTITION, "adding node:%d group:%d set:%d",
				node, group, cc->membership[node_ndx]);
		rc = -1;
	}

	// Just overwrite the weird case for now -- and we'll figure it out later.
	// TODO: Handle the overwrite error if it ever comes up.  It would probably
	// be ONLY a user error -- but it most likely shows that the user screwed
	// up the config file.
	cc->membership[node_ndx] = group_ndx;
	cc->group_node_count[group_ndx]++; // One more in this group

	return rc;
} // end add_node_group_entry()
开发者ID:BruceZhou2012,项目名称:aerospike-server,代码行数:34,代码来源:cluster_config.c

示例8: send_udf_failure

/**
 * Send failure notification of general UDF execution, but check for special
 * LDT errors and return specific Wire Protocol error codes for these cases:
 * (1) Record not found (2)
 * (2) LDT Collection item not found (125)
 *
 * All other errors get the generic 100 (UDF FAIL) code.
 */
static inline int
send_udf_failure(udf_call *call, const as_string *s)
{
	char *val = as_string_tostring(s);
	size_t vlen = as_string_len((as_string *)s); // TODO - make as_string_len() take const
	long error_code = ldt_get_error_code(val, vlen);

	if (error_code) {

		if (error_code == AS_PROTO_RESULT_FAIL_NOTFOUND ||
			error_code == AS_PROTO_RESULT_FAIL_COLLECTION_ITEM_NOT_FOUND) {

			call->tr->result_code = error_code;
			// Send an "empty" response, with no failure bin.
			as_transaction *    tr          = call->tr;
			single_transaction_response(tr, tr->rsv.ns, NULL/*ops*/,
					NULL /*bin*/, 0 /*nbins*/, 0, 0, NULL, NULL);
			return 0;
		}
	}

	cf_debug(AS_UDF, "Non-special LDT or General UDF Error(%s)", (char *) val);

	call->tr->result_code = AS_PROTO_RESULT_FAIL_UDF_EXECUTION;
	return send_failure(call, as_string_toval(s));
}
开发者ID:Steve888888,项目名称:aerospike-server,代码行数:34,代码来源:udf_rw.c

示例9: udf_cask_info_list

/*
 *  Implementation of the "udf-list" Info. Command.
 */
int udf_cask_info_list(char *name, cf_dyn_buf *out)
{
	cf_debug(AS_UDF, "UDF CASK INFO LIST");

	pthread_mutex_t get_data_mutex = PTHREAD_MUTEX_INITIALIZER;
	pthread_cond_t get_data_cond_var = PTHREAD_COND_INITIALIZER;

	udf_get_data_t get_data;
	get_data.db = out;
	get_data.cv = &get_data_cond_var;

	pthread_mutex_lock(&get_data_mutex);

	int retval = as_smd_get_metadata(udf_smd_module_name, "", udf_cask_get_metadata_cb, &get_data);
	if (!retval) {
		if ((retval = pthread_cond_wait(&get_data_cond_var, &get_data_mutex))) {
			cf_warning(AS_UDF, "pthread_cond_wait failed (rv %d)", retval);
		}
	} else {
		cf_warning(AS_UDF, "failed to get UDF metadata (rv %d)", retval);
	} 

	pthread_mutex_unlock(&get_data_mutex);

	pthread_mutex_destroy(&get_data_mutex);
	pthread_cond_destroy(&get_data_cond_var);

	return retval;
}
开发者ID:Benguang,项目名称:aerospike-server,代码行数:32,代码来源:udf_cask.c

示例10: udf_record_ttl

static uint32_t
udf_record_ttl(const as_rec * rec)
{
	int ret = udf_record_param_check(rec, UDF_BIN_NONAME, __FILE__, __LINE__);
	if (ret) {
		return 0;
	}

	udf_record * urecord = (udf_record *) as_rec_source(rec);


	if (urecord->flag & UDF_RECORD_FLAG_IS_SUBRECORD) {
		cf_debug(AS_UDF, "Return 0 TTL for subrecord ");
		return 0;
	}

	if ((urecord->flag & UDF_RECORD_FLAG_STORAGE_OPEN)) {
		uint32_t now = as_record_void_time_get();

		return urecord->r_ref->r->void_time > now ?
				urecord->r_ref->r->void_time - now : 0;
	}
	else {
		cf_info(AS_UDF, "Error in getting ttl: no record found");
		return 0; // since we can't indicate the record doesn't exist
	}
	return 0;
}
开发者ID:farvour,项目名称:aerospike-server,代码行数:28,代码来源:udf_record.c

示例11: is_connected

static int
is_connected(int fd)
{
	uint8_t buf[8];
	ssize_t rv = recv(fd, (void*)buf, sizeof(buf), MSG_PEEK | MSG_DONTWAIT | MSG_NOSIGNAL);
	
	if (rv == 0) {
		cf_debug("Connected check: Found disconnected fd %d", fd);
		return CONNECTED_NOT;
	}
	
	if (rv < 0) {
		if (errno == EBADF) {
			cf_warn("Connected check: Bad fd %d", fd);
			return CONNECTED_BADFD;
		}
		else if (errno == EWOULDBLOCK || errno == EAGAIN) {
			// The normal case.
			return CONNECTED;
		}
		else {
			cf_info("Connected check: fd %d error %d", fd, errno);
			return CONNECTED_ERROR;
		}
	}
	
	cf_info("Connected check: Peek got unexpected data for fd %d", fd);
	return CONNECTED;
}
开发者ID:Benguang,项目名称:aerospike-client-c,代码行数:29,代码来源:as_node.c

示例12: citrusleaf_info

int
citrusleaf_info(char *hostname, short port, char *names, char **values, int timeout_ms)
{
	int rv = -1;
	cf_vector sockaddr_in_v;
	cf_vector_init(&sockaddr_in_v, sizeof( struct sockaddr_in ), 5, 0);
	if (0 != cl_lookup(NULL, hostname, port, &sockaddr_in_v)) {
		cf_debug("Could not find host %s", hostname);
		goto Done;
	}
	
	for (uint i=0; i < cf_vector_size(&sockaddr_in_v) ; i++) 
	{
		struct sockaddr_in  sa_in;
		cf_vector_get(&sockaddr_in_v, i, &sa_in);

		if (0 == citrusleaf_info_host(&sa_in, names, values, timeout_ms, false)) {
			rv = 0;
			goto Done;
		}
	}
	
Done:
	cf_vector_destroy( &sockaddr_in_v );	
	return(rv);
}
开发者ID:benjolitz,项目名称:aerospike-client-c,代码行数:26,代码来源:cl_info.c

示例13: udf_cask_info_list

/*
 *  Implementation of the "udf-list" Info. Command.
 */
int udf_cask_info_list(char *name, cf_dyn_buf *out)
{
	cf_debug(AS_UDF, "UDF CASK INFO LIST");

	pthread_mutex_t get_data_mutex = PTHREAD_MUTEX_INITIALIZER;
	pthread_cond_t get_data_cond_var = PTHREAD_COND_INITIALIZER;

	udf_get_data_t get_data;
	get_data.db = out;
	get_data.cv = &get_data_cond_var;
	get_data.mt = &get_data_mutex;
	get_data.done = false;

	pthread_mutex_lock(&get_data_mutex);

	int retval = as_smd_get_metadata(udf_smd_module_name, "", udf_cask_get_metadata_cb, &get_data);
	if (!retval) {
		do { // [Note:  Loop protects against spurious wakeups.]
			if ((retval = pthread_cond_wait(&get_data_cond_var, &get_data_mutex))) {
				cf_warning(AS_UDF, "pthread_cond_wait failed (rv %d)", retval);
				break;
			}
		} while (!get_data.done);
	} else {
		cf_warning(AS_UDF, "failed to get UDF metadata (rv %d)", retval);
	}

	pthread_mutex_unlock(&get_data_mutex);

	pthread_mutex_destroy(&get_data_mutex);
	pthread_cond_destroy(&get_data_cond_var);

	return retval;
}
开发者ID:CowLeo,项目名称:aerospike-server,代码行数:37,代码来源:udf_cask.c

示例14: ldt_aerospike_rec_update

static int
ldt_aerospike_rec_update(const as_aerospike * as, const as_rec * rec)
{
	static const char * meth = "ldt_aerospike_rec_update()";
	if (!as || !rec) {
		cf_warning(AS_LDT, "%s: Invalid Parameters [as=%p, record=%p]... Fail", meth, as, rec);
		return 2;
	}
	cf_detail(AS_LDT, "[ENTER]<%s> as(%p) rec(%p)", meth, as, rec );

	ldt_record *lrecord = (ldt_record *)as_rec_source(rec);
	if (!lrecord) {
		return 2;
	}
	as_rec *h_urec      = lrecord->h_urec;
	as_aerospike *las   = lrecord->as;
	int ret = as_aerospike_rec_update(las, h_urec);
	if (0 == ret) {
		cf_detail(AS_LDT, "<%s> ZERO return(%d) from as_aero_rec_update()", meth, ret );
	} else if (ret == -1) {
		// execution error return as it is
		cf_debug(AS_LDT, "<%s> Exec Error(%d) from as_aero_rec_update()", meth, ret );
	} else if (ret == -2) {
		// Record is not open. Unexpected with LDT usage, though a UDF test case
		// does come through here.
		cf_warning(AS_LDT, "%s: Record does not exist or is not open, cannot update");
	}
	return ret;
}
开发者ID:think-css,项目名称:aerospike-server,代码行数:29,代码来源:ldt_aerospike.c

示例15: udf_record_set_flags

/**
 * Set the flags for a specific bin.  This is how LDTs mark Hidden Bins. Other
 * uses may also apply.
 */
static int
udf_record_set_flags(const as_rec * rec, const char * name, uint8_t flags)
{
	int ret = udf_record_param_check(rec, name, __FILE__, __LINE__);
	if (ret) {
		return ret;
	}

	udf_record * urecord = (udf_record *) as_rec_source(rec);
	if (!(urecord->flag & UDF_RECORD_FLAG_ALLOW_UPDATES)) {
		return -1;
	}

	if ( urecord && name ) {
		if (flags & LDT_FLAG_HIDDEN_BIN || flags & LDT_FLAG_LDT_BIN || flags & LDT_FLAG_CONTROL_BIN ) {
			cf_debug(AS_UDF, "LDT flag(%d) Designates Hidden Bin", flags);
			udf_record_cache_sethidden(urecord, name);
		} else {
			cf_warning(AS_UDF, "Unidentified flag setting up %d", flags);
			return -2;
		}
	}

	urecord->flag |= UDF_RECORD_FLAG_METADATA_UPDATED;

	return 0;
}
开发者ID:farvour,项目名称:aerospike-server,代码行数:31,代码来源:udf_record.c


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