pub struct Journal {}
Expand description
Journals are the primary way that application developers interact with the synchronic web.
Conceptually, a Journal is a service that interacts with users and other Journals (nodes) to persist synchronic web state. Behind the schemes, it is responsible for two capabilities:
-
Persistence: managing bytes on the global hash graph
-
Evaluation: executing code in the global Lisp environment
Records are the primary way that developers interface with Journals. A Record is a mapping between a constant identifier and mutable state. Both identifiers and state are represented as fixed-size Words that the outputs of a cryptographic hash function. When a new record is created, the Journal returns a record secret that is the second hash preimage of the identifier. This is intended to be used so that applications can bootstrap records into increasingly sophisticated notions of identity.
Implementations§
Source§impl Journal
impl Journal
Sourcepub fn evaluate(&self, query: &str) -> String
pub fn evaluate(&self, query: &str) -> String
Evaluate a Lisp expression within a Record
§Examples
use journal_sdk::JOURNAL;
// Simple expression
let output = JOURNAL.evaluate("(+ 1 2)");
assert!(output == "3");
// Complex expression
let output = JOURNAL.evaluate(
"(begin (define (add2 x) (+ x 2)) (add2 1))",
);
assert!(output == "3");