pub struct OkuFs { /* private fields */ }
Expand description
An instance of an Oku file system.
The OkuFs
struct is the primary interface for interacting with an Oku file system.
Implementations§
source§impl OkuFs
impl OkuFs
sourcepub async fn start() -> Result<OkuFs, Box<dyn Error + Send + Sync>>
pub async fn start() -> Result<OkuFs, Box<dyn Error + Send + Sync>>
Starts an instance of an Oku file system. In the background, an Iroh node is started, and the node’s address is periodically announced to the mainline DHT. If no author credentials are found on disk, new credentials are generated.
§Returns
A running instance of an Oku file system.
sourcepub async fn create_discovery_service(
&self
) -> Result<ConcurrentDiscovery, Box<dyn Error + Send + Sync>>
pub async fn create_discovery_service( &self ) -> Result<ConcurrentDiscovery, Box<dyn Error + Send + Sync>>
Create a mechanism for discovering other nodes on the network given their IDs.
§Returns
A discovery service for finding other node’s addresses given their IDs.
sourcepub async fn create_replica(
&self
) -> Result<NamespaceId, Box<dyn Error + Send + Sync>>
pub async fn create_replica( &self ) -> Result<NamespaceId, Box<dyn Error + Send + Sync>>
sourcepub async fn delete_replica(
&self,
namespace_id: NamespaceId
) -> Result<(), Box<dyn Error + Send + Sync>>
pub async fn delete_replica( &self, namespace_id: NamespaceId ) -> Result<(), Box<dyn Error + Send + Sync>>
sourcepub async fn list_replicas(
&self
) -> Result<Vec<NamespaceId>, Box<dyn Error + Send + Sync>>
pub async fn list_replicas( &self ) -> Result<Vec<NamespaceId>, Box<dyn Error + Send + Sync>>
sourcepub async fn list_files(
&self,
namespace_id: NamespaceId
) -> Result<Vec<Entry>, Box<dyn Error + Send + Sync>>
pub async fn list_files( &self, namespace_id: NamespaceId ) -> Result<Vec<Entry>, Box<dyn Error + Send + Sync>>
sourcepub async fn create_or_modify_file(
&self,
namespace_id: NamespaceId,
path: PathBuf,
data: impl Into<Bytes>
) -> Result<Hash, Box<dyn Error + Send + Sync>>
pub async fn create_or_modify_file( &self, namespace_id: NamespaceId, path: PathBuf, data: impl Into<Bytes> ) -> Result<Hash, Box<dyn Error + Send + Sync>>
sourcepub async fn delete_file(
&self,
namespace_id: NamespaceId,
path: PathBuf
) -> Result<usize, Box<dyn Error + Send + Sync>>
pub async fn delete_file( &self, namespace_id: NamespaceId, path: PathBuf ) -> Result<usize, Box<dyn Error + Send + Sync>>
sourcepub async fn read_file(
&self,
namespace_id: NamespaceId,
path: PathBuf
) -> Result<Bytes, Box<dyn Error + Send + Sync>>
pub async fn read_file( &self, namespace_id: NamespaceId, path: PathBuf ) -> Result<Bytes, Box<dyn Error + Send + Sync>>
sourcepub async fn move_file(
&self,
namespace_id: NamespaceId,
from: PathBuf,
to: PathBuf
) -> Result<(Hash, usize), Box<dyn Error + Send + Sync>>
pub async fn move_file( &self, namespace_id: NamespaceId, from: PathBuf, to: PathBuf ) -> Result<(Hash, usize), Box<dyn Error + Send + Sync>>
Moves a file by copying it to a new location and deleting the original.
§Arguments
-
namespace_id
- The ID of the replica containing the file to move. -
from
- The path of the file to move. -
to
- The path to move the file to.
§Returns
A tuple containing the hash of the file at the new destination and the number of replica entries deleted during the operation, which should be 1 if the file at the original path was deleted.
sourcepub async fn delete_directory(
&self,
namespace_id: NamespaceId,
path: PathBuf
) -> Result<usize, Box<dyn Error + Send + Sync>>
pub async fn delete_directory( &self, namespace_id: NamespaceId, path: PathBuf ) -> Result<usize, Box<dyn Error + Send + Sync>>
sourcepub async fn respond_to_content_request(
&self,
request: PeerContentRequest
) -> Result<PeerContentResponse, Box<dyn Error + Send + Sync>>
pub async fn respond_to_content_request( &self, request: PeerContentRequest ) -> Result<PeerContentResponse, Box<dyn Error + Send + Sync>>
sourcepub async fn listen_for_document_ticket_fetch_requests(
&self
) -> Result<(), Box<dyn Error + Send + Sync>>
pub async fn listen_for_document_ticket_fetch_requests( &self ) -> Result<(), Box<dyn Error + Send + Sync>>
Handles incoming requests for document tickets. This function listens for incoming connections from peers and responds to requests for document tickets.
sourcepub async fn get_external_replica(
&self,
namespace_id: NamespaceId,
path: Option<PathBuf>,
partial: bool,
verified: bool
) -> Result<(), Box<dyn Error + Send + Sync>>
pub async fn get_external_replica( &self, namespace_id: NamespaceId, path: Option<PathBuf>, partial: bool, verified: bool ) -> Result<(), Box<dyn Error + Send + Sync>>
Joins a swarm to fetch the latest version of a replica and save it to the local machine.
§Arguments
-
namespace_id
- The ID of the replica to fetch. -
path
- An optional path of requested files within the replica. -
partial
- Whether to discover peers who claim to only have a partial copy of the replica. -
verified
- Whether to discover peers who have been verified to have the replica.
sourcepub async fn connect_to_relay(
&self,
relay_address: String
) -> Result<(), Box<dyn Error + Send + Sync>>
pub async fn connect_to_relay( &self, relay_address: String ) -> Result<(), Box<dyn Error + Send + Sync>>
Connects to a relay to facilitate communication behind NAT. Upon connecting, the file system will send a list of all replicas to the relay. Periodically, the relay will request the list of replicas again using the same connection.
§Arguments
relay_address
- The address of the relay to connect to.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OkuFs
impl !RefUnwindSafe for OkuFs
impl Send for OkuFs
impl Sync for OkuFs
impl Unpin for OkuFs
impl !UnwindSafe for OkuFs
Blanket Implementations§
source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read moresource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read more