Expand description
Provider webhook event processing for the Shardline server.
This crate handles incoming provider webhook events (repository deleted, renamed, access changed, revision pushed) and applies the corresponding metadata mutations.
§Quick start
The outcome types are pure data describing what one webhook application did, so they are the easiest entry point:
use shardline_provider_events::{ProviderWebhookOutcome, ProviderWebhookOutcomeKind};
use shardline_vcs::ProviderKind;
let outcome = ProviderWebhookOutcome {
provider: ProviderKind::GitHub,
owner: "acme".to_owned(),
repo: "assets".to_owned(),
delivery_id: "delivery-123".to_owned(),
event_kind: ProviderWebhookOutcomeKind::RepositoryDeleted,
affected_file_versions: 12,
affected_chunks: 34,
applied_holds: 1,
retention_seconds: Some(3600),
};
assert_eq!(outcome.owner, "acme");
assert!(matches!(outcome.event_kind, ProviderWebhookOutcomeKind::RepositoryDeleted));A rename carries the new location:
use shardline_provider_events::ProviderWebhookOutcomeKind;
let kind = ProviderWebhookOutcomeKind::RepositoryRenamed {
new_owner: "acme".to_owned(),
new_repo: "assets-v2".to_owned(),
};
assert!(matches!(
kind,
ProviderWebhookOutcomeKind::RepositoryRenamed { new_repo, .. } if new_repo == "assets-v2"
));To apply a webhook to real state, call apply_provider_webhook_with_stores
with explicit record, index, and object-store adapters.
Structs§
- Planned
Postgres Provider Webhook - Planned atomic Postgres mutation and its applied/duplicate protocol outcomes.
- Provider
Webhook Outcome - Summary of one handled provider webhook.
Enums§
- Provider
Events Error - Provider webhook event processing failure.
- Provider
Webhook Outcome Kind - Publicly reportable webhook outcome kind.
Constants§
- DEFAULT_
LOCAL_ GC_ RETENTION_ SECONDS - Default retention window for new local quarantine candidates. Default retention window for new local quarantine candidates.
- WEBHOOK_
DELIVERY_ RETENTION_ SECONDS - Default retention window for the provider webhook delivery replay-dedup table. Delivery claims older than this are purged to bound metadata-store growth; replay dedup within the window is unaffected.
Functions§
- apply_
provider_ webhook_ with_ stores - Applies a normalized provider webhook to Shardline lifecycle state.
- plan_
postgres_ provider_ repository_ webhook - Plans one Postgres repository webhook without changing durable metadata.
- purge_
expired_ webhook_ deliveries - Opportunistically purges webhook-delivery dedup rows older than the
retention window, at most once per
[
WEBHOOK_DELIVERY_PURGE_INTERVAL_SECONDS].