@@ -8,7 +8,6 @@ use serde::{Deserialize, Serialize};
8
8
use tracing:: trace;
9
9
10
10
use crate :: {
11
- format:: collection:: Collection ,
12
11
store:: { BaoBlobSize , ExportFormat , ExportMode , MapEntry , Store as BaoStore } ,
13
12
util:: progress:: { IdGenerator , ProgressSender } ,
14
13
Hash ,
@@ -32,11 +31,13 @@ pub async fn export<D: BaoStore>(
32
31
) -> anyhow:: Result < ( ) > {
33
32
match format {
34
33
ExportFormat :: Blob => export_blob ( db, hash, outpath, mode, progress) . await ,
34
+ #[ cfg( feature = "formats-collection" ) ]
35
35
ExportFormat :: Collection => export_collection ( db, hash, outpath, mode, progress) . await ,
36
36
}
37
37
}
38
38
39
39
/// Export all entries of a collection, recursively, to files on the local filesystem.
40
+ #[ cfg( feature = "formats-collection" ) ]
40
41
pub async fn export_collection < D : BaoStore > (
41
42
db : & D ,
42
43
hash : Hash ,
@@ -45,7 +46,7 @@ pub async fn export_collection<D: BaoStore>(
45
46
progress : impl ProgressSender < Msg = ExportProgress > + IdGenerator ,
46
47
) -> anyhow:: Result < ( ) > {
47
48
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 ?;
49
50
for ( name, hash) in collection. into_iter ( ) {
50
51
#[ allow( clippy:: needless_borrow) ]
51
52
let path = outpath. join ( pathbuf_from_name ( & name) ) ;
@@ -126,6 +127,7 @@ pub enum ExportProgress {
126
127
Abort ( serde_error:: Error ) ,
127
128
}
128
129
130
+ #[ cfg( feature = "formats-collection" ) ]
129
131
fn pathbuf_from_name ( name : & str ) -> PathBuf {
130
132
let mut path = PathBuf :: new ( ) ;
131
133
for part in name. split ( '/' ) {
0 commit comments