use of org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.CRLStatusReport in project ozone by apache.
the class CRLStatusReportHandler method onMessage.
@Override
public void onMessage(CRLStatusReportFromDatanode reportFromDatanode, EventPublisher publisher) {
if (isSecurityEnabled) {
Preconditions.checkNotNull(reportFromDatanode);
DatanodeDetails dn = reportFromDatanode.getDatanodeDetails();
Preconditions.checkNotNull(dn, "CRLStatusReport is " + "missing DatanodeDetails.");
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Processing CRL status report for dn: {}", dn);
}
CRLStatusReport crlStatusReport = reportFromDatanode.getReport();
long receivedCRLId = crlStatusReport.getReceivedCrlId();
List<Long> pendingCRLIds = crlStatusReport.getPendingCrlIdsList();
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Updating Processed CRL Id: {} and Pending CRL Ids: {} ", receivedCRLId, pendingCRLIds);
}
CRLStatus crlStatus = new CRLStatus(receivedCRLId, pendingCRLIds);
certStore.setCRLStatusForDN(dn.getUuid(), crlStatus);
// Todo: send command for new CRL
// if crl > dn received crl id, then send a command to DN to process the
// new CRL via heartbeat response.
}
}
use of org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.CRLStatusReport in project ozone by apache.
the class CRLStatusReportPublisher method getReport.
@Override
protected CRLStatusReport getReport() throws IOException {
CRLStatusReport.Builder builder = CRLStatusReport.newBuilder();
DatanodeCRLStore dnCRLStore = this.getContext().getParent().getDnCRLStore();
builder.setReceivedCrlId(dnCRLStore.getLatestCRLSequenceID());
if (dnCRLStore.getPendingCRLs().size() > 0) {
List<Long> pendingCRLIds = dnCRLStore.getPendingCRLs().stream().map(CRLInfo::getCrlSequenceID).collect(Collectors.toList());
builder.addAllPendingCrlIds(pendingCRLIds);
}
return builder.build();
}
Aggregations