oku_fs/fs/net/
core.rs

1use crate::fs::util::{path_to_entry_key, path_to_entry_prefix};
2use iroh_docs::store::FilterKind;
3use iroh_docs::Author;
4use iroh_docs::DocTicket;
5use iroh_docs::NamespaceId;
6use serde::{Deserialize, Serialize};
7
8#[derive(Serialize, Deserialize, Debug, Clone)]
9/// An Oku user's credentials, which are sensitive, exported from a node, able to be imported into another.
10pub struct ExportedUser {
11    pub(crate) author: Author,
12    pub(crate) home_replica: Option<NamespaceId>,
13    pub(crate) home_replica_ticket: Option<DocTicket>,
14}
15
16#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
17/// The modality of the data used to create an embedding vector.
18pub enum EmbeddingModality {
19    /// Text
20    Text,
21    /// Image
22    Image,
23    /// Audio
24    Audio,
25}
26
27/// Filters to prevent downloading the entirety of a home replica.
28/// Only the `/profile.toml` file and the `/posts/` directory are downloaded.
29///
30/// # Returns
31///
32/// The download filters specifying the only content allowed to be downloaded from a home replica.
33pub fn home_replica_filters() -> Vec<FilterKind> {
34    let profile_filter = FilterKind::Exact(path_to_entry_key(&"/profile.toml".into()));
35    let posts_filter = FilterKind::Prefix(path_to_entry_prefix(&"/posts/".into()));
36    vec![profile_filter, posts_filter]
37}