void cloud_blob_properties::update_all(const cloud_blob_properties& parsed_properties, bool ignore_md5)
    {
        if ((type() != blob_type::unspecified) && (type() != parsed_properties.type()))
        {
            throw storage_exception(protocol::error_blob_type_mismatch, false);
        }

        utility::string_t content_md5(ignore_md5 ? m_content_md5 : parsed_properties.content_md5());
        *this = parsed_properties;
        m_content_md5 = content_md5;
    }
Ejemplo n.º 2
0
void column_table::init(const std::vector<column_type>& schema) {
  jubatus::util::concurrent::scoped_lock lk(wlock(table_lock_));
  /* defining tuple */
  if (!columns_.empty()) {
    throw storage_exception(
        "Storage's schemas cannot be over written. Clear schemas before "
        "init()");
  }
  for (std::vector<column_type>::const_iterator it = schema.begin();
       it != schema.end();
       ++it) {
    columns_.push_back(detail::abstract_column(*it));
  }
}
Ejemplo n.º 3
0
    pplx::task<service_stats> cloud_client::download_service_stats_base_async(const request_options& modified_options, operation_context context, const pplx::cancellation_token& cancellation_token) const
    {
        if (modified_options.location_mode() == location_mode::primary_only)
        {
            throw storage_exception("download_service_stats cannot be run with a 'primary_only' location mode.");
        }

        auto command = std::make_shared<core::storage_command<service_stats>>(base_uri(), cancellation_token, modified_options.is_maximum_execution_time_customized());
        command->set_build_request(std::bind(protocol::get_service_stats, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
        command->set_authentication_handler(authentication_handler());
        command->set_location_mode(core::command_location_mode::primary_or_secondary);
        command->set_preprocess_response(std::bind(protocol::preprocess_response<service_stats>, service_stats(), std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
        command->set_postprocess_response([] (const web::http::http_response& response, const request_result&, const core::ostream_descriptor&, operation_context context) -> pplx::task<service_stats>
        {
            protocol::service_stats_reader reader(response.body());
            return pplx::task_from_result<service_stats>(reader.move_stats());
        });
        return core::executor<service_stats>::execute_async(command, modified_options, context);
    }