Skip to content

Commit

Permalink
Rename Repository::new to open
Browse files Browse the repository at this point in the history
  • Loading branch information
DrChat committed Dec 31, 2024
1 parent f0f8803 commit 40f2eca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions atrium-repo/src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ pub struct Repository<R: AsyncBlockStoreRead> {
}

impl<R: AsyncBlockStoreRead> Repository<R> {
/// Construct a new instance of a user repository. This is a cheap operation
/// Open a pre-existing instance of a user repository. This is a cheap operation
/// that simply reads out the root commit from a repository (_without_ verifying
/// its signature!)
pub async fn new(mut db: R, root: Cid) -> Result<Self, Error> {
pub async fn open(mut db: R, root: Cid) -> Result<Self, Error> {
let commit_block = db.read_block(&root).await?;
let latest_commit: schema::SignedCommit =
serde_ipld_dagcbor::from_reader(&commit_block[..])?;
Expand Down Expand Up @@ -195,7 +195,7 @@ mod test {
let db = CarStore::new(std::io::Cursor::new(bytes)).await?;
let root = db.header().roots[0];

Repository::new(db, root).await.map_err(Into::into)
Repository::open(db, root).await.map_err(Into::into)
}

#[tokio::test]
Expand Down
2 changes: 1 addition & 1 deletion examples/firehose/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct Firehose;

impl CommitHandler for Firehose {
async fn handle_commit(&self, commit: &Commit) -> Result<()> {
let mut repo = Repository::new(
let mut repo = Repository::open(
CarStore::new(std::io::Cursor::new(commit.blocks.as_slice())).await?,
// N.B: This same CID is also specified inside of the `CarStore`, accessible
// via `car.header().roots[0]`.
Expand Down

0 comments on commit 40f2eca

Please sign in to comment.