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


C++ Package::bufsize方法代码示例

本文整理汇总了C++中Package::bufsize方法的典型用法代码示例。如果您正苦于以下问题:C++ Package::bufsize方法的具体用法?C++ Package::bufsize怎么用?C++ Package::bufsize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Package的用法示例。


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

示例1: zht_unparse_meta

//DEPRECATED
struct metadata* zht_unparse_meta(const char* text) {

	Package package;
	package.ParseFromString(text);
	
	struct metadata* meta = (struct metadata*)malloc(sizeof(struct metadata));
	meta->loc = (struct comLocations *) malloc(sizeof(struct comLocations));
	
	meta->key = package.virtualpath().c_str();
	meta->k = package.k();
	meta->m = package.m();
	meta->bufsize = package.bufsize();
	meta->fileSize = package.filesize();
	meta->encodingLib = package.encodinglib();
	
	return meta;
}
开发者ID:kev40293,项目名称:ida,代码行数:18,代码来源:zht_bridger.cpp

示例2: keyStr

struct metadata * zht_lookup_meta(ZHTClient_c zhtClient, const char * key){

	//1. Lookup in ZHT
	ZHTClient * zhtcppClient = (ZHTClient *) zhtClient;

	string keyStr(key);
	string resSerializedPackage;
	
	Package keyPackage;
	keyPackage.set_virtualpath(keyStr); //as key
	keyPackage.set_isdir(false);
	keyPackage.set_replicano(1);
	keyPackage.set_operation(1); //1 for look up, 2 for remove, 3 for insert
	
	int res = zhtcppClient->lookup(keyPackage.SerializeAsString(),resSerializedPackage);

	dbgprintf("Package Length:%i\n",resSerializedPackage.size());

	
	//2. Parse Package and fill meta
	Package package;
	package.ParseFromString(resSerializedPackage);
	
	struct metadata* meta = (struct metadata*)malloc(sizeof(struct metadata));
	
	//2.1 General file infos
	meta->key = package.virtualpath().c_str();
	meta->k = package.k();
	meta->m = package.m();
	meta->bufsize = package.bufsize();
	meta->fileSize = package.filesize();
	meta->encodingLib = package.encodinglib();
	
	//2.2 Locations
	meta->loc = (struct comLocations *) malloc(sizeof(struct comLocations));

	struct comTransfer * current;
	struct comTransfer * prev = NULL;

	for (int j = package.location_size() -1 ; j >= 0; j--) {
		current = (struct comTransfer *) malloc(sizeof(struct comTransfer));
	
		const Package_Location& location = package.location(j);
	
		//const std::string host = location.hostname();
		current->hostName = (char *) malloc((location.hostname()).size()+1);
		strcpy(current->hostName,location.hostname().c_str());
		
		current->port = location.port();
		
		current->distantChunkName = (char *) malloc((location.distantchunkname()).size()+1);
		strcpy(current->distantChunkName,location.distantchunkname().c_str());
		
		dbgprintf("Host (%i):%s - port: %i - chunkname: %s\n",j,location.hostname().c_str(),location.port(), location.distantchunkname().c_str());
		
		current->next = prev;
		prev = current;
	}
	meta->loc->transfers = current;
	
	
	return meta;
}
开发者ID:kev40293,项目名称:ida,代码行数:63,代码来源:zht_bridger.cpp


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