@@ -39,6 +39,7 @@ pub enum StorageParams {
3939 #[ cfg( feature = "storage-hdfs" ) ]
4040 Hdfs ( StorageHdfsConfig ) ,
4141 Http ( StorageHttpConfig ) ,
42+ Ipfs ( StorageIpfsConfig ) ,
4243 Memory ,
4344 Obs ( StorageObsConfig ) ,
4445 S3 ( StorageS3Config ) ,
@@ -72,6 +73,9 @@ impl Display for StorageParams {
7273 StorageParams :: Http ( v) => {
7374 write ! ( f, "http://endpoint={},paths={:?}" , v. endpoint_url, v. paths)
7475 }
76+ StorageParams :: Ipfs ( c) => {
77+ write ! ( f, "ipfs://endpoint={},root={}" , c. endpoint_url, c. root)
78+ }
7579 StorageParams :: Memory => write ! ( f, "memory://" ) ,
7680 StorageParams :: Obs ( v) => write ! (
7781 f,
@@ -100,6 +104,7 @@ impl StorageParams {
100104 #[ cfg( feature = "storage-hdfs" ) ]
101105 StorageParams :: Hdfs ( _) => false ,
102106 StorageParams :: Http ( v) => v. endpoint_url . starts_with ( "https://" ) ,
107+ StorageParams :: Ipfs ( c) => c. endpoint_url . starts_with ( "https://" ) ,
103108 StorageParams :: Memory => false ,
104109 StorageParams :: Obs ( v) => v. endpoint_url . starts_with ( "https://" ) ,
105110 StorageParams :: S3 ( v) => v. endpoint_url . starts_with ( "https://" ) ,
@@ -263,6 +268,14 @@ pub struct StorageHttpConfig {
263268 pub paths : Vec < String > ,
264269}
265270
271+ pub const STORAGE_IPFS_DEFAULT_ENDPOINT : & str = "https://ipfs.io" ;
272+ /// Config for IPFS storage backend
273+ #[ derive( Clone , Debug , Default , PartialEq , Eq , Serialize , Deserialize ) ]
274+ pub struct StorageIpfsConfig {
275+ pub endpoint_url : String ,
276+ pub root : String ,
277+ }
278+
266279/// Config for storage backend obs.
267280#[ derive( Clone , Default , PartialEq , Eq , Serialize , Deserialize ) ]
268281pub struct StorageObsConfig {
0 commit comments