.. _program_listing_file__tmp_ws_src_rosbag2_rosbag2_storage_default_plugins_include_rosbag2_storage_default_plugins_sqlite_sqlite_pragmas.hpp: Program Listing for File sqlite_pragmas.hpp =========================================== |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/rosbag2/rosbag2_storage_default_plugins/include/rosbag2_storage_default_plugins/sqlite/sqlite_pragmas.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // Copyright 2020, Robotec.ai sp. z o.o. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef ROSBAG2_STORAGE_DEFAULT_PLUGINS__SQLITE__SQLITE_PRAGMAS_HPP_ #define ROSBAG2_STORAGE_DEFAULT_PLUGINS__SQLITE__SQLITE_PRAGMAS_HPP_ #include #include #include #include namespace rosbag2_storage_plugins { class ROSBAG2_STORAGE_DEFAULT_PLUGINS_PUBLIC SqlitePragmas { public: using pragmas_map_t = std::unordered_map; static pragmas_map_t default_pragmas() { static pragmas_map_t p = {{"schema_version", "PRAGMA schema_version;"}}; return p; } // more robust storage settings will cause performace hit on writing, // but increase resistance to bagfile data corruption in case of crashes static pragmas_map_t robust_writing_pragmas() { static pragmas_map_t p = { {"journal_mode", "PRAGMA journal_mode=WAL;"}, {"synchronous", "PRAGMA synchronous=NORMAL;"} }; return p; } static pragmas_map_t optimized_writing_pragmas() { static pragmas_map_t p = { {"journal_mode", "PRAGMA journal_mode=MEMORY;"}, {"synchronous", "PRAGMA synchronous=OFF;"} }; return p; } }; } // namespace rosbag2_storage_plugins #endif // ROSBAG2_STORAGE_DEFAULT_PLUGINS__SQLITE__SQLITE_PRAGMAS_HPP_