Skip to content

Commit

Permalink
driver: include CTA archiveId into archiveReportURL
Browse files Browse the repository at this point in the history
Since CTAs' grpc-frontend  have introduced a Create step, the storage system is able to
fully build the archiveReportURL.
  • Loading branch information
kofemann committed Sep 14, 2022
1 parent 37bf2cf commit c3b4d28
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ public interface CtaTransportProvider {
/**
* Get transport used by CTA for IO, error and success reporting.
*
* @param id request id.
* @param diskFileId String identifier for Disk File ID (a-ka pnfsid)
* @param ctaArchiveId CTA Archive File ID.
* @return transport used by CTA for IO, error and success reporting.
*/
Transport getTransport(String id);
Transport getTransport(String diskFileId, long ctaArchiveId);

}
4 changes: 2 additions & 2 deletions src/main/java/org/dcache/nearline/cta/RequestsFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public SchedulerRequest valueOf(FlushRequest request, long archiveId) {
FileAttributes dcacheFileAttrs = request.getFileAttributes();

var id = dcacheFileAttrs.getPnfsId().toString();
Transport transport = transportProvider.getTransport(id);
Transport transport = transportProvider.getTransport(id, archiveId);

var checksumBuilder = CtaCommon.ChecksumBlob.newBuilder();
if (dcacheFileAttrs.isDefined(FileAttribute.CHECKSUM)) {
Expand Down Expand Up @@ -212,7 +212,7 @@ public SchedulerRequest valueOf(StageRequest request) {
var id = dcacheFileAttrs.getPnfsId().toString();
long archiveId = Long.parseLong(uri.getQuery().substring("archiveid=".length()));

var transport = transportProvider.getTransport(id);
var transport = transportProvider.getTransport(id, archiveId);

var md = Metadata.newBuilder()
.setArchiveFileId(archiveId)
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/dcache/nearline/cta/xrootd/DataMover.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,14 @@ public final ChannelHandlerFactory createHandlerFactory(String plugin)
}

@Override
public Transport getTransport(String id) {
public Transport getTransport(String id, long ctaArchiveId) {

Preconditions.checkState(cf != null, "Service is not started");
Preconditions.checkState(cf.isDone(), "Service is not bound yet.");
Preconditions.checkState(url != null, "service url is null");

// REVISIT:
String reporterUrl = "eosQuery://" + url + "/success/" + id;
String reporterUrl = "eosQuery://" + url + "/success/" + id + "?archiveid=" + ctaArchiveId;
String errorReporter = "eosQuery://" + url + "/error/" + id + "?error=";

return Transport.newBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public class RequestsFactoryTest {

private final CtaTransportProvider transportProvider = new CtaTransportProvider() {
@Override
public Transport getTransport(String id) {
String reporterUrl = "eosQuery://localhost/success/" + id;
public Transport getTransport(String id, long archiveId) {
String reporterUrl = "eosQuery://localhost/success/" + id + "?archiveid=" + archiveId;
String errorReporter = "eosQuery://localhost/error/" + id + "?error=";

return Transport.newBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void tearDown() {

@Test(expected = Exception.class)
public void testBindError() throws UnknownHostException {
URI uri = URI.create(dataMover.getTransport("1").getDstUrl());
URI uri = URI.create(dataMover.getTransport("1", 1).getDstUrl());
new DataMover("foo", "bar",
new InetSocketAddress(InetAddress.getLocalHost(), uri.getPort()), requests)
.startAsync()
Expand All @@ -45,7 +45,7 @@ public void testBindError() throws UnknownHostException {

@Test
public void testGetTransport() {
var transport = dataMover.getTransport("1");
var transport = dataMover.getTransport("1", 1);

assertThat("destination IRL is not set", transport.getDstUrl(), not(emptyOrNullString()));
assertThat("error report URL is not set", transport.getErrorReportUrl(),
Expand Down

0 comments on commit c3b4d28

Please sign in to comment.