Skip to content

Commit

Permalink
Merge pull request #104 from ArunaStorage/feat/replication
Browse files Browse the repository at this point in the history
Feat/replication
  • Loading branch information
lfbrehm authored Jan 18, 2024
2 parents 9c28d4b + 993bf16 commit 6dd7019
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 41 deletions.
94 changes: 72 additions & 22 deletions aruna/api/dataproxy/services/v2/dataproxy_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ import "google/api/visibility.proto";
// Status: ALPHA
//
// Service for data replication between data-proxies
service DataproxyService {
service DataproxyReplicationService {
option (google.api.api_visibility).restriction = "PROXY";

// RequestReplication
//
// Status: ALPHA
//
// Creates a replication request
rpc RequestReplication(RequestReplicationRequest) returns (RequestReplicationResponse) {}
// Creates a replication stream
rpc PullReplication(stream PullReplicationRequest) returns (stream PullReplicationResponse) {}

// InitReplication
//
// Status: ALPHA
//
// Provides the necessary url to init replication
rpc InitReplication(InitReplicationRequest) returns (InitReplicationResponse) {}
rpc PushReplication(PushReplicationRequest) returns (PushReplicationResponse) {}
}


Expand Down Expand Up @@ -96,19 +96,76 @@ service DataproxyUserService {
}


// ----- PullReplication -----
// PROXY A (data) <--> PROXY B (wants data)
// PROXY B pulls data from PROXY A

// Messages (requests) from PROXY B
message InitMessage {
string dataproxy_id = 1;
repeated string object_ids = 2;
}

message InfoAckMessage {
string object_id = 1;
}

message DataProxyInfo {
string dataproxy_id = 1;
int64 available_space = 2;
message ChunkAckMessage {
string object_id = 1;
int64 chunk_idx = 2;
}

message RequestReplicationRequest {
DataProxyInfo info = 1;
bool user_initialized = 2;
message RetryChunkMessage {
string object_id = 1;
int64 chunk_idx = 2;
}

message Empty {}

message ErrorMessage {
oneof error {
RetryChunkMessage retry_chunk = 1;
Empty abort = 2;
string retry_object_id = 3;
}
}

message PullReplicationRequest {
oneof message {
InitMessage init_message = 1;
InfoAckMessage info_ack_message = 2;
ChunkAckMessage chunk_ack_message = 3;
ErrorMessage error_message = 4;
Empty finish_message = 5;
}
}

// Messages (responses) from PROXY A
message ObjectInfo {
string object_id = 1;
int64 chunks = 2;
int64 raw_size = 3;
repeated uint32 block_list = 4;
optional string extra = 5; // JSON encoded proxy specific extra fields
}

message Chunk {
string object_id = 1;
int64 chunk_idx = 2;
bytes data = 3;
string checksum = 4;
}

message PullReplicationResponse {
oneof message {
ObjectInfo object_info = 1;
Chunk chunk = 2; // If no ack is received, the chunk will be resent
Empty finish_message = 3;
}
}

// ---------------

message DataInfo {
string object_id = 1;
string download_url = 2;
Expand All @@ -120,18 +177,11 @@ message DataInfos {
repeated DataInfo data_info = 1;
}

message RequestReplicationResponse {
oneof response {
DataInfos data_infos = 1;
bool ack = 2;
}
}

message InitReplicationRequest {
message PushReplicationRequest {
DataInfos data_infos = 1;
}

message InitReplicationResponse {
message PushReplicationResponse {
bool ack = 1;
}

Expand All @@ -152,7 +202,7 @@ message PushReplicaRequest {
string resource_id = 1;
S3Path s3_path = 2;
}
string target_location = 3;
string target_endpoint_id = 3;
}

message PushReplicaResponse {
Expand All @@ -167,11 +217,11 @@ message PullReplicaRequest {
}

message PullReplicaResponse {
string replication_id = 1;
string replication_id = 1; // why ?
}

message ReplicationStatusRequest {
string replication_id = 1;
string replication_id = 1; // why ?
}

enum ReplicationStatus {
Expand Down
2 changes: 1 addition & 1 deletion aruna/api/google
Submodule google updated 47 files
+17 −4 BUILD.bazel
+2 −2 WORKSPACE
+334 −13 api-index-v1.json
+1 −0 google/analytics/data/v1alpha/BUILD.bazel
+208 −1 google/analytics/data/v1alpha/analytics_data_api.proto
+13 −0 google/api/client.proto
+1 −1 google/cloud/aiplatform/BUILD.bazel
+11 −0 google/cloud/aiplatform/v1beta1/model.proto
+134 −0 google/cloud/aiplatform/v1beta1/prediction_service.proto
+0 −9 google/cloud/asset/v1p1beta1/cloudasset_v1p1beta1.yaml
+0 −7 google/cloud/asset/v1p5beta1/cloudasset_v1p5beta1.yaml
+0 −7 google/cloud/asset/v1p7beta1/cloudasset_v1p7beta1.yaml
+23 −0 google/cloud/binaryauthorization/v1beta1/continuous_validation_logging.proto
+2 −0 google/cloud/compute/v1/BUILD.bazel
+33 −0 google/cloud/dataplex/v1/data_quality.proto
+1 −2 google/cloud/deploy/v1/BUILD.bazel
+458 −27 google/cloud/deploy/v1/cloud_deploy.proto
+20 −0 google/cloud/deploy/v1/clouddeploy_grpc_service_config.json
+3 −1 google/cloud/dialogflow/cx/v3/BUILD.bazel
+8 −3 google/cloud/dialogflow/cx/v3/audio_config.proto
+7 −0 google/cloud/dialogflow/cx/v3/dialogflow_grpc_service_config.json
+6 −0 google/cloud/dialogflow/cx/v3/dialogflow_v3.yaml
+240 −0 google/cloud/dialogflow/cx/v3/generator.proto
+3 −1 google/cloud/dialogflow/cx/v3beta1/BUILD.bazel
+8 −3 google/cloud/dialogflow/cx/v3beta1/audio_config.proto
+7 −0 google/cloud/dialogflow/cx/v3beta1/dialogflow_grpc_service_config.json
+6 −0 google/cloud/dialogflow/cx/v3beta1/dialogflow_v3beta1.yaml
+241 −0 google/cloud/dialogflow/cx/v3beta1/generator.proto
+4 −0 google/cloud/discoveryengine/v1alpha/discoveryengine_v1alpha.yaml
+11 −12 google/cloud/edgenetwork/v1/BUILD.bazel
+1 −1 google/cloud/edgenetwork/v1/resources.proto
+1 −1 google/cloud/edgenetwork/v1/service.proto
+40 −0 google/cloud/sql/v1/cloud_sql_instances.proto
+21 −0 google/cloud/sql/v1beta4/cloud_sql.proto
+20 −0 google/cloud/sql/v1beta4/cloud_sql_resources.proto
+8 −3 google/container/v1beta1/cluster_service.proto
+2 −1 google/firestore/admin/v1/BUILD.bazel
+58 −7 google/firestore/admin/v1/database.proto
+27 −0 google/firestore/admin/v1/firestore_admin.proto
+4 −5 google/firestore/admin/v1/location.proto
+30 −12 google/firestore/admin/v1/operation.proto
+9 −3 google/pubsub/v1/pubsub.proto
+240 −0 google/spanner/executor/v1/BUILD.bazel
+16 −0 google/spanner/executor/v1/README.md
+1,471 −0 google/spanner/executor/v1/cloud_executor.proto
+24 −0 google/spanner/executor/v1/spanner_cloud_executor.yaml
+3 −0 google/spanner/executor/v1/spanner_cloud_executor_grpc_service_config.json
1 change: 1 addition & 0 deletions aruna/api/hooks/services/v2/hooks_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ service HooksService {
rpc HookCallback(HookCallbackRequest) returns (HookCallbackResponse) {
option (google.api.http) = {
patch : "/v2/hooks/callback"
body: "*"
};
}
}
Expand Down
25 changes: 24 additions & 1 deletion aruna/api/storage/models/v2/models.proto
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ enum ResourceVariant {
RESOURCE_VARIANT_OBJECT = 4;
}

enum ReplicationStatus {
REPLICATION_STATUS_UNSPECIFIED = 0;
REPLICATION_STATUS_WAITING = 1;
REPLICATION_STATUS_RUNNING = 2;
REPLICATION_STATUS_FINISHED = 3;
REPLICATION_STATUS_ERROR = 4;
}
// ------------- USERS & PERMISSIONS -----------------------
message User {
reserved 2;
Expand Down Expand Up @@ -251,7 +258,23 @@ message DataEndpoint {
string id = 1;
// Hint if the objects' project
// is fully synced to the endpoint
bool full_synced = 2;
oneof variant {
FullSync full_sync = 2;
PartialSync partial_sync = 3;
}
optional ReplicationStatus status = 4;
}

message FullSync {
string project_id = 1;
}
message PartialSync {
oneof origin {
string project_id = 1;
string collection_id = 2;
string dataset_id = 3;
string object_id = 4;
}
}

message Copy {
Expand Down
43 changes: 26 additions & 17 deletions aruna/api/storage/services/v2/data_replication_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.servic
option java_outer_classname = "DataReplicationService";

import "google/api/annotations.proto";
import "aruna/api/storage/models/v2/models.proto";

// DataReplicationService
//
// Endpoint specific methods for syncing data
service DataReplicationService {

Expand All @@ -34,7 +34,7 @@ service DataReplicationService {
rpc PartialReplicateData(PartialReplicateDataRequest)
returns (PartialReplicateDataResponse) {
option (google.api.http) = {
post : "/v2/endpoints/{endpoint_id}/replication/{resource_id}/partial"
post : "/v2/endpoints/{endpoint_id}/replication/partial"
body: "*"
};
}
Expand All @@ -47,7 +47,7 @@ service DataReplicationService {
rpc UpdateReplicationStatus(UpdateReplicationStatusRequest)
returns (UpdateReplicationStatusResponse) {
option (google.api.http) = {
patch : "/v2/endpoints/{endpoint_id}/replication/{resource_id}/status"
patch : "/v2/endpoints/{endpoint_id}/replication/{object_id}/status"
body: "*"
};
}
Expand Down Expand Up @@ -77,36 +77,35 @@ service DataReplicationService {
}
}

enum ReplicationStatus {
REPLICATION_STATUS_UNSPECIFIED = 0;
REPLICATION_STATUS_WAITING = 1;
REPLICATION_STATUS_RUNNING = 2;
REPLICATION_STATUS_FINISHED = 3;
REPLICATION_STATUS_ERROR = 4;
}


message ReplicateProjectDataRequest {
string project_id = 1;
string endpoint_id = 2;
}

message ReplicateProjectDataResponse {
ReplicationStatus status = 1;
storage.models.v2.ReplicationStatus status = 1;
}

message PartialReplicateDataRequest {
string resource_id = 1;
string endpoint_id = 2;
oneof data_variant {
string collection_id = 1;
string dataset_id = 2;
string object_id = 3;
}
string endpoint_id = 4;
}


message PartialReplicateDataResponse {
ReplicationStatus status = 1;
storage.models.v2.ReplicationStatus status = 1;
}

message UpdateReplicationStatusRequest {
string resource_id = 1;
string object_id = 1;
string endpoint_id = 2;
ReplicationStatus status = 3;
storage.models.v2.ReplicationStatus status = 3;
}

message UpdateReplicationStatusResponse {}
Expand All @@ -117,7 +116,17 @@ message GetReplicationStatusRequest {
}

message GetReplicationStatusResponse {
ReplicationStatus status = 1;
repeated ReplicationInfo infos = 1;
}

message ReplicationInfo {
oneof resource {
string project_id = 1;
string collection_id = 2;
string dataset_id = 3;
string object_id = 4;
}
storage.models.v2.DataEndpoint endpoint_info = 5;
}

message DeleteReplicationRequest {
Expand Down

0 comments on commit 6dd7019

Please sign in to comment.