Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storage API changes with name and field_behavior #317

Merged
merged 13 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion storage/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ all:
mv google "${PWD}"/v1alpha1/
docker run --user=$$(id -u):$$(id -g) --rm --entrypoint=sh -v "${PWD}/../common/v1":/common -v "${PWD}"/v1alpha1/:/out -w /out -v "${PWD}"/v1alpha1:/protos pseudomuto/protoc-gen-doc -c "protoc -I /common -I /protos --doc_out=/out --doc_opt=markdown,autogen.md /protos/*.proto /common/*.proto"
docker run --user=$$(id -u):$$(id -g) --rm --entrypoint=sh -v "${PWD}/../common/v1":/common -v "${PWD}"/v1alpha1/:/out -w /out ghcr.io/docker-multiarch/google-api-linter:1.36.0 -c "api-linter -I /common /out/*.proto --output-format summary"
docker run --user=$$(id -u):$$(id -g) --rm --entrypoint=sh -v "${PWD}/../common/v1":/common -v "${PWD}"/v1alpha1/:/out -w /out ghcr.io/docker-multiarch/google-api-linter:1.36.0 -c "api-linter -I /common /out/*.proto --output-format github --disable-rule=core::0192::has-comments --disable-rule=core::0127 --disable-rule=core::0156 --set-exit-status"
docker run --user=$$(id -u):$$(id -g) --rm --entrypoint=sh -v "${PWD}/../common/v1":/common -v "${PWD}"/v1alpha1/:/out -w /out ghcr.io/docker-multiarch/google-api-linter:1.36.0 -c "api-linter -I /common /out/*.proto --output-format github --disable-rule=core::0192::has-comments --set-exit-status"
rm -rf "${PWD}"/v1alpha1/google
512 changes: 251 additions & 261 deletions storage/v1alpha1/autogen.md

Large diffs are not rendered by default.

34 changes: 22 additions & 12 deletions storage/v1alpha1/backend_aio.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import "google/api/annotations.proto";
import "google/api/field_behavior.proto";
import "google/protobuf/field_mask.proto";

import "object_key.proto";
import "opicommon.proto";
import "uuid.proto";

Expand All @@ -32,7 +31,7 @@ service AioVolumeService {
}
rpc DeleteAioVolume (DeleteAioVolumeRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/{name=subsystems}/{subsystem}"
delete: "/v1/{name=AioVolumes/*}"
};
option (google.api.method_signature) = "name";
}
Expand All @@ -51,11 +50,16 @@ service AioVolumeService {
}
rpc GetAioVolume (GetAioVolumeRequest) returns (AioVolume) {
option (google.api.http) = {
get: "/v1/{name=subsystems}/{subsystem}"
get: "/v1/{name=AioVolumes/*}"
};
option (google.api.method_signature) = "name";
}
rpc StatsAioVolume (StatsAioVolumeRequest) returns (StatsAioVolumeResponse) {
option (google.api.http) = {
get: "/v1/{name=AioVolumes/*}:stats"
};
option (google.api.method_signature) = "name";
}
rpc AioVolumeStats (AioVolumeStatsRequest) returns (AioVolumeStatsResponse) {}
}

message AioVolume {
Expand All @@ -67,7 +71,11 @@ message AioVolume {
// name is an opaque object handle that is not user settable.
// name will be returned with created object
// user can only set {resource}_id on the Create request object
string name = 1;
string name = 1 [
(google.api.field_behavior) = OUTPUT_ONLY,
glimchb marked this conversation as resolved.
Show resolved Hide resolved
(google.api.field_behavior) = IMMUTABLE,
(google.api.resource_reference).type = "opi_api.storage.v1/AioVolume"
];

int64 block_size = 2;
int64 blocks_count = 3;
Expand All @@ -76,8 +84,8 @@ message AioVolume {
}

message CreateAioVolumeRequest {
AioVolume aio_volume = 2 [(google.api.field_behavior) = REQUIRED];
string aio_volume_id = 3;
AioVolume aio_volume = 1 [(google.api.field_behavior) = REQUIRED];
string aio_volume_id = 2;
}

message DeleteAioVolumeRequest {
Expand Down Expand Up @@ -121,12 +129,14 @@ message GetAioVolumeRequest {
];
}

message AioVolumeStatsRequest {
common.v1.ObjectKey handle = 1;
message StatsAioVolumeRequest {
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "opi_api.storage.v1/AioVolume"
];
}

message AioVolumeStatsResponse {
common.v1.ObjectKey handle = 1;
VolumeStats stats = 2;
message StatsAioVolumeResponse {
VolumeStats stats = 1;
}

34 changes: 22 additions & 12 deletions storage/v1alpha1/backend_null.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import "google/api/annotations.proto";
import "google/api/field_behavior.proto";
import "google/protobuf/field_mask.proto";

import "object_key.proto";
import "opicommon.proto";
import "uuid.proto";

Expand All @@ -32,7 +31,7 @@ service NullVolumeService {
}
rpc DeleteNullVolume (DeleteNullVolumeRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/{name=subsystems}/{subsystem}"
delete: "/v1/{name=NullVolumes/*}"
};
option (google.api.method_signature) = "name";
}
Expand All @@ -51,11 +50,16 @@ service NullVolumeService {
}
rpc GetNullVolume (GetNullVolumeRequest) returns (NullVolume) {
option (google.api.http) = {
get: "/v1/{name=subsystems}/{subsystem}"
get: "/v1/{name=NullVolumes/*}"
};
option (google.api.method_signature) = "name";
}
rpc StatsNullVolume (StatsNullVolumeRequest) returns (StatsNullVolumeResponse) {
option (google.api.http) = {
get: "/v1/{name=NullVolumes/*}:stats"
};
option (google.api.method_signature) = "name";
}
rpc NullVolumeStats (NullVolumeStatsRequest) returns (NullVolumeStatsResponse) {}
}

message NullVolume {
Expand All @@ -67,15 +71,19 @@ message NullVolume {
// name is an opaque object handle that is not user settable.
// name will be returned with created object
// user can only set {resource}_id on the Create request object
string name = 1;
string name = 1 [
(google.api.field_behavior) = OUTPUT_ONLY,
(google.api.field_behavior) = IMMUTABLE,
(google.api.resource_reference).type = "opi_api.storage.v1/NullVolume"
];
int64 block_size = 2;
int64 blocks_count = 3;
common.v1.Uuid uuid = 4;
}

message CreateNullVolumeRequest {
NullVolume null_volume = 2 [(google.api.field_behavior) = REQUIRED];
string null_volume_id = 3;
NullVolume null_volume = 1 [(google.api.field_behavior) = REQUIRED];
string null_volume_id = 2;
}

message DeleteNullVolumeRequest {
Expand Down Expand Up @@ -119,12 +127,14 @@ message GetNullVolumeRequest {
];
}

message NullVolumeStatsRequest {
common.v1.ObjectKey handle = 1;
message StatsNullVolumeRequest {
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "opi_api.storage.v1/NullVolume"
];
}

message NullVolumeStatsResponse {
common.v1.ObjectKey handle = 1;
VolumeStats stats = 2;
message StatsNullVolumeResponse {
VolumeStats stats = 1;
}

97 changes: 69 additions & 28 deletions storage/v1alpha1/backend_nvme_tcp.proto
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ service NvmeRemoteControllerService {
}
rpc DeleteNvmeRemoteController (DeleteNvmeRemoteControllerRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/{name=subsystems}/{subsystem}"
delete: "/v1/{name=NvmeRemoteControllers/*}"
};
option (google.api.method_signature) = "name";
}
Expand All @@ -50,12 +50,23 @@ service NvmeRemoteControllerService {
}
rpc GetNvmeRemoteController (GetNvmeRemoteControllerRequest) returns (NvmeRemoteController) {
option (google.api.http) = {
get: "/v1/{name=subsystems}/{subsystem}"
get: "/v1/{name=NvmeRemoteControllers/*}"
};
option (google.api.method_signature) = "name";
}
rpc ResetNvmeRemoteController (ResetNvmeRemoteControllerRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/v1/{name=NvmeRemoteControllers/*}:reset"
body: "*"
};
option (google.api.method_signature) = "name";
}
rpc StatsNvmeRemoteController (StatsNvmeRemoteControllerRequest) returns (StatsNvmeRemoteControllerResponse) {
option (google.api.http) = {
get: "/v1/{name=NvmeRemoteControllers/*}:stats"
};
option (google.api.method_signature) = "name";
}
rpc NvmeRemoteControllerReset (NvmeRemoteControllerResetRequest) returns (google.protobuf.Empty) {}
rpc NvmeRemoteControllerStats (NvmeRemoteControllerStatsRequest) returns (NvmeRemoteControllerStatsResponse) {}

rpc ListNvmeRemoteNamespaces (ListNvmeRemoteNamespacesRequest) returns (ListNvmeRemoteNamespacesResponse) {
option (google.api.http) = {
Expand All @@ -73,7 +84,7 @@ service NvmeRemoteControllerService {
}
rpc DeleteNvmePath (DeleteNvmePathRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/{name=subsystems}/{subsystem}"
delete: "/v1/{name=NvmePaths/*}"
};
option (google.api.method_signature) = "name";
}
Expand All @@ -92,11 +103,16 @@ service NvmeRemoteControllerService {
}
rpc GetNvmePath (GetNvmePathRequest) returns (NvmePath) {
option (google.api.http) = {
get: "/v1/{name=subsystems}/{subsystem}"
get: "/v1/{name=NvmePaths/*}"
};
option (google.api.method_signature) = "name";
}
rpc StatsNvmePath (StatsNvmePathRequest) returns (StatsNvmePathResponse) {
option (google.api.http) = {
get: "/v1/{name=NvmePaths/*}:stats"
};
option (google.api.method_signature) = "name";
}
rpc NvmePathStats (NvmePathStatsRequest) returns (NvmePathStatsResponse) {}
}

message NvmeRemoteController {
Expand All @@ -108,7 +124,11 @@ message NvmeRemoteController {
// name is an opaque object handle that is not user settable.
// name will be returned with created object
// user can only set {resource}_id on the Create request object
string name = 1;
string name = 1 [
(google.api.field_behavior) = OUTPUT_ONLY,
(google.api.field_behavior) = IMMUTABLE,
(google.api.resource_reference).type = "opi_api.storage.v1/NvmeRemoteController"
];

bool hdgst = 2;
bool ddgst = 3;
Expand All @@ -134,10 +154,19 @@ message NvmePath {
pattern: "volumes/{volume}"
};

// name is an opaque object handle that is not user settable.
// name will be returned with created object
// user can only set {resource}_id on the Create request object
string name = 1;
string name = 1 [
(google.api.field_behavior) = OUTPUT_ONLY,
(google.api.field_behavior) = IMMUTABLE,
(google.api.resource_reference).type = "opi_api.storage.v1/NvmePath"
];

string controller_name_ref = 2;
string controller_name_ref = 2 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "opi_api.storage.v1/NvmeRemoteController"
];

NvmeTransportType trtype = 3;
NvmeAddressFamily adrfam = 4;
Expand Down Expand Up @@ -168,11 +197,20 @@ message NvmeRemoteNamespace {
pattern: "volumes/{volume}"
};

// name is an opaque object handle that is not user settable.
// name will be returned with created object
// user can only set {resource}_id on the Create request object
string name = 1;
string name = 1 [
(google.api.field_behavior) = OUTPUT_ONLY,
(google.api.field_behavior) = IMMUTABLE,
(google.api.resource_reference).type = "opi_api.storage.v1/NvmeRemoteNamespace"
];

// controller through which the namespace is visible
string controller_name_ref = 2;
string controller_name_ref = 2 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "opi_api.storage.v1/NvmeRemoteController"
];

// NSID
int32 nsid = 3;
Expand All @@ -191,12 +229,11 @@ message NvmeRemoteNamespace {
}

message CreateNvmeRemoteControllerRequest {
NvmeRemoteController nvme_remote_controller = 2 [(google.api.field_behavior) = REQUIRED];
string nvme_remote_controller_id = 3;
NvmeRemoteController nvme_remote_controller = 1 [(google.api.field_behavior) = REQUIRED];
string nvme_remote_controller_id = 2;
}

message DeleteNvmeRemoteControllerRequest {
// object's unique identifier
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "opi_api.storage.v1/NvmeRemoteController"
Expand Down Expand Up @@ -231,24 +268,27 @@ message ListNvmeRemoteControllersResponse {
}

message GetNvmeRemoteControllerRequest {
// object's unique identifier
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "opi_api.storage.v1/NvmeRemoteController"
];
}

message NvmeRemoteControllerResetRequest {
// object's unique identifier
string name = 1;
message ResetNvmeRemoteControllerRequest {
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "opi_api.storage.v1/NvmeRemoteController"
];
}

message NvmeRemoteControllerStatsRequest {
// object's unique identifier
string name = 1;
message StatsNvmeRemoteControllerRequest {
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "opi_api.storage.v1/NvmeRemoteController"
];
}

message NvmeRemoteControllerStatsResponse {
message StatsNvmeRemoteControllerResponse {
VolumeStats stats = 1;
}

Expand Down Expand Up @@ -309,19 +349,20 @@ message ListNvmePathsResponse {
}

message GetNvmePathRequest {
// object's unique identifier
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "opi_api.storage.v1/NvmePath"
];
}

message NvmePathStatsRequest {
// object's unique identifier
string name = 1;
message StatsNvmePathRequest {
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "opi_api.storage.v1/NvmePath"
];
}

message NvmePathStatsResponse {
message StatsNvmePathResponse {
VolumeStats stats = 1;
}

Expand Down
Loading