bookclerk_plugin_echo_native_rust::cli
The cli entrypoint: ping plus the notes commands on the DB binding.
| Item | Kind | Summary |
|---|---|---|
NotesCli |
struct | The cli entrypoint, holding the DB binding the host granted. |
cli_schema |
function | CLI schema advertised at PluginCli.describe. |
whole_number |
function | Parses a whole-number CLI argument within 1..=maximum. |
database_failure |
function | A CLI reply for a failed database call. |
MAX_NOTES_PER_ADD |
constant | Largest --count notes-add accepts, so one command stays a modest write. |
MAX_NOTES_PER_LIST |
constant | Largest --limit notes-list accepts. |
pub struct NotesCli {
/* private fields */
}
The cli entrypoint, holding the DB binding the host granted.
pub fn new(db: Option<DatabaseBinding>) -> Self
The entrypoint over db.
Implements: PluginCli
pub fn cli_schema() -> CliSchema
CLI schema advertised at PluginCli.describe.
pub fn whole_number(value: &str, maximum: usize) -> Option<usize>
Parses a whole-number CLI argument within 1..=maximum.
The number, or None when value is not one to six plain decimal digits
in range.
pub fn database_failure(
err: PluginError,
committed: usize,
) -> Result<CliInvokeResult, PluginError>
A CLI reply for a failed database call.
A typed limit names the cap (exit status 1); any other error is passed on so the host reports it, keeping its code.
err- What the binding returned.committed- Notes already stored by batches that committed before the failure; they stay stored.
Returns err itself when it is not a limit_exceeded error and nothing
was stored; otherwise an error with err's code and details whose
message says how many notes were.
pub const MAX_NOTES_PER_ADD: usize = 10_000;
Largest --count notes-add accepts, so one command stays a modest write.
pub const MAX_NOTES_PER_LIST: usize = 1_000;
Largest --limit notes-list accepts.
The listing goes back in one CLI reply, so it is bounded even though
NotesReader itself streams.
Generated from examples/plugins-echo-native-rust at main · View as Markdown