Skip to content

Commit

Permalink
HDDS-2072. Make StorageContainerLocationProtocolService message based
Browse files Browse the repository at this point in the history
Contributed by Elek, Marton.
  • Loading branch information
anuengineer committed Oct 3, 2019
1 parent 1303255 commit 4c24f24
Show file tree
Hide file tree
Showing 8 changed files with 630 additions and 532 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ option java_package = "org.apache.hadoop.hdds.protocol.proto";
option java_outer_classname = "ScmBlockLocationProtocolProtos";
option java_generic_services = true;
option java_generate_equals_and_hash = true;
package hadoop.hdds;
package hadoop.hdds.block;

import "hdds.proto";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,100 @@ option java_package = "org.apache.hadoop.hdds.protocol.proto";
option java_outer_classname = "StorageContainerLocationProtocolProtos";
option java_generic_services = true;
option java_generate_equals_and_hash = true;
package hadoop.hdds;
package hadoop.hdds.container;

import "hdds.proto";

/**
All functions are dispatched as Request/Response under Ozone.
if you add newe functions, please add them using same pattern.
*/
message ScmContainerLocationRequest {
required Type cmdType = 1; // Type of the command

// A string that identifies this command, we generate Trace ID in Ozone
// frontend and this allows us to trace that command all over ozone.
optional string traceID = 2;

optional ContainerRequestProto containerRequest = 6;
optional GetContainerRequestProto getContainerRequest = 7;
optional GetContainerWithPipelineRequestProto getContainerWithPipelineRequest = 8;
optional SCMListContainerRequestProto scmListContainerRequest = 9;
optional SCMDeleteContainerRequestProto scmDeleteContainerRequest = 10;
optional NodeQueryRequestProto nodeQueryRequest = 11;
optional ObjectStageChangeRequestProto objectStageChangeRequest = 12;
optional PipelineRequestProto pipelineRequest = 13;
optional ListPipelineRequestProto listPipelineRequest = 14;
optional ActivatePipelineRequestProto activatePipelineRequest = 15;
optional DeactivatePipelineRequestProto deactivatePipelineRequest = 16;
optional ClosePipelineRequestProto closePipelineRequest = 17;
optional GetScmInfoRequestProto getScmInfoRequest = 18;
optional InSafeModeRequestProto inSafeModeRequest = 19;
optional ForceExitSafeModeRequestProto forceExitSafeModeRequest = 20;
optional StartReplicationManagerRequestProto startReplicationManagerRequest = 21;
optional StopReplicationManagerRequestProto stopReplicationManagerRequest = 22;
optional ReplicationManagerStatusRequestProto seplicationManagerStatusRequest = 23;

}

message ScmContainerLocationResponse {
required Type cmdType = 1; // Type of the command

optional string traceID = 2;

optional bool success = 3 [default = true];

optional string message = 4;

required Status status = 5;

optional ContainerResponseProto containerResponse = 6;
optional GetContainerResponseProto getContainerResponse = 7;
optional GetContainerWithPipelineResponseProto getContainerWithPipelineResponse = 8;
optional SCMListContainerResponseProto scmListContainerResponse = 9;
optional SCMDeleteContainerResponseProto scmDeleteContainerResponse = 10;
optional NodeQueryResponseProto nodeQueryResponse = 11;
optional ObjectStageChangeResponseProto objectStageChangeResponse = 12;
optional PipelineResponseProto pipelineResponse = 13;
optional ListPipelineResponseProto listPipelineResponse = 14;
optional ActivatePipelineResponseProto activatePipelineResponse = 15;
optional DeactivatePipelineResponseProto deactivatePipelineResponse = 16;
optional ClosePipelineResponseProto closePipelineResponse = 17;
optional GetScmInfoResponseProto getScmInfoResponse = 18;
optional InSafeModeResponseProto inSafeModeResponse = 19;
optional ForceExitSafeModeResponseProto forceExitSafeModeResponse = 20;
optional StartReplicationManagerResponseProto startReplicationManagerResponse = 21;
optional StopReplicationManagerResponseProto stopReplicationManagerResponse = 22;
optional ReplicationManagerStatusResponseProto replicationManagerStatusResponse = 23;
enum Status {
OK = 1;
CONTAINER_ALREADY_EXISTS = 2;
CONTAINER_IS_MISSING = 3;
}
}

enum Type {

AllocateContainer = 1;
GetContainer = 2;
GetContainerWithPipeline = 3;
ListContainer = 4;
DeleteContainer = 5;
QueryNode = 6;
NotifyObjectStageChange = 7;
AllocatePipeline = 8;
ListPipelines = 9;
ActivatePipeline = 10;
DeactivatePipeline = 11;
ClosePipeline = 12;
GetScmInfo = 13;
InSafeMode = 14;
ForceExitSafeMode = 15;
StartReplicationManager = 16;
StopReplicationManager = 17;
GetReplicationManagerStatus = 18;
}

/**
* Request send to SCM asking where the container should be created.
*/
Expand Down Expand Up @@ -235,97 +325,6 @@ message ReplicationManagerStatusResponseProto {
* and response messages for details of the RPC calls.
*/
service StorageContainerLocationProtocolService {
rpc submitRequest (ScmContainerLocationRequest) returns (ScmContainerLocationResponse);

/**
* Creates a container entry in SCM.
*/
rpc allocateContainer(ContainerRequestProto) returns (ContainerResponseProto);

/**
* Returns the pipeline for a given container.
*/
rpc getContainer(GetContainerRequestProto) returns (GetContainerResponseProto);

/**
* Returns the pipeline for a given container.
*/
rpc getContainerWithPipeline(GetContainerWithPipelineRequestProto) returns (GetContainerWithPipelineResponseProto);

rpc listContainer(SCMListContainerRequestProto) returns (SCMListContainerResponseProto);

/**
* Deletes a container in SCM.
*/
rpc deleteContainer(SCMDeleteContainerRequestProto) returns (SCMDeleteContainerResponseProto);

/**
* Returns a set of Nodes that meet a criteria.
*/
rpc queryNode(NodeQueryRequestProto) returns (NodeQueryResponseProto);

/**
* Notify from client when begin or finish container or pipeline operations on datanodes.
*/
rpc notifyObjectStageChange(ObjectStageChangeRequestProto) returns (ObjectStageChangeResponseProto);

/*
* Apis that Manage Pipelines.
*
* Pipelines are abstractions offered by SCM and Datanode that allows users
* to create a replication pipeline.
*
* These following APIs allow command line programs like SCM CLI to list
* and manage pipelines.
*/

/**
* Creates a replication pipeline.
*/
rpc allocatePipeline(PipelineRequestProto)
returns (PipelineResponseProto);

/**
* Returns the list of Pipelines managed by SCM.
*/
rpc listPipelines(ListPipelineRequestProto)
returns (ListPipelineResponseProto);

rpc activatePipeline(ActivatePipelineRequestProto)
returns (ActivatePipelineResponseProto);

rpc deactivatePipeline(DeactivatePipelineRequestProto)
returns (DeactivatePipelineResponseProto);

/**
* Closes a pipeline.
*/
rpc closePipeline(ClosePipelineRequestProto)
returns (ClosePipelineResponseProto);

/**
* Returns information about SCM.
*/
rpc getScmInfo(GetScmInfoRequestProto)
returns (GetScmInfoResponseProto);

/**
* Checks if SCM is in SafeMode.
*/
rpc inSafeMode(InSafeModeRequestProto)
returns (InSafeModeResponseProto);

/**
* Returns information about SCM.
*/
rpc forceExitSafeMode(ForceExitSafeModeRequestProto)
returns (ForceExitSafeModeResponseProto);

rpc startReplicationManager(StartReplicationManagerRequestProto)
returns (StartReplicationManagerResponseProto);

rpc stopReplicationManager(StopReplicationManagerRequestProto)
returns (StopReplicationManagerResponseProto);

rpc getReplicationManagerStatus(ReplicationManagerStatusRequestProto)
returns (ReplicationManagerStatusResponseProto);
}
Loading

0 comments on commit 4c24f24

Please sign in to comment.