@@ -25,6 +25,9 @@ async fn main() -> Result<()> {
2525 . spawn ( )
2626 . await ?;
2727
28+ // We use a blobs client to interact with the blobs protocol we're running locally:
29+ let blobs_client = blobs. client ( ) ;
30+
2831 // Grab all passed in arguments, the first one is the binary itself, so we skip it.
2932 let args: Vec < String > = std:: env:: args ( ) . skip ( 1 ) . collect ( ) ;
3033 // Convert to &str, so we can pattern-match easily:
@@ -35,12 +38,11 @@ async fn main() -> Result<()> {
3538 let filename: PathBuf = filename. parse ( ) ?;
3639 let abs_path = std:: path:: absolute ( & filename) ?;
3740
38- println ! ( "Analyzing file." ) ;
41+ println ! ( "Hashing file." ) ;
3942
4043 // keep the file in place and link it, instead of copying it into the in-memory blobs database
4144 let in_place = true ;
42- let blob = blobs
43- . client ( )
45+ let blob = blobs_client
4446 . add_from_path ( abs_path, in_place, SetTagOption :: Auto , WrapOption :: NoWrap )
4547 . await ?
4648 . finish ( )
@@ -49,7 +51,7 @@ async fn main() -> Result<()> {
4951 let node_id = router. endpoint ( ) . node_id ( ) ;
5052 let ticket = BlobTicket :: new ( node_id. into ( ) , blob. hash , blob. format ) ?;
5153
52- println ! ( "File analyzed . Fetch this file by running:" ) ;
54+ println ! ( "File hashed . Fetch this file by running:" ) ;
5355 println ! (
5456 "cargo run --example transfer -- receive {ticket} {}" ,
5557 filename. display( )
@@ -64,8 +66,7 @@ async fn main() -> Result<()> {
6466
6567 println ! ( "Starting download." ) ;
6668
67- blobs
68- . client ( )
69+ blobs_client
6970 . download ( ticket. hash ( ) , ticket. node_addr ( ) . clone ( ) )
7071 . await ?
7172 . finish ( )
@@ -74,8 +75,7 @@ async fn main() -> Result<()> {
7475 println ! ( "Finished download." ) ;
7576 println ! ( "Copying to destination." ) ;
7677
77- blobs
78- . client ( )
78+ blobs_client
7979 . export (
8080 ticket. hash ( ) ,
8181 abs_path,
0 commit comments