예제 #1
0
MongoCollectionInfo::MongoCollectionInfo(mongo::BSONObj stats)
{
    _ns = MongoNamespace(QString::fromStdString(stats.getStringField("ns")));
    _sizeBytes = stats.getIntField("size");
    _count = stats.getIntField("count");
    _storageSizeBytes = stats.getIntField("storageSize");
}
예제 #2
0
    MongoCollectionInfo::MongoCollectionInfo(mongo::BSONObj stats) : _ns(stats.getStringField("ns"))
    {
        // if "size" and "storageSize" are of type Int32 or Int64, they
        // will be converted to double by "numberDouble()" function.
        _sizeBytes = BsonUtils::getField<mongo::NumberDouble>(stats,"size");
        _storageSizeBytes = BsonUtils::getField<mongo::NumberDouble>(stats,"storageSize");

        // NumberLong because of mongodb can have very big collections
        _count = BsonUtils::getField<mongo::NumberLong>(stats,"count");
    }
예제 #3
0
void Processer::Handle(mongo::BSONObj& bson)
{
	//handle the bson
	//maybe grid-bosn;maybe cluster-bson
	std::string grid_id;

	if(bson.hasField("grid_ID") && bson.hasField("cluster_data"))
	{
		grid_id = bson.getStringField("grid_ID");
		std::vector<mongo::BSONElement> c_ele = bson["cluster_data"].Array();
		for(int i=0;i<c_ele.size();i++)
		{
			mongo::BSONObj obj = c_ele[i].Obj();
			DoCluster(grid_id,obj);
		}
	}
	else
	{
		grid_id = "";
		DoCluster(grid_id,bson);
	}
}
예제 #4
0
void Processer::DoCluster(const std::string& grid,mongo::BSONObj& cluster)
{
	std::string cluster_id;

	if(cluster.hasField("cluster_ID") && cluster.hasField("host_data"))
	{
		cluster_id = cluster.getStringField("cluster_ID");
		std::vector<mongo::BSONElement> h_ele = cluster["host_data"].Array();
		for(int i=0;i<h_ele.size();i++)
		{
			mongo::BSONObj obj = h_ele[i].Obj();
			DoHost(grid,cluster_id,obj);
		}
	}
	else
	{
		std::stringstream oss;
		oss << "This data is illegal! Drop!!";
		LOG4CXX_WARN(log_,oss.str());
		std::cout << cluster << std::endl;
	}

}
예제 #5
0
    MongoCollectionInfo::MongoCollectionInfo(mongo::BSONObj stats):_ns(QString::fromStdString(stats.getStringField("ns")))
    {
        // if "size" and "storageSize" are of type Int32 or Int64, they
        // will be converted to double by "numberDouble()" function.
        _sizeBytes = stats.getField("size").numberDouble();
        _storageSizeBytes = stats.getField("storageSize").numberDouble();

        _count = stats.getIntField("count");
    }
예제 #6
0
void
Person::deserialize(const mongo::BSONObj& o)
{
  name = o.getStringField("name"); 
  age  = o.getIntField("age");
}
예제 #7
0
 virtual std::string id() {
     return _obj.getStringField("sensor");
 }