@@ -25,6 +25,9 @@ pub struct ConfigV2 {
25
25
pub id : String ,
26
26
/// Configuration information for storage backend.
27
27
pub backend : Option < BackendConfigV2 > ,
28
+ /// Configuration for external storage backends, order insensitivity.
29
+ #[ serde( default ) ]
30
+ pub external_backends : Vec < ExternalBackendConfig > ,
28
31
/// Configuration information for local cache system.
29
32
pub cache : Option < CacheConfigV2 > ,
30
33
/// Configuration information for RAFS filesystem.
@@ -42,6 +45,7 @@ impl Default for ConfigV2 {
42
45
version : 2 ,
43
46
id : String :: new ( ) ,
44
47
backend : None ,
48
+ external_backends : Vec :: new ( ) ,
45
49
cache : None ,
46
50
rafs : None ,
47
51
overlay : None ,
@@ -57,6 +61,7 @@ impl ConfigV2 {
57
61
version : 2 ,
58
62
id : id. to_string ( ) ,
59
63
backend : None ,
64
+ external_backends : Vec :: new ( ) ,
60
65
cache : None ,
61
66
rafs : None ,
62
67
overlay : None ,
@@ -971,6 +976,9 @@ pub struct BlobCacheEntryConfigV2 {
971
976
/// Configuration information for storage backend.
972
977
#[ serde( default ) ]
973
978
pub backend : BackendConfigV2 ,
979
+ /// Configuration for external storage backends, order insensitivity.
980
+ #[ serde( default ) ]
981
+ pub external_backends : Vec < ExternalBackendConfig > ,
974
982
/// Configuration information for local cache system.
975
983
#[ serde( default ) ]
976
984
pub cache : CacheConfigV2 ,
@@ -1034,6 +1042,7 @@ impl From<&BlobCacheEntryConfigV2> for ConfigV2 {
1034
1042
version : c. version ,
1035
1043
id : c. id . clone ( ) ,
1036
1044
backend : Some ( c. backend . clone ( ) ) ,
1045
+ external_backends : c. external_backends . clone ( ) ,
1037
1046
cache : Some ( c. cache . clone ( ) ) ,
1038
1047
rafs : None ,
1039
1048
overlay : None ,
@@ -1309,6 +1318,19 @@ struct CacheConfig {
1309
1318
pub prefetch_config : BlobPrefetchConfig ,
1310
1319
}
1311
1320
1321
+ /// Additional configuration information for external backend, its items
1322
+ /// will be merged to the configuration from image.
1323
+ #[ derive( Clone , Debug , Default , Deserialize , Eq , PartialEq , Serialize ) ]
1324
+ pub struct ExternalBackendConfig {
1325
+ /// External backend identifier to merge.
1326
+ pub patch : HashMap < String , String > ,
1327
+ /// External backend type.
1328
+ #[ serde( rename = "type" ) ]
1329
+ pub kind : String ,
1330
+ /// External backend config items to merge.
1331
+ pub config : HashMap < String , String > ,
1332
+ }
1333
+
1312
1334
impl TryFrom < & CacheConfig > for CacheConfigV2 {
1313
1335
type Error = std:: io:: Error ;
1314
1336
@@ -1350,6 +1372,9 @@ struct FactoryConfig {
1350
1372
pub id : String ,
1351
1373
/// Configuration for storage backend.
1352
1374
pub backend : BackendConfig ,
1375
+ /// Configuration for external storage backends, order insensitivity.
1376
+ #[ serde( default ) ]
1377
+ pub external_backends : Vec < ExternalBackendConfig > ,
1353
1378
/// Configuration for blob cache manager.
1354
1379
#[ serde( default ) ]
1355
1380
pub cache : CacheConfig ,
@@ -1410,6 +1435,7 @@ impl TryFrom<RafsConfig> for ConfigV2 {
1410
1435
version : 2 ,
1411
1436
id : v. device . id ,
1412
1437
backend : Some ( backend) ,
1438
+ external_backends : v. device . external_backends ,
1413
1439
cache : Some ( cache) ,
1414
1440
rafs : Some ( rafs) ,
1415
1441
overlay : None ,
@@ -1500,6 +1526,9 @@ pub(crate) struct BlobCacheEntryConfig {
1500
1526
///
1501
1527
/// Possible value: `LocalFsConfig`, `RegistryConfig`, `OssConfig`, `LocalDiskConfig`.
1502
1528
backend_config : Value ,
1529
+ /// Configuration for external storage backends, order insensitivity.
1530
+ #[ serde( default ) ]
1531
+ external_backends : Vec < ExternalBackendConfig > ,
1503
1532
/// Type of blob cache, corresponding to `FactoryConfig::CacheConfig::cache_type`.
1504
1533
///
1505
1534
/// Possible value: "fscache", "filecache".
@@ -1535,6 +1564,7 @@ impl TryFrom<&BlobCacheEntryConfig> for BlobCacheEntryConfigV2 {
1535
1564
version : 2 ,
1536
1565
id : v. id . clone ( ) ,
1537
1566
backend : ( & backend_config) . try_into ( ) ?,
1567
+ external_backends : v. external_backends . clone ( ) ,
1538
1568
cache : ( & cache_config) . try_into ( ) ?,
1539
1569
metadata_path : v. metadata_path . clone ( ) ,
1540
1570
} )
0 commit comments