#include #include #include #include namespace DB { StorageHiveMetadata::~StorageHiveMetadata() = default; String StorageHiveMetadata::toString() const { Poco::JSON::Object jobj; jobj.set("schema", schema); jobj.set("cluster", cluster); jobj.set("remote_path", remote_path); jobj.set("last_modification_timestamp", last_modification_timestamp); jobj.set("file_size", file_size); std::stringstream buf; // STYLE_CHECK_ALLOW_STD_STRING_STREAM jobj.stringify(buf); return buf.str(); } bool StorageHiveMetadata::fromString(const String &buf) { std::stringstream istream; // STYLE_CHECK_ALLOW_STD_STRING_STREAM istream << buf; Poco::JSON::Parser parser; auto jobj = parser.parse(istream).extract(); remote_path = jobj->get("remote_path").convert(); schema = jobj->get("schema").convert(); cluster = jobj->get("cluster").convert(); last_modification_timestamp = jobj->get("last_modification_timestamp").convert(); file_size =jobj->get("file_size").convert(); return true; } String StorageHiveMetadata::getVersion() const { return std::to_string(getLastModificationTimestamp()); } REGISTTER_REMOTE_FILE_META_DATA_CLASS(StorageHiveMetadata) }