@@ -66,13 +66,8 @@ impl XetClient {
6666 ///
6767 /// Each call creates a fresh [`FileUploadSession`] because sessions are
6868 /// consumed on finalization and cannot be reused.
69- pub async fn write (
70- & self ,
71- progress_updater : Option < Arc < dyn TrackingProgressUpdater > > ,
72- name : Option < Arc < str > > ,
73- size : u64 ,
74- ) -> errors:: Result < XetWriter > {
75- XetWriter :: new ( self . config . clone ( ) , progress_updater, name, size) . await
69+ pub async fn write ( & self , name : Option < Arc < str > > ) -> errors:: Result < XetWriter > {
70+ XetWriter :: new ( self . config . clone ( ) , name) . await
7671 }
7772}
7873
@@ -89,17 +84,9 @@ pub struct XetWriter {
8984
9085impl XetWriter {
9186 /// Creates a new writer that will upload a single file.
92- ///
93- /// `size` is the total number of bytes that will be written and is used for
94- /// progress tracking. The caller must know the content length before writing.
95- pub async fn new (
96- config : Arc < TranslatorConfig > ,
97- progress_updater : Option < Arc < dyn TrackingProgressUpdater > > ,
98- name : Option < Arc < str > > ,
99- size : u64 ,
100- ) -> errors:: Result < Self > {
101- let session = FileUploadSession :: new ( config, progress_updater) . await ?;
102- let handle = session. start_clean ( name, size, None ) . await ;
87+ pub async fn new ( config : Arc < TranslatorConfig > , name : Option < Arc < str > > ) -> errors:: Result < Self > {
88+ let session = FileUploadSession :: new ( config, None ) . await ?;
89+ let handle = session. start_clean ( name, None , None ) . await ;
10390 Ok ( Self {
10491 session : Some ( session) ,
10592 handle : Some ( handle) ,
@@ -292,7 +279,7 @@ mod tests {
292279 /// Upload `content` via [`XetWriter`] and download it back via [`XetReader`],
293280 /// asserting the round-tripped bytes match the original.
294281 async fn assert_roundtrip ( client : & XetClient , content : & [ u8 ] ) {
295- let mut writer = client. write ( None , None , content . len ( ) as u64 ) . await . unwrap ( ) ;
282+ let mut writer = client. write ( None ) . await . unwrap ( ) ;
296283 for chunk in content. chunks ( 4096 ) {
297284 writer. write ( Bytes :: copy_from_slice ( chunk) ) . await . unwrap ( ) ;
298285 }
@@ -341,7 +328,7 @@ mod tests {
341328 let client = XetClient :: new ( Some ( endpoint) , None , None , "test" . into ( ) ) . unwrap ( ) ;
342329
343330 let content: Vec < u8 > = ( 0 ..1_000_000 ) . map ( |i| ( i % 256 ) as u8 ) . collect ( ) ;
344- let mut writer = client. write ( None , None , content . len ( ) as u64 ) . await . unwrap ( ) ;
331+ let mut writer = client. write ( None ) . await . unwrap ( ) ;
345332 for chunk in content. chunks ( 4096 ) {
346333 writer. write ( Bytes :: copy_from_slice ( chunk) ) . await . unwrap ( ) ;
347334 }
@@ -359,7 +346,7 @@ mod tests {
359346 let endpoint = format ! ( "local://{}" , temp_dir. path( ) . display( ) ) ;
360347 let client = XetClient :: new ( Some ( endpoint) , None , None , "test" . into ( ) ) . unwrap ( ) ;
361348
362- let mut writer = client. write ( None , None , 5 ) . await . unwrap ( ) ;
349+ let mut writer = client. write ( None ) . await . unwrap ( ) ;
363350 writer. write ( Bytes :: from_static ( b"hello" ) ) . await . unwrap ( ) ;
364351 let file_info = writer. close ( ) . await . unwrap ( ) ;
365352
@@ -416,7 +403,7 @@ mod tests {
416403 let endpoint = format ! ( "local://{}" , temp_dir. path( ) . display( ) ) ;
417404 let client = XetClient :: new ( Some ( endpoint) , None , None , "test" . into ( ) ) . unwrap ( ) ;
418405
419- let mut writer = client. write ( None , None , 100 ) . await . unwrap ( ) ;
406+ let mut writer = client. write ( None ) . await . unwrap ( ) ;
420407 writer. write ( Bytes :: from_static ( b"some data" ) ) . await . unwrap ( ) ;
421408 writer. abort ( ) . await . unwrap ( ) ;
422409
@@ -431,7 +418,7 @@ mod tests {
431418 let client = XetClient :: new ( Some ( endpoint) , None , None , "test" . into ( ) ) . unwrap ( ) ;
432419
433420 let content = b"Hello, World!" ;
434- let mut writer = client. write ( None , None , Some ( content . len ( ) as u64 ) ) . await . unwrap ( ) ;
421+ let mut writer = client. write ( None ) . await . unwrap ( ) ;
435422 writer. write ( Bytes :: from_static ( content) ) . await . unwrap ( ) ;
436423 let file_info = writer. close ( ) . await . unwrap ( ) ;
437424
0 commit comments