Skip to main content

ProjectMeta

Struct ProjectMeta 

Source
pub struct ProjectMeta {
    pub version: u32,
    pub uuid: Uuid,
    pub name: String,
    pub local_path: String,
    pub remote_path: String,
    pub size_bytes: u64,
    pub file_count: u32,
    pub last_sync: DateTime<Utc>,
    pub compression: bool,
    pub encryption_enabled: bool,
    pub public_key: Option<String>,
    pub state: ProjectState,
}
Expand description

Core metadata for a tracked project.

Serialized as .project.toml inside the project directory. This file persists locally regardless of whether the project content is present (Local state) or stored on the server (Archived state), providing stable identity and reconnection information.

Fields§

§version: u32

Schema version for forward compatibility.

§uuid: Uuid

Unique identifier for this project, generated at creation time. Survives renames and moves.

§name: String

Human-readable project name, derived from the directory name at the time of first archive.

§local_path: String

Absolute path to the project directory on the local machine.

§remote_path: String

Server-side storage reference in the format “host:port:/base/path/project-name”.

§size_bytes: u64

Total size in bytes at the time of the last successful sync.

§file_count: u32

Number of files in the project at the time of the last sync.

§last_sync: DateTime<Utc>

Timestamp of the last successful sync (upload or download).

§compression: bool

Whether compression was used during the last transfer.

§encryption_enabled: bool

Whether at-rest encryption was enabled for this project.

§public_key: Option<String>

The age public key used for encrypting this project’s archive, stored as a Bech32-encoded string. Only set if encryption is enabled.

§state: ProjectState

Current state of the project.

Implementations§

Source§

impl ProjectMeta

Source

pub fn new_local(name: String, local_path: String, remote_path: String) -> Self

Create metadata for a new project that is currently local.

Generates a fresh UUIDv4 and sets the last_sync timestamp to the current time. The project starts in the Local state with zero size and no compression or encryption.

Source

pub fn new_local_encrypted( name: String, local_path: String, remote_path: String, public_key: String, ) -> Self

Create metadata with encryption enabled.

Generates a fresh UUIDv4 and stores the age public key that will be used to encrypt the project archive before uploading to the server.

Source

pub fn mark_archived( &mut self, size_bytes: u64, file_count: u32, compression: bool, )

Mark the project as archived after a successful upload to the server.

Updates the state, records the transferred size and file count, and sets the last_sync timestamp to now.

Source

pub fn mark_local(&mut self, size_bytes: u64, file_count: u32)

Mark the project as local after a successful download from the server.

Updates the state, records the restored size, and sets the last_sync timestamp to now.

Source

pub fn is_archived(&self) -> bool

Returns true if the project is currently archived (stored on the server, local directory is a placeholder).

Source

pub fn is_local(&self) -> bool

Returns true if the project is currently local.

Source

pub fn days_since_sync(&self) -> f64

Return the number of days since the last sync.

Useful for identifying stale projects that might be candidates for automatic archival.

Source

pub fn size_human(&self) -> String

Format the project size in a human-readable way (e.g., “1.5 GB”).

Trait Implementations§

Source§

impl Clone for ProjectMeta

Source§

fn clone(&self) -> ProjectMeta

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProjectMeta

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ProjectMeta

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ProjectMeta

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V