Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,18 @@ List<String> listKeys(String volumeName, String bucketName, String startKey,
}
}

/**
* Returns a OMRequest builder with specified type.
* @param cmdType type of the request
*/
private OzoneManagerProtocolProtos.OMRequest.Builder
createOMRequest(OzoneManagerProtocolProtos.Type cmdType) throws IOException {
return OzoneManagerProtocolProtos.OMRequest.newBuilder()
.setClientId(CLIENT_ID.toString())
.setVersion(ClientVersion.CURRENT_VERSION)
.setUserInfo(getUserInfo())
.setCmdType(cmdType);
}

private OzoneManagerProtocolProtos.OMRequest
getRenameKeyRequest(
Expand All @@ -483,12 +495,8 @@ List<String> listKeys(String volumeName, String bucketName, String startKey,
OzoneManagerProtocolProtos.OMRequest omRequest =
null;
try {
omRequest = OzoneManagerProtocolProtos.OMRequest.newBuilder()
.setClientId(CLIENT_ID.toString())
.setVersion(ClientVersion.CURRENT_VERSION)
.setUserInfo(getUserInfo())
omRequest = createOMRequest(OzoneManagerProtocolProtos.Type.RenameKey)
.setRenameKeyRequest(renameKeyRequest)
.setCmdType(OzoneManagerProtocolProtos.Type.RenameKey)
.build();
} catch (IOException e) {
LOG.error("Couldn't get userinfo", e);
Expand Down Expand Up @@ -549,13 +557,8 @@ private OzoneManagerProtocolProtos.OMRequest getDeleteKeyRequest(
OzoneManagerProtocolProtos.OMRequest omRequest =
null;
try {
omRequest =
OzoneManagerProtocolProtos.OMRequest.newBuilder()
.setClientId(CLIENT_ID.toString())
.setVersion(ClientVersion.CURRENT_VERSION)
.setUserInfo(getUserInfo())
omRequest = createOMRequest(OzoneManagerProtocolProtos.Type.DeleteKey)
.setDeleteKeyRequest(deleteKeyRequest)
.setCmdType(OzoneManagerProtocolProtos.Type.DeleteKey)
.build();
} catch (IOException e) {
LOG.error("Couldn't get userinfo", e);
Expand Down Expand Up @@ -619,12 +622,8 @@ boolean processKeyPath(List<String> keyPathList) {
OzoneManagerProtocolProtos.OMRequest omRequest =
null;
try {
omRequest = OzoneManagerProtocolProtos.OMRequest.newBuilder()
.setClientId(CLIENT_ID.toString())
.setVersion(ClientVersion.CURRENT_VERSION)
.setUserInfo(getUserInfo())
omRequest = createOMRequest(OzoneManagerProtocolProtos.Type.DeleteKeys)
.setDeleteKeysRequest(deleteKeysRequest)
.setCmdType(OzoneManagerProtocolProtos.Type.DeleteKeys)
.build();
} catch (IOException e) {
LOG.error("Couldn't get userinfo", e);
Expand Down