Skip to main content

Crate pardarsh_core

Crate pardarsh_core 

Source
Expand description

§pardarsh-core

Application-agnostic infrastructure for the Public Decision Graph: stable identifiers, a common record envelope with typed extensions, attributable append-only history, provenance, typed relationships, validation, storage interfaces, visibility primitives, and a verifiable interchange format.

This crate knows nothing about any particular application. Issue workflows, moderation policy, accounts and UI belong to applications built on top of it.

use pardarsh_core::prelude::*;

let origin = Origin::new("example.org").unwrap();
let mut repo = Repository::new(MemoryStore::new(origin), Validator::default());
let actor = Attribution::system("docs");
let issue = repo
    .create(RecordDraft::new(RecordKind::Issue, "Streetlight out on 4th Cross"), Meta::by(actor.clone()))
    .unwrap()
    .record;
let evidence = repo
    .create(
        RecordDraft::new(RecordKind::Evidence, "Photo after dark")
            .source(SourceRef::new("https://example.org/photo.jpg").authority(SourceAuthority::UserSubmitted))
            .relation(RelationDraft::new(RelationKind::Supports, issue.id.clone())),
        Meta::by(actor),
    )
    .unwrap()
    .record;
let supporting = pardarsh_core::graph::incoming(repo.store(), &issue.id, &[RelationKind::Supports], &[]).unwrap();
assert_eq!(supporting[0].source, evidence.id);

Re-exports§

pub use error::Error;
pub use error::Result;

Modules§

access
Visibility and attribution disclosure.
error
event
Append-only, attributable record history.
extension
Namespaced, typed extensions.
federation
Federation contracts (interfaces only; no network implementation yet).
graph
Relationship queries and bounded traversal.
id
Identifiers.
interchange
Canonical serialization, content hashing, export and import.
model
The common record envelope.
prelude
The commonly used types.
projection
Deriving current state from history, and explaining history to humans.
provenance
Provenance: where a record or claim came from and how it was derived.
relation
Typed relationships between records.
repository
The command side: every change goes through here.
schema
Schema versions and the compatibility policy.
storage
Storage interface and reference implementations.
validation
Structural and semantic validation.