示例#1
0
文件: sdb.cpp 项目: uberlabs/libaws
bool putAttribute (SDBConnectionPtr aSDB, const std::string& aDomainName, const std::string& aItemName,
                   const std::string& aKey, const std::string& aValue, bool aReplace) {
  try {
      std::vector<aws::Attribute> lAttrs;
      aws::Attribute lAttr (aKey, aValue, aReplace);
      lAttrs.push_back (lAttr);
      PutAttributesResponsePtr lRes = aSDB->putAttributes (aDomainName, aItemName, lAttrs);
      std::cout << "put attribute successfully" << std::endl;
    } catch (PutAttributesException &e) {
      std::cerr << e.what() << std::endl;
      return false;
    }
  return true;
}
示例#2
0
static void
upload_image_meta(SDBConnectionPtr sdbconn, ImageMetadata *meta, const char **attrs)
{
	assert(meta->imagetable != NULL);
	if (attrs == NULL) {
		attrs = IMAGE_ATTRS;
	}
	const char **attr = attrs;
    std::vector<Attribute> awsattrs;
	while (*attr != NULL) {
		std::string key(*attr);
		std::string value;
		serial_image_meta(meta, *attr, value);
	    Attribute awsattr(key, value, true);
	    awsattrs.push_back (awsattr);
		attr++;
	}
	std::string item;
	serial_image_meta(meta, IMAGE_ITEM_ID, item);
	    PutAttributesResponsePtr res = sdbconn->putAttributes(meta->imagetable->imagedomain,
	item, awsattrs);
}
示例#3
0
static void
upload_image_table_meta(SDBConnectionPtr sdbconn,
		ImageTableMetadata *meta,
			const char **attrs)
{
	if (attrs == NULL) {
		attrs = IMAGE_TABLE_ATTRS;
	}
	const char **attr = attrs;
    std::vector<Attribute> awsattrs;
	while (*attr != NULL) {
		std::string key(*attr);
		std::string value;
		serial_image_table_meta(meta, *attr, value);
  aws::Attribute awsattr(key, value, true);
	    awsattrs.push_back(awsattr);
		attr++;
	}
	std::string value;
	serial_image_table_meta(meta, IMAGE_TABLE_ITEM_ID, value);
	    PutAttributesResponsePtr res = sdbconn->putAttributes(CVDB::CATALOG,
	value, awsattrs);
}