Search in sources :

Example 1 with CRLStatusReport

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.
    }
}
Also used : DatanodeDetails(org.apache.hadoop.hdds.protocol.DatanodeDetails) CRLStatusReport(org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.CRLStatusReport) CRLStatus(org.apache.hadoop.hdds.security.x509.crl.CRLStatus)

Example 2 with CRLStatusReport

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();
}
Also used : CRLStatusReport(org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.CRLStatusReport) DatanodeCRLStore(org.apache.hadoop.hdds.datanode.metadata.DatanodeCRLStore)

Aggregations

CRLStatusReport (org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.CRLStatusReport)2 DatanodeCRLStore (org.apache.hadoop.hdds.datanode.metadata.DatanodeCRLStore)1 DatanodeDetails (org.apache.hadoop.hdds.protocol.DatanodeDetails)1 CRLStatus (org.apache.hadoop.hdds.security.x509.crl.CRLStatus)1