pub struct Ipfs { /* private fields */ }
Expand description
IPFS file system support based on IPFS HTTP Gateway.
Capabilities
This service can be used to:
- read
-
write - list
-
scan - presign
- blocking
Configuration
root
: Set the work directory for backendendpoint
: Customizable endpoint setting
You can refer to IpfsBuilder
’s docs for more information
Example
Via Builder
use anyhow::Result;
use opendal::services::Ipfs;
use opendal::Object;
use opendal::Operator;
#[tokio::main]
async fn main() -> Result<()> {
// create backend builder
let mut builder = Ipfs::default();
// set the endpoint for OpenDAL
builder.endpoint("https://ipfs.io");
// set the root for OpenDAL
builder.root("/ipfs/QmPpCt1aYGb9JWJRmXRUnmJtVgeFFTJGzWFYEEX7bo9zGJ");
let op: Operator = Operator::new(builder)?.finish();
// Create an object handle to start operation on object.
let _: Object = op.object("test_file");
Ok(())
}
Implementations§
source§impl IpfsBuilder
impl IpfsBuilder
sourcepub fn root(&mut self, root: &str) -> &mut Self
pub fn root(&mut self, root: &str) -> &mut Self
Set root of ipfs backend.
Root must be a valid ipfs address like the following:
/ipfs/QmPpCt1aYGb9JWJRmXRUnmJtVgeFFTJGzWFYEEX7bo9zGJ/
(IPFS with CID v0)/ipfs/bafybeibozpulxtpv5nhfa2ue3dcjx23ndh3gwr5vwllk7ptoyfwnfjjr4q/
(IPFS with CID v1)/ipns/opendal.databend.rs/
(IPNS)
sourcepub fn endpoint(&mut self, endpoint: &str) -> &mut Self
pub fn endpoint(&mut self, endpoint: &str) -> &mut Self
Set endpoint if ipfs backend.
Endpoint must be a valid ipfs gateway which passed the IPFS Gateway Checker
Popular choices including:
https://ipfs.io
https://w3s.link
https://dweb.link
https://cloudflare-ipfs.com
http://127.0.0.1:8080
(ipfs daemon in local)
sourcepub fn http_client(&mut self, client: HttpClient) -> &mut Self
pub fn http_client(&mut self, client: HttpClient) -> &mut Self
Specify the http client that used by this service.
Notes
This API is part of OpenDAL’s Raw API. HttpClient
could be changed
during minor updates.
Trait Implementations§
source§impl Builder for IpfsBuilder
impl Builder for IpfsBuilder
source§impl Clone for IpfsBuilder
impl Clone for IpfsBuilder
source§fn clone(&self) -> IpfsBuilder
fn clone(&self) -> IpfsBuilder
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for IpfsBuilder
impl Debug for IpfsBuilder
source§impl Default for IpfsBuilder
impl Default for IpfsBuilder
source§fn default() -> IpfsBuilder
fn default() -> IpfsBuilder
Returns the “default value” for a type. Read more