@@ -8,7 +8,6 @@ use serde::{Deserialize, Serialize};
88use tracing:: trace;
99
1010use crate :: {
11- format:: collection:: Collection ,
1211 store:: { BaoBlobSize , ExportFormat , ExportMode , MapEntry , Store as BaoStore } ,
1312 util:: progress:: { IdGenerator , ProgressSender } ,
1413 Hash ,
@@ -32,11 +31,13 @@ pub async fn export<D: BaoStore>(
3231) -> anyhow:: Result < ( ) > {
3332 match format {
3433 ExportFormat :: Blob => export_blob ( db, hash, outpath, mode, progress) . await ,
34+ #[ cfg( feature = "formats-collection" ) ]
3535 ExportFormat :: Collection => export_collection ( db, hash, outpath, mode, progress) . await ,
3636 }
3737}
3838
3939/// Export all entries of a collection, recursively, to files on the local filesystem.
40+ #[ cfg( feature = "formats-collection" ) ]
4041pub async fn export_collection < D : BaoStore > (
4142 db : & D ,
4243 hash : Hash ,
@@ -45,7 +46,7 @@ pub async fn export_collection<D: BaoStore>(
4546 progress : impl ProgressSender < Msg = ExportProgress > + IdGenerator ,
4647) -> anyhow:: Result < ( ) > {
4748 tokio:: fs:: create_dir_all ( & outpath) . await ?;
48- let collection = Collection :: load_db ( db, & hash) . await ?;
49+ let collection = crate :: format :: collection :: Collection :: load_db ( db, & hash) . await ?;
4950 for ( name, hash) in collection. into_iter ( ) {
5051 #[ allow( clippy:: needless_borrow) ]
5152 let path = outpath. join ( pathbuf_from_name ( & name) ) ;
@@ -126,6 +127,7 @@ pub enum ExportProgress {
126127 Abort ( serde_error:: Error ) ,
127128}
128129
130+ #[ cfg( feature = "formats-collection" ) ]
129131fn pathbuf_from_name ( name : & str ) -> PathBuf {
130132 let mut path = PathBuf :: new ( ) ;
131133 for part in name. split ( '/' ) {
0 commit comments