Your opinion will help to improve our service
Leave a feedback >#include <userver/storages/sqlite/component.hpp>
SQLite client component.
Provides access to a SQLite connections via storages::sqlite::Client.
sqlite-dv:
db-path: "/tmp/kv.db"
task_processor: fs-task-processor
journal_mode: wal
busy_timeout: 1000 # ms
read_only: false
initial_read_only_pool_size: 4
max_read_only_pool_size: 16
persistent_prepared_statements: true
cache_size: -65536 # KiB
foreign_keys: true
You must specify either db-path
.
You must specify blocking_task_processor
as well.
Please see SQLite documentation on connection strings.
Name | Description | Default value |
---|---|---|
fs-task-processor | name of the task processor to handle the blocking file operations | engine::current_task::GetBlockingTaskProcessor() |
db-path | path to the database file or ::memory:: for in-memory mode | - |
create_file | сreate the database file if it does not exist at the specified path | true |
is_read_only | open the database in read-only mode | false |
shared_cache | enable shared in-memory cache for the database | false |
read_uncommitted | allow reading uncommitted data (requires shared_cache) | false |
journal_mode | mode for database journaling | wal |
busy_timeout | timeout duration (in milliseconds) to wait when the database is busy | 5000 |
foreign_keys | enable enforcement of foreign key constraints | true |
synchronous | set the level of synchronization to ensure data durability | normal |
cache_size | maximum cache size, specified in number of pages or in kibibytes (negative value) | -2000 |
journal_size_limit | limit the size of rollback-journal and WAL files (in bytes) | 67108864 |
mmap_size | maximum number of bytes allocated for memory-mapped I/O | 30000000000 |
page_size | size of a database page (in bytes) | 4096 |
temp_store | storage location for temporary tables and indexes | memory |
persistent-prepared-statements | cache prepared statements for reuse | true |
max_prepared_cache_size | maximum number of prepared statements to cache | 200 |
initial_read_only_pool_size | initial size of the read-only connection pool | 5 |
max_read_only_pool_size | maximum size of the read-only connection pool | 10 |
Definition at line 72 of file component.hpp.
Public Member Functions | |
SQLite (const ComponentConfig &, const ComponentContext &) | |
Component constructor. | |
~SQLite () override | |
Component destructor. | |
storages::sqlite::ClientPtr | GetClient () const |
Client accessor. | |
ComponentHealth | GetComponentHealth () const override |
void | OnLoadingCancelled () override |
void | OnAllComponentsLoaded () override |
void | OnAllComponentsAreStopping () override |
Static Public Member Functions | |
static yaml_config::Schema | GetStaticConfigSchema () |
Protected Types | |
using | LoggableComponentBase = ComponentBase |
|
protectedinherited |
Definition at line 67 of file component_base.hpp.
|
inlineoverridevirtualinherited |
Override this function to inform the world of the state of your component.
Reimplemented from components::RawComponentBase.
Reimplemented in server::handlers::Restart.
Definition at line 35 of file component_base.hpp.
|
inlineoverridevirtualinherited |
Component may use this function to stop doing work before the stop of the components that depend on it.
Base components may override it and make final
to do some work before the derived object constructor is called. Don't use it otherwise.
Reimplemented from components::RawComponentBase.
Reimplemented in components::Server, and urabbitmq::ConsumerComponentBase.
Definition at line 58 of file component_base.hpp.
|
inlineoverridevirtualinherited |
Component may use this function to finalize registration of other components that depend on it (for example, handler components register in server component, and the latter uses OnAllComponentsLoaded() to start processing requests).
Base components may override it and make final
to do some work after the derived object constructor is called. Don't use it otherwise.
Reimplemented from components::RawComponentBase.
Reimplemented in components::Server, server::handlers::Ping, and urabbitmq::ConsumerComponentBase.
Definition at line 51 of file component_base.hpp.
|
inlineoverridevirtualinherited |
Called once if the creation of any other component failed. If the current component expects some other component to take any action with the current component, this call is a signal that such action may never happen due to components loading was cancelled. Application components might not want to override it.
Reimplemented from components::RawComponentBase.
Definition at line 42 of file component_base.hpp.