Skip to content

Commit

Permalink
Block timestamps now in chronicle application events
Browse files Browse the repository at this point in the history
Timestamps now provide an ordering for terms, this allows incremental arrow use

Signed-off-by: Ryan <[email protected]>
  • Loading branch information
ryan-s-roberts committed Jul 22, 2024
1 parent 552f78a commit 97635a7
Show file tree
Hide file tree
Showing 28 changed files with 592 additions and 453 deletions.
332 changes: 163 additions & 169 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ members = [
Inflector = "0.11.4"
anyhow = { version = "^1", features = ["backtrace"] }
assert_fs = "1.0"
async-graphql = "^7"
async-graphql = "7.0.7"
async-graphql-poem = "^7"
async-signals = "^0.4"
async-stream = "^0.3.3"
Expand Down Expand Up @@ -101,7 +101,7 @@ mockito = "1.1"
newtype-derive-2018 = "0.2.1"
oauth2 = "4.4"
opa = { git = "https://github.com/chronicleworks/opa-rs", rev = "9fa2fbce" }
opentelemetry = { version = "0.22" }
opentelemetry = { version = "0.23" }
owo-colors = "3.5.0"
parking_lot = "0.12.0"
percent-encoding = "2.1.0"
Expand Down
1 change: 0 additions & 1 deletion crates/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ common = { path = "../common", features = [
protocol-substrate = { path = "../protocol-substrate" }
protocol-substrate-chronicle = { path = "../protocol-substrate-chronicle" }
protocol-substrate-opa = { path = "../protocol-substrate-opa" }
r2d2 = { version = "^0.8.1" }


[dev-dependencies]
Expand Down
7 changes: 4 additions & 3 deletions crates/api/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,12 @@ where
// Successfully committed to ledger, so apply
// to db and broadcast notification to
// subscription subscribers
Some((ChronicleEvent::Committed{ref diff, ref identity, ..},tx,block_id,_position,_span )) => {
Some((ChronicleEvent::Committed{ref diff, ref identity, timestamp, .. },tx,block_id,_position,_span )) => {

debug!(diff = ?diff.summarize());
trace!(delta = %serde_json::to_string_pretty(&diff.to_json().compact().await.unwrap()).unwrap());

api.sync( diff.clone().into(), &block_id,tx )
api.sync( diff.clone().into(), &block_id,tx , timestamp)
.instrument(info_span!("incoming_confirmation", offset = ?block_id, tx = %tx))
.await
.map_err(|e| {
Expand Down Expand Up @@ -1297,10 +1297,11 @@ where
prov: Box<ProvModel>,
block_id: &BlockId,
tx_id: ChronicleTransactionId,
block_time: u64,
) -> Result<ApiResponse, ApiError> {
trace!(prov = ?prov);
let block_id = *block_id;
self.store.apply_prov(&prov).await?;
self.store.apply_prov(&prov, block_time, block_id).await?;
self.store.set_last_block_id(&block_id, tx_id).await?;
Ok(ApiResponse::Unit)
}
Expand Down
7 changes: 0 additions & 7 deletions crates/api/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@ pub enum ApiError {
AddrParseError,
),

#[error("Connection pool: {0}")]
ConnectionPool(
#[from]
#[source]
r2d2::Error,
),

#[error("IO error: {0}")]
InputOutput(
#[from]
Expand Down
Loading

0 comments on commit 97635a7

Please sign in to comment.