Skip to content

Commit

Permalink
Formatting...
Browse files Browse the repository at this point in the history
  • Loading branch information
Miles-Garnsey committed Aug 20, 2024
1 parent 2dc6d11 commit cf88568
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/** Replace JMX calls with CQL 'CALL' methods via the Rpc framework */
public class NodeOpsProvider {
private static final Logger logger = LoggerFactory.getLogger(NodeOpsProvider.class);
Expand Down Expand Up @@ -943,10 +942,9 @@ public String move(

@Rpc(name = "reloadTruststore")
public void reloadTruststore() throws Exception {
ShimLoader.instance.get().reloadTrustManager();
ShimLoader.instance.get().reloadTrustManager();
}


@Rpc(name = "getRangeToEndpointMap")
public Map<List<String>, List<String>> getRangeToEndpointMap(
@RpcParam(name = "keyspaceName") String keyspaceName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,5 +338,4 @@ public HintsService getHintsService() {
public void reloadTrustManager() throws Exception {
DseReloadableTrustManager.serverEncryptionInstance().reloadTrustManager();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,4 @@ default List<String> getKeyspaces() {
default void reloadTrustManager() throws Exception {
throw new Exception("Unimplemented for Cassandra, only available for DSE");
};

}
Original file line number Diff line number Diff line change
Expand Up @@ -663,39 +663,38 @@ public Response searchIndexRebuild(
});
}

@POST
@Path("/reload-truststore")
@Produces(MediaType.TEXT_PLAIN)
@ApiResponse(
responseCode = "200",
description = "Truststore reloaded successfully",
content =
@Content(
mediaType = MediaType.TEXT_PLAIN,
schema = @Schema(implementation = String.class),
examples = @ExampleObject(value = "OK")))
@Operation(summary = "reload truststore", operationId = "reloadTruststore")
public Response reloadTruststore() {
return handle(
() -> {
final String releaseVersion =
ResponseTools.getSingleRowStringResponse(
app.dbUnixSocketFile, app.cqlService, CASSANDRA_VERSION_CQL_STRING);
if (!releaseVersion.startsWith("4.0.0.68") && !releaseVersion.startsWith("4.0.0.69")) {
// rebuilding search index is only possible on DSE
return Response.status(Response.Status.BAD_REQUEST)
.entity("Reloading the truststore manually is only possible on DSE")
.build();
}

app.cqlService.executeCql(app.dbUnixSocketFile, "CALL NodeOps.reloadTruststore()");

return Response.ok("OK").build();
});
}


private static final String FQL_QUERY_RESPONSE_EXAMPLE =
@POST
@Path("/reload-truststore")
@Produces(MediaType.TEXT_PLAIN)
@ApiResponse(
responseCode = "200",
description = "Truststore reloaded successfully",
content =
@Content(
mediaType = MediaType.TEXT_PLAIN,
schema = @Schema(implementation = String.class),
examples = @ExampleObject(value = "OK")))
@Operation(summary = "reload truststore", operationId = "reloadTruststore")
public Response reloadTruststore() {
return handle(
() -> {
final String releaseVersion =
ResponseTools.getSingleRowStringResponse(
app.dbUnixSocketFile, app.cqlService, CASSANDRA_VERSION_CQL_STRING);
if (!releaseVersion.startsWith("4.0.0.68") && !releaseVersion.startsWith("4.0.0.69")) {
// rebuilding search index is only possible on DSE
return Response.status(Response.Status.BAD_REQUEST)
.entity("Reloading the truststore manually is only possible on DSE")
.build();
}

app.cqlService.executeCql(app.dbUnixSocketFile, "CALL NodeOps.reloadTruststore()");

return Response.ok("OK").build();
});
}

private static final String FQL_QUERY_RESPONSE_EXAMPLE =
"{\n"
+ " \"entity\": false,\n"
+ " \"variant\": {\n"
Expand Down

0 comments on commit cf88568

Please sign in to comment.