Skip to content

Commit 4dd98f7

Browse files
committed
update
1 parent 2c3bf6e commit 4dd98f7

12 files changed

+249
-102
lines changed

Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ edition = "2021"
88
default = ["server-api", "client-api"]
99
client-api = []
1010
server-api = []
11-
11+
metrics = ["opentelemetry-proto"]
1212
[dependencies]
1313
tonic-health = {version = "*", default-features = false, features = []}
1414
tonic-web = {version = "*", default-features = false, features = []}
1515
prost = {version = "*"}
1616
prost-types = {version = "*"}
1717

18+
opentelemetry-proto = { version = "0.27.0", optional = true, features = ["full"] }
19+
1820
[target.'cfg(target_arch = "wasm32")'.dependencies]
1921
tonic-web-wasm-client = { version = "*", features = []}
2022
tonic = { version = "0.12.1", default-features = false, features = [

proto/auth.proto

+7-6
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,16 @@ message AccountLoginFinishResponse { string jwt_token = 1; }
5050
// SetupTwoFactorAuthenticationResponse <- Server Client ->
5151
// SetupVerifyTwoFactorAuthenticationRequest -> Server Client <-
5252
// SetupVerifyTwoFactorAuthenticationResponse <- Server
53+
// First the user gets the secrete, the user stores the secrete, the user uses the secrete to compute the first totp code and send that in for verification.
5354
message SetupTwoFactorAuthenticationRequest {}
5455

55-
message SetupTwoFactorAuthenticationResponse { string qr_secret = 1; }
56+
message SetupTwoFactorAuthenticationResponse { string totp_secrete = 1; }
5657

57-
message SetupVerifyTwoFactorAuthenticationRequest { string qr_code = 1; }
58-
/// Will return a status error message if qr_code is invalid.
59-
message SetupVerifyTwoFactorAuthenticationResponse {}
60-
/// Invalidates the users JWT-token
61-
message AccountLogoutRequest { string jwt_token = 1; }
58+
message SetupTwoFactorAuthenticationVerifyRequest { string totp_code = 1; }
59+
/// Will return a status error message if totp_code is invalid.
60+
message SetupTwoFactorAuthenticationVerifyResponse {}
61+
/// Invalidates the users JWT-token.
62+
message AccountLogoutRequest { string token = 1; }
6263

6364
message AccountLogoutResponse {}
6465

proto/backend_api.proto

+9-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import "search.proto";
77
import "filesystem.proto";
88
import "sync.proto";
99
import "webhook.proto";
10+
import "share.proto";
1011
package backend_api;
1112

1213
// Error model that is used is: https://cloud.google.com/apis/design/errors
@@ -96,12 +97,17 @@ service BackendApi {
9697
// rpc InviteUserToBucket(InviteUserToBucketRequest) returns
9798
// (InviteUserToBucketResponse) {}; // Used by Share-File system to invite a
9899
// user.
99-
rpc CreateBucketShareLink(CreateBucketShareLinkRequest)
100-
returns (CreateBucketShareLinkResponse) {
100+
rpc CreateBucketShareToken(CreateBucketShareTokenRequest)
101+
returns (CreateBucketShareTokenResponse) {
101102
};
103+
rpc RegisterBucketSecreteShareLink(RegisterBucketSecreteShareLinkTokenRequest) returns (RegisterBucketSecreteShareLinkTokenResponse) {};
104+
rpc GetBucketShareLinksPaginatable(GetBucketShareLinksPaginatableRequest) returns (GetBucketShareLinksPaginatableResponse) {};
105+
rpc DeleteBucketShareLinks(DeleteBucketShareLinksRequest) returns (DeleteBucketShareLinksResponse) {};
106+
rpc DeleteUsersFromSharedBucket(DeleteUsersFromSharedBucketRequest) returns (DeleteUsersFromSharedBucketResponse) {};
107+
102108
rpc CreateWebhook(CreateWebhookRequest) returns (CreateWebhookResponse) {};
103109
// Used by user who have an account. Provide read/write access to bucket
104-
// for an etirity.
110+
// for an etirity.
105111
// rpc DeleteUserFromSharedBucket(DeleteUserFromSharedBucketRequest) returns
106112
// (DeleteUserFromSharedBucketResponse) {}; /// Used by Share-File system to
107113
// delete a user. rpc DeleteBucketShareLinks(DeleteBucketShareLinksRequest)

proto/bucket.proto

+12-13
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ message BucketRedundancy {
5050
}
5151

5252
message CreateBucketRequest {
53-
string name = 1;
53+
/// If no name is provided then the bucket generated UUID is used.
54+
optional string name = 1;
5455
// Public,PrivateShared, Private,
5556
optional string visibility = 2;
5657
// The encryption algorithm used for the bucket. Currently only supports
@@ -60,13 +61,10 @@ message CreateBucketRequest {
6061
/// bucket are required to enter the password. The field doesn't affect
6162
/// encryption, only access control.
6263
optional string password = 4;
63-
/// Redundancy settings TODO: Currently not supported.
64-
// optional BucketRedundancy redundancy = 5;
65-
// Optional description of the bucket.
64+
6665
optional string description = 8;
67-
// Storage class, Standard. Will later support Performant(That will use SSD or
68-
// NVME?), Extra-Performant(NVME) with super fast ethernet.
69-
string storage_class = 9;
66+
/// The underlying storage engine to use. Look into storage-engine in documentation for more information.
67+
string storage_engine_type = 9;
7068
// Tag the storage, like pictures, music, videos, etc.
7169
repeated string tags = 10;
7270
// When the bucket will expire.
@@ -79,8 +77,8 @@ message CreateBucketRequest {
7977
bool is_nsfw = 14;
8078
// If the bucket is searchable or not, Will end up costing more.
8179
bool is_searchable = 15;
82-
/// If the user is allowed to clone and distribute the same content. If this
83-
/// value is false for a bucket assume it's not okay to redustribute.
80+
/// If the user ris allowed to clone and distribute the same content. If this
81+
// /// value is false for a bucket assume it's not okay to redistribute.
8482
bool is_bucket_cloneable = 16;
8583
/// If the bucket is non-sharable it will use zero-knowledge encryption.
8684
bool is_sharable = 17;
@@ -109,9 +107,7 @@ message DeleteBucketResponse {
109107
/// This api endpoint will be updated in the future to support more options and
110108
/// is not priority yet because of being complicated.
111109
message UpdateBucketRequest {
112-
string bucket_id = 1;
113-
string bucket_user_id = 2;
114-
110+
BucketGuid bucket_guid = 1;
115111
optional string name = 3;
116112
// Public,PrivateShared, Private,
117113
optional string visibility = 4;
@@ -207,6 +203,9 @@ message CloneBucketRequest {
207203
optional string new_bucket_type = 4;
208204
optional string new_bucket_encryption = 5;
209205
optional string new_bucket_password = 6;
206+
207+
bool should_abandon_partial = 7; /// If
208+
bool should_overwrite = 8;
210209
}
211210

212211
message CloneBucketResponse {}
@@ -217,7 +216,7 @@ message DeleteFilesInBucketRequest {
217216
repeated string filepaths = 3;
218217
/// Will remove the capacity form the bucket of x amount of bytes.
219218
/// Default this should be true in most cases.
220-
/// Only false if the user intneds to keep the storage to be uploaded to later
219+
/// Only false if the user intends to keep the storage to be uploaded to later
221220
/// on...
222221
bool is_capacity_destructive = 7;
223222
}

proto/bucket_collection.proto

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
syntax = "proto3";
2+
package backend_api;
3+
4+
message BucketGuid {
5+
string user_id = 1;
6+
string bucket_id = 2;
7+
}
8+
9+
10+
message CreateBucketCollectionRequest {
11+
optional string name = 1;
12+
repeated BucketGuid bucket_guid = 2;
13+
}
14+
15+
message CreateBucketCollectionResponse {
16+
string collection_id = 1;
17+
}
18+
19+
message DeleteBucketCollectionRequest {
20+
string collection_id = 1;
21+
}
22+
23+
message DeleteBucketCollectionResponse {
24+
25+
}
26+
27+
message UpdateBucketCollectionRequest {
28+
string collection_id = 1;
29+
optional string name = 2;
30+
repeated string bucket_guid = 3;
31+
}
32+
33+
message UpdateBucketCollectionResponse {
34+
string name = 1;
35+
repeated string bucket_guid = 2;
36+
}

proto/bucket_permission.proto

-77
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,4 @@
11
syntax = "proto3";
22
package backend_api;
33
import "google/protobuf/timestamp.proto";
4-
// Creates a bucket share link. This link can be either SecretShareLink or a
5-
// normal ShareLink, depending on if is_secret_share_link.
6-
message CreateBucketShareLinkRequest {
7-
string user_id = 1;
8-
string bucket_id = 2;
9-
optional google.protobuf.Timestamp expires = 3;
10-
optional uint32 usages = 4;
11-
bool registered_users_only = 5;
12-
bool view_permission = 6;
13-
bool read_permission = 7;
14-
bool write_permission = 8;
15-
bool delete_file_permission = 9;
16-
bool delete_bucket_permission = 10;
17-
bool share_bucket_permission = 11;
18-
bool clone_permission = 12;
19-
bool search_permission = 13;
20-
bool is_secret_share_link = 14;
21-
}
224

23-
message CreateBucketShareLinkResponse { string url = 1; }
24-
25-
message GetBucketShareLinksRequest { string bucket_id = 1; }
26-
27-
message GetBucketShareLinksResponse {
28-
repeated string secret_share_link_urls = 1;
29-
repeated string share_link_urls = 2;
30-
}
31-
32-
message DeleteBucketShareLinksRequest { repeated string urls = 1; }
33-
34-
message DeleteBucketShareLinksResponse { repeated string urls = 1; }
35-
36-
message DeleteUserFromSharedBucketRequest {
37-
string bucket_id = 1;
38-
repeated string user_ids = 2;
39-
}
40-
41-
message DeleteUserFromSharedBucketResponse {}
42-
43-
message SharedUser {
44-
string user_id = 1;
45-
bool read_premission = 2;
46-
bool write_permission = 3;
47-
bool view_permission = 4;
48-
bool copy_permission = 5;
49-
string username = 6;
50-
string email = 7;
51-
}
52-
53-
message GetBucketSharedUsersRequest { string bucket_id = 1; }
54-
55-
message GetBucketSharedUsersResponse {
56-
string owner_id = 1;
57-
string owner_username = 2;
58-
repeated SharedUser shared_users = 3;
59-
}
60-
61-
message GetUserBucketPermissionsRequest {
62-
string bucket_id = 1;
63-
string user_id = 2;
64-
}
65-
66-
message GetUserBucketPermissionsResponse {
67-
optional bool read_permission = 1;
68-
optional bool write_permission = 2;
69-
optional bool view_permission = 3;
70-
optional bool copy_permission = 4;
71-
}
72-
73-
message InviteUserToBucketRequest {
74-
oneof user {
75-
string user_id = 1;
76-
string email = 2;
77-
string username = 3;
78-
}
79-
}
80-
81-
message InviteUserToBucketResponse {}

proto/image.proto

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
syntax = "proto3";
2+
package backend_api;
3+
import "google/protobuf/timestamp.proto";
4+
5+
message Scaling {
6+
optional int32 scale = 1;
7+
optional int32 width = 2;
8+
optional int32 height = 3;
9+
}
10+
11+
message ResizeImageRequest {
12+
string from_absolute_path = 1;
13+
optional string to_absolute_path = 2;
14+
optional Scaling scaling = 3;
15+
16+
}

proto/metrics.proto

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
syntax = "proto3";
2+
package backend_api;
3+
import "google/protobuf/timestamp.proto";
4+
5+
6+
/// Every storage engine will have a different performance.
7+
/// You can query the storage engines that are used by the specific name
8+
message GetStorageEngineMetrics {
9+
/// The storage engine to be used.
10+
string engine_name = 1;
11+
}
12+
13+
message GetStorageEngineMetricsResponse {
14+
string storage_engine_type = 1;
15+
Metric latency = 2;
16+
Metric throughput = 3;
17+
Metric cost = 4;
18+
19+
}
20+
21+
22+
23+
message Metric {
24+
string name = 1;
25+
repeated MetricValue series = 2;
26+
}
27+
28+
message MetricValue {
29+
google.protobuf.Timestamp timestamp = 1;
30+
string value = 2;
31+
}

proto/model.proto

+12
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,20 @@ Transcoder and compressor are optimized prebuilt components for a a specific
88
task. Lambda is a function
99
1010
*/
11+
12+
message ArchiveCompressRequest {
13+
repeated string source_filepath = 1;
14+
optional string target_filepath = 2;
15+
bool is_destructive = 3; /// IF the archive compression will delete all of the source_filepath
16+
17+
}
18+
19+
message ArchiveComp
20+
21+
1122
message ModelWorkflow {}
1223

24+
1325
message Compressor {
1426
string source_filepath = 1;
1527
optional string source_format = 2;

proto/notification.proto

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
message GetNotificationsPaginatableRequest {
2+
3+
}
4+
5+
message DeleteNotificationsRequest {
6+
7+
}

0 commit comments

Comments
 (0)