Skip to content

Commit

Permalink
JournalCheckpoint only holds Filesystem clock
Browse files Browse the repository at this point in the history
  • Loading branch information
jscatena88 committed Jul 5, 2024
1 parent 65827fc commit 3d74cb9
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/codec/meta/journal_checkpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

use futures::io::AsyncWrite;

use crate::codec::meta::{Cid, VectorClockFilesystemActorSnapshot};
use crate::codec::meta::{Cid, VectorClockFilesystemSnapshot};
use crate::codec::{ParserResult, Stream};

#[derive(Clone, Debug, PartialEq)]
pub struct JournalCheckpoint {
merkle_root_cid: Cid,
vector: VectorClockFilesystemActorSnapshot,
vector: VectorClockFilesystemSnapshot,
}

impl JournalCheckpoint {
Expand All @@ -27,7 +27,7 @@ impl JournalCheckpoint {

pub fn parse(input: Stream) -> ParserResult<Self> {
let (input, merkle_root_cid) = Cid::parse(input)?;
let (input, vector) = VectorClockFilesystemActorSnapshot::parse(input)?;
let (input, vector) = VectorClockFilesystemSnapshot::parse(input)?;

let journal_checkpoint = JournalCheckpoint {
merkle_root_cid,
Expand All @@ -38,15 +38,15 @@ impl JournalCheckpoint {
}

pub const fn size() -> usize {
Cid::size() + VectorClockFilesystemActorSnapshot::size()
Cid::size() + VectorClockFilesystemSnapshot::size()
}
}

#[cfg(test)]
mod tests {
use winnow::Partial;

use crate::codec::{crypto::Fingerprint, ActorId, VectorClockActor, VectorClockFilesystem};
use crate::codec::VectorClockFilesystem;

use super::*;

Expand All @@ -58,10 +58,7 @@ mod tests {
async fn test_user_agent_roundtrip() {
let checkpoint = JournalCheckpoint {
merkle_root_cid: Cid::from([0; 32]),
vector: VectorClockFilesystemActorSnapshot::from((
&VectorClockFilesystem::initialize(),
&VectorClockActor::initialize(ActorId::from(Fingerprint::from([0; 32]))),
)),
vector: (&VectorClockFilesystem::initialize()).as_snapshot(),
};

let mut buffer = Vec::with_capacity(JournalCheckpoint::size());
Expand Down

0 comments on commit 3d74cb9

Please sign in to comment.