Skip to content

Commit

Permalink
Boc caching get tree addr (#64)
Browse files Browse the repository at this point in the history
* use boc cache for getTreeAddr

* bump version to 2.1.14

Co-authored-by: Vasily Selivanov <[email protected]>
  • Loading branch information
sauin and Vasily Selivanov authored Aug 25, 2022
1 parent a2809d2 commit 728d34f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions git-remote-gosh/src/blockchain/tree/load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,14 @@ struct GetTreeResult {
impl Tree {
pub async fn calculate_address(
context: &TonClient,
repository_address: &str,
repo_contract: &mut GoshContract,
tree_obj_sha1: &str,
) -> Result<String, Box<dyn Error>> {
let repo_contract = GoshContract::new(repository_address, gosh_abi::REPO);
let params = serde_json::json!({
"treeName": tree_obj_sha1
});
let result: GetTreeResult = repo_contract
.run_local(context, "getTreeAddr", Some(params))
.run_static(context, "getTreeAddr", Some(params))
.await?;
return Ok(result.address);
}
Expand Down
2 changes: 1 addition & 1 deletion git-remote-gosh/src/git_helper/fetch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl GitHelper {
let tree_object_id = format!("{}", tree_node_to_load.oid);
let address = blockchain::Tree::calculate_address(
&self.es_client,
&self.repo_addr,
&mut self.repo_contract,
&tree_object_id,
)
.await?;
Expand Down
2 changes: 1 addition & 1 deletion git-remote-gosh/src/git_helper/fetch/restore_blobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async fn convert_snapshot_into_blob(
Some(_) => ipfs_data,
};

log::info!("got: {:?}", raw_data);
// log::info!("got: {:?}", raw_data);

let data = git_object::Data::new(git_object::Kind::Blob, &raw_data);
let obj = git_object::Object::from(data.decode()?);
Expand Down
4 changes: 2 additions & 2 deletions git-remote-gosh/src/git_helper/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ impl GitHelper {
}

pub async fn calculate_tree_address(
&self,
&mut self,
tree_id: git_hash::ObjectId,
) -> Result<String, Box<dyn Error>> {
Tree::calculate_address(
&self.es_client,
self.repo_addr.as_str(),
&mut self.repo_contract,
&tree_id.to_string(),
)
.await
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "2.1.13"
"version": "2.1.14"
}

0 comments on commit 728d34f

Please sign in to comment.