notify router: deliveries log, dry-run hit counts, api and page
This commit is contained in:
parent
6dd9d0086e
commit
ed1fd053e7
1 changed files with 1848 additions and 40 deletions
|
|
@ -76,7 +76,7 @@ impl FlowsView {
|
|||
}
|
||||
|
||||
/// What the key holds.
|
||||
enum Stored {
|
||||
pub(crate) enum Stored {
|
||||
/// No key, or a deleted one.
|
||||
Nothing,
|
||||
Document(Document),
|
||||
|
|
@ -85,7 +85,7 @@ enum Stored {
|
|||
}
|
||||
|
||||
/// The stored document, with the revision to write against.
|
||||
async fn stored(store: &Store) -> anyhow::Result<(Stored, Option<u64>)> {
|
||||
pub(crate) async fn stored(store: &Store) -> anyhow::Result<(Stored, Option<u64>)> {
|
||||
struct Read(Stored);
|
||||
impl Default for Read {
|
||||
fn default() -> Self {
|
||||
|
|
@ -103,7 +103,7 @@ async fn stored(store: &Store) -> anyhow::Result<(Stored, Option<u64>)> {
|
|||
}
|
||||
|
||||
/// Open [`notify_flows::BUCKET`], creating it if nothing has yet.
|
||||
async fn open(client: &async_nats::Client) -> anyhow::Result<Store> {
|
||||
pub(crate) async fn open(client: &async_nats::Client) -> anyhow::Result<Store> {
|
||||
let js = async_nats::jetstream::new(client.clone());
|
||||
if let Ok(store) = js.get_key_value(notify_flows::BUCKET).await {
|
||||
return Ok(store);
|
||||
|
|
@ -119,7 +119,7 @@ async fn open(client: &async_nats::Client) -> anyhow::Result<Store> {
|
|||
.with_context(|| format!("creating the {} bucket", notify_flows::BUCKET))
|
||||
}
|
||||
|
||||
fn queue_problem(e: &anyhow::Error) -> ProblemDetails {
|
||||
pub(crate) fn queue_problem(e: &anyhow::Error) -> ProblemDetails {
|
||||
tracing::warn!(error = %format!("{e:#}"), "notify flows: queue failure");
|
||||
error_problem(wanted_error_status(e), &format!("{e:#}"))
|
||||
}
|
||||
|
|
@ -158,7 +158,7 @@ pub(crate) async fn get_flows(
|
|||
}
|
||||
}
|
||||
|
||||
fn unreadable(why: &DecodeError) -> ProblemDetails {
|
||||
pub(crate) fn unreadable(why: &DecodeError) -> ProblemDetails {
|
||||
error_problem(
|
||||
StatusCode::CONFLICT,
|
||||
&format!("the stored flows document is not one this build reads: {why}"),
|
||||
|
|
|
|||
Loading…
Reference in a new issue