Skip to content
Open
Show file tree
Hide file tree
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 @@ -53,6 +53,7 @@
import diskCacheV111.util.PnfsHandler;
import diskCacheV111.util.PnfsId;
import diskCacheV111.util.QuotaExceededCacheException;
import diskCacheV111.util.RetentionPolicy;
import diskCacheV111.util.TimeoutCacheException;
import diskCacheV111.vehicles.DoorRequestInfoMessage;
import diskCacheV111.vehicles.DoorTransferFinishedMessage;
Expand Down Expand Up @@ -1858,6 +1859,8 @@ public synchronized void finished(CacheException error) {
private class WriteTransfer extends HttpTransfer {

private final Optional<Checksum> _contentMd5;
/** optional hits to tape system how to store the file */
private final Optional<String> _archiveMetadata;

public WriteTransfer(PnfsHandler pnfs, Subject subject,
Restriction restriction, FsPath path) throws URISyntaxException {
Expand All @@ -1876,6 +1879,8 @@ public WriteTransfer(PnfsHandler pnfs, Subject subject,
throw new UncheckedBadRequestException("Bad Content-MD5 header: " + e.toString(),
null);
}

_archiveMetadata = Optional.ofNullable(ServletRequest.getRequest().getHeader("ArchiveMetadata"));
}

@Override
Expand Down Expand Up @@ -1930,6 +1935,11 @@ public void createNameSpaceEntry() throws CacheException {
}

getMaxUploadSize().ifPresent(this::setMaximumLength);

// for CUSTODIAL files on upload client might provide extra information that should be passed to the tape system
if (_archiveMetadata.isPresent() && getFileAttributes().getRetentionPolicy() == RetentionPolicy.CUSTODIAL) {
getFileAttributes().getStorageInfo().setKey("archive_metadata", _archiveMetadata.get());
}
}

public void relayData(InputStream inputStream)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import diskCacheV111.util.PnfsHandler;
import diskCacheV111.util.PnfsId;
import diskCacheV111.util.QuotaExceededCacheException;
import diskCacheV111.util.RetentionPolicy;
import diskCacheV111.util.TimeoutCacheException;
import diskCacheV111.vehicles.IoDoorEntry;
import diskCacheV111.vehicles.IoJobInfo;
Expand Down Expand Up @@ -905,7 +906,17 @@ private FileAttributes resolvePath() throws ErrorResponseException {
msg = _pnfs.createPnfsEntry(_path.toString(), attributes,
TransferManagerHandler.ATTRIBUTES_FOR_PULL);
}
return msg.getFileAttributes();

var attrs = msg.getFileAttributes();
// for CUSTODIAL files on upload client might provide extra information that should be passed to the tape system
if (attrs.getRetentionPolicy() == RetentionPolicy.CUSTODIAL) {
var archiveMetadata = ServletRequest.getRequest().getHeader("ArchiveMetadata");
if (archiveMetadata != null) {
attrs.getStorageInfo().setKey("archive_metadata", archiveMetadata);
}
}

return attrs;

default:
throw new ErrorResponseException(Response.Status.SC_INTERNAL_SERVER_ERROR,
Expand Down