Skip to main content

mesa_dev/models/
lfs.rs

1//! LFS (Large File Storage) models.
2
3use serde::{Deserialize, Serialize};
4
5/// Request to upload LFS objects.
6#[derive(Debug, Clone, Serialize)]
7pub struct UploadLfsObjectsRequest {
8    /// Objects to upload.
9    pub objects: Vec<LfsObjectSpec>,
10}
11
12/// Specification for an LFS object.
13#[derive(Debug, Clone, Serialize)]
14pub struct LfsObjectSpec {
15    /// SHA-256 hash of the file content.
16    pub oid: String,
17    /// Size of the file in bytes.
18    pub size: u64,
19}
20
21/// Response from LFS upload request.
22#[derive(Debug, Clone, Deserialize)]
23pub struct UploadLfsObjectsResponse {
24    /// Status of each requested object.
25    pub objects: Vec<LfsObjectStatus>,
26}
27
28/// Status of a single LFS object upload request.
29#[derive(Debug, Clone, Deserialize)]
30pub struct LfsObjectStatus {
31    /// SHA-256 hash.
32    pub oid: String,
33    /// File size.
34    pub size: u64,
35    /// Pre-signed upload URL (None if object already exists).
36    pub upload_url: Option<String>,
37    /// Seconds until URL expires.
38    pub expires_in: Option<u32>,
39    /// Whether the object already exists in storage.
40    pub exists: bool,
41    /// Error details if the request failed for this object.
42    pub error: Option<LfsObjectError>,
43}
44
45/// Error details for a single LFS object.
46#[derive(Debug, Clone, Deserialize)]
47pub struct LfsObjectError {
48    /// Error code.
49    pub code: String,
50    /// Error message.
51    pub message: String,
52}
53
54/// An LFS file reference for creating commits.
55#[derive(Debug, Clone, Serialize)]
56pub struct LfsFileRef {
57    /// SHA-256 hash of the content.
58    pub oid: String,
59    /// Size in bytes.
60    pub size: u64,
61}
62
63/// A file change that references LFS content.
64#[derive(Debug, Clone, Serialize)]
65pub struct CommitLfsFile {
66    /// File path in the repository.
67    pub path: String,
68    /// LFS reference.
69    pub lfs: LfsFileRef,
70}