Skip to content

Commit

Permalink
add storage_config_uri (#493)
Browse files Browse the repository at this point in the history
* add storage_config_uri

Signed-off-by: Karsten Knese <[email protected]>

* linters and tests

Signed-off-by: Karsten Knese <[email protected]>

* move storage options to rosbag2_storage

Signed-off-by: Karsten Knese <[email protected]>

* use storage options to open storage backends

Signed-off-by: Karsten Knese <[email protected]>

* add rosbag2_py to metapackage

Signed-off-by: Karsten Knese <[email protected]>
  • Loading branch information
Karsten1987 authored and adamdbrw committed Nov 2, 2020
1 parent 19ee70d commit 79f35d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 2 additions & 5 deletions rosbag2_cpp/src/rosbag2_cpp/writers/sequential_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ void SequentialWriter::reset()
metadata_io_->write_metadata(base_folder_, metadata_);
}

reset_cache();
storage_.reset(); // Necessary to ensure that the storage is destroyed before the factory
storage_factory_.reset();
}
Expand Down Expand Up @@ -252,11 +253,7 @@ void SequentialWriter::write(std::shared_ptr<rosbag2_storage::SerializedBagMessa
cache_.push_back(converted_msg);
current_cache_size_ += converted_msg->serialized_data->buffer_length;
if (current_cache_size_ >= storage_options_.max_cache_size) {
storage_->write(cache_);
// reset cache
cache_.clear();
cache_.reserve(storage_options_.max_cache_size);
current_cache_size_ = 0u;
reset_cache();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,15 @@ void SqliteStorage::open(
const rosbag2_storage::StorageOptions & storage_options,
rosbag2_storage::storage_interfaces::IOFlag io_flag)
{
if (!storage_options.storage_config_uri.empty()) {
fprintf(stderr, "going to open config file: %s\n", storage_options.storage_config_uri.c_str());
throw std::runtime_error("storage specific config file is not yet implemented.");
}

auto pragmas = parse_pragmas(storage_options.storage_config_uri, io_flag);

if (is_read_write(io_flag)) {
relative_path_ = storage_options.uri + FILE_EXTENSION;
relative_path_ = uri + FILE_EXTENSION;

// READ_WRITE requires the DB to not exist.
if (rcpputils::fs::path(relative_path_).exists()) {
Expand Down

0 comments on commit 79f35d5

Please sign in to comment.