116 lines
2.6 KiB
Protocol Buffer
116 lines
2.6 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package proto;
|
|
|
|
option csharp_namespace = "DysonNetwork.Shared.Proto";
|
|
|
|
import "google/protobuf/timestamp.proto";
|
|
import "google/protobuf/empty.proto";
|
|
import "google/protobuf/field_mask.proto";
|
|
import "google/protobuf/duration.proto";
|
|
|
|
// CloudFile represents a reference to a file stored in cloud storage.
|
|
// It contains metadata about the file that won't change, helping to reduce database load.
|
|
message CloudFile {
|
|
// Unique identifier for the file
|
|
string id = 1;
|
|
|
|
// Original name of the file
|
|
string name = 2;
|
|
|
|
// The metadata uses JSON bytes to store to keep the data structure over gRPC
|
|
// File metadata (e.g., dimensions, duration, etc.)
|
|
bytes file_meta = 3;
|
|
// User-defined metadata
|
|
bytes user_meta = 4;
|
|
optional bytes sensitive_marks = 12;
|
|
|
|
// MIME type of the file
|
|
string mime_type = 5;
|
|
|
|
// File content hash (e.g., MD5, SHA-256)
|
|
string hash = 6;
|
|
|
|
// File size in bytes
|
|
int64 size = 7;
|
|
|
|
// Indicates if the file is stored with compression
|
|
bool has_compression = 8;
|
|
|
|
// URL to access the file
|
|
string url = 9;
|
|
|
|
// Content type of the file
|
|
string content_type = 10;
|
|
|
|
// When the file was uploaded
|
|
google.protobuf.Timestamp uploaded_at = 11;
|
|
|
|
// Image/Video width (optional, for media files)
|
|
optional int32 width = 13;
|
|
|
|
// Image/Video height (optional, for media files)
|
|
optional int32 height = 14;
|
|
|
|
// Blurhash for placeholder (optional, for images)
|
|
optional string blurhash = 15;
|
|
}
|
|
|
|
// Service for file operations
|
|
service FileService {
|
|
// Get file reference by ID
|
|
rpc GetFile(GetFileRequest) returns (CloudFile);
|
|
rpc GetFileBatch(GetFileBatchRequest) returns (GetFileBatchResponse);
|
|
|
|
// Update an existing file reference
|
|
rpc UpdateFile(UpdateFileRequest) returns (CloudFile);
|
|
|
|
// Delete a file reference
|
|
rpc DeleteFile(DeleteFileRequest) returns (google.protobuf.Empty);
|
|
|
|
// Purge cache for a file
|
|
rpc PurgeCache(PurgeCacheRequest) returns (google.protobuf.Empty);
|
|
}
|
|
|
|
// Request message for GetFile
|
|
message GetFileRequest {
|
|
string id = 1;
|
|
}
|
|
|
|
message GetFileBatchRequest {
|
|
repeated string ids = 1;
|
|
}
|
|
|
|
message GetFileBatchResponse {
|
|
repeated CloudFile files = 1;
|
|
}
|
|
|
|
// Request message for UpdateFile
|
|
message UpdateFileRequest {
|
|
CloudFile file = 1;
|
|
google.protobuf.FieldMask update_mask = 2;
|
|
}
|
|
|
|
message FileMetadata {
|
|
string file_id = 1;
|
|
string file_name = 2;
|
|
string content_type = 3;
|
|
string account_id = 4;
|
|
}
|
|
|
|
message UploadMetadata {
|
|
string file_id = 1;
|
|
string target_remote = 2;
|
|
string suffix = 3;
|
|
string content_type = 4;
|
|
}
|
|
|
|
message DeleteFileRequest {
|
|
string id = 1;
|
|
bool purge = 2;
|
|
}
|
|
|
|
message PurgeCacheRequest {
|
|
string file_id = 1;
|
|
}
|