-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* NEW [docs] add SQLite APIs description
- Loading branch information
Showing
2 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
= nng_mqtt_sqlite_functions(3) | ||
// | ||
// Copyright 2018 Staysail Systems, Inc. <[email protected]> | ||
// Copyright 2018 Capitar IT Group BV <[email protected]> | ||
// | ||
// This document is supplied under the terms of the MIT License, a | ||
// copy of which should be located in the distribution where this | ||
// file was obtained (LICENSE.txt). A copy of the license may also be | ||
// found online at https://opensource.org/licenses/MIT. | ||
// | ||
|
||
== NAME | ||
|
||
nng_mqtt_alloc_sqlite_opt - allocate a nng_mqtt_sqlite_option object | ||
|
||
nng_mqtt_free_sqlite_opt - free a nng_mqtt_sqlite_option object | ||
|
||
nng_mqtt_set_sqlite_enable - enable or disable sqlite caching | ||
|
||
nng_mqtt_set_sqlite_db_dir - specify a mount path for SQLite DB file | ||
|
||
nng_mqtt_set_sqlite_max_rows - specify Max message limitation for caching | ||
|
||
nng_mqtt_set_sqlite_flush_threshold - specify a threshold of flushing messages to flash | ||
|
||
nng_mqtt_sqlite_db_init - initialize sqlite options and create or open a database file | ||
|
||
nng_mqtt_sqlite_db_fini - deinit `nng_mqtt_sqlite_option` and close database file | ||
|
||
nng_mqtt_sqlite_db_get_cached_size - get cached message size | ||
|
||
== SYNOPSIS | ||
|
||
[source, c] | ||
---- | ||
#include <nng/mqtt/mqtt_client.h> | ||
typedef struct nng_mqtt_sqlite_option nng_mqtt_sqlite_option; | ||
int nng_mqtt_alloc_sqlite_opt(nng_mqtt_sqlite_option **opt); | ||
int nng_mqtt_free_sqlite_opt(nng_mqtt_sqlite_option *opt); | ||
void nng_mqtt_set_sqlite_enable(nng_mqtt_sqlite_option *opt, bool enable); | ||
void nng_mqtt_set_sqlite_db_dir( | ||
nng_mqtt_sqlite_option *opt, const char *dir_path); | ||
void nng_mqtt_set_sqlite_max_rows(nng_mqtt_sqlite_option *opt, size_t max_rows); | ||
void nng_mqtt_set_sqlite_flush_threshold( | ||
nng_mqtt_sqlite_option *opt, size_t threshold); | ||
void nng_mqtt_sqlite_db_init( | ||
nng_mqtt_sqlite_option *opt, const char *db_name, uint8_t mqtt_proto); | ||
void nng_mqtt_sqlite_db_fini(nng_mqtt_sqlite_option *opt); | ||
size_t nng_mqtt_sqlite_db_get_cached_size(nng_mqtt_sqlite_option *opt); | ||
---- | ||
|
||
== DESCRIPTION | ||
|
||
SQLite is disabled by default.To enable SQLite, it's necessary to compile with cmake option `-DNNG_ENABLE_SQLITE=ON`. | ||
|
||
|
||
|=== | ||
|Function | Description | Return | ||
|`nng_mqtt_alloc_sqlite_opt()` | allocate a nng_mqtt_sqlite_option object | 0: success + | ||
nonzero: error code | ||
|`nng_mqtt_free_sqlite_opt()` | free a nng_mqtt_sqlite_option object | 0 | ||
|`nng_mqtt_set_sqlite_enable()` | enable or disable sqlite caching | non | ||
|`nng_mqtt_set_sqlite_db_dir()` | specify a mount path for SQLite DB file + | ||
(default: client running path) | non | ||
|`nng_mqtt_set_sqlite_max_rows()` | specify Max message limitation for caching + | ||
0 means ineffective + | ||
range: 1-infinity + | ||
(default: 102400) | non | ||
|`nng_mqtt_set_sqlite_flush_threshold()` |specify a threshold of flushing messages to flash + | ||
1-infinity + | ||
(default: 100) | ||
| non | ||
|`nng_mqtt_sqlite_db_init()` | initialize sqlite options and create or open a database file | non | ||
|`nng_mqtt_sqlite_db_fini()` | deinit `nng_mqtt_sqlite_option` and close database file | non | ||
|`nng_mqtt_sqlite_db_get_cached_size()` | get cached message size | message size | ||
|=== | ||
|
||
== ERRORS | ||
|
||
none | ||
|
||
== SEE ALSO | ||
|
||
[.text-left] | ||
xref:nng_mqtt_msg_alloc.3.adoc[nng_mqtt_msg_alloc()], | ||
xref:nng_mqtt_msg_set_connect.3.adoc[nng_mqtt_msg_set_connect()], | ||
xref:xref:nng_pipe_notify.3.adoc[nng_pipe_notify()], | ||
xref:nng_strerror.3.adoc[nng_strerror(3)], | ||
xref:nng_url_parse.3.adoc[nng_url_parse(3)], | ||
xref:nng.7.adoc[nng(7)] |