darkwing/server/dtos/request/stop_dto.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
//! Data transfer objects for browser profile stop functionality.
//!
//! This module contains the structures needed to handle browser profile stop
//! requests and responses, including the transfer of profile data back to the
//! server.
use axum_typed_multipart::TryFromMultipart;
use serde::Serialize;
use tempfile::NamedTempFile;
/// Request structure for stopping a browser profile.
///
/// This structure is used to receive multipart form data when stopping a
/// browser profile, including the profile's data directory and any incremental
/// changes.
#[derive(TryFromMultipart)]
#[try_from_multipart(strict)]
pub struct StopRequest {
/// Unique identifier of the browser profile being stopped
pub browser_profile_id: u64,
/// Complete data directory of the browser profile.
/// Limited to 700MB to prevent excessive memory usage.
#[form_data(limit = "700MiB")]
pub datadir: Option<NamedTempFile>,
/// Incremental changes to the data directory since the last sync.
/// Limited to 700MB to prevent excessive memory usage.
#[form_data(limit = "700MiB")]
pub diff: Option<NamedTempFile>,
/// Current hash of the data directory contents.
/// Used to verify data integrity and track changes.
pub hash: String,
/// Previous hash of the data directory contents.
/// Used to verify the base state for incremental changes.
pub previous_hash: Option<String>,
}
/// Response structure for browser profile stop requests.
#[derive(Serialize)]
pub struct StopResponse {
/// Hash of the data directory archive after processing the stop request.
/// This hash can be used to verify successful data synchronization.
pub hash: String,
}