Record Class StreamingUploadOptions
java.lang.Object
java.lang.Record
org.openehealth.ipf.commons.ihe.fhir.streaming.StreamingUploadOptions
- Record Components:
engageAboveBytes- only request bodies larger than this are split; smaller ones are passed through byte for byte, so that ordinary requests behave exactly as they do without the filter. This is measured on the whole request body, i.e. metadata plus the base64 of all documents in it.memoryThresholdBytes- extracted document content up to this size is kept in memory instead of being written to a temporary file. This is measured on a single decoded document and is therefore deliberately independent ofengageAboveBytes; it is quite normal for it to be the larger of the two. Splitting the body is what avoids the expensive part — the base64 text and the decoded array that the FHIR parser would otherwise materialize — whereas a temporary file is only needed to also avoid a large contiguous heap allocation. Small documents therefore stay in memory and cause no disk I/O at all.maxDocumentSizeBytes- maximum size of a single extracted document. Bounds how much temporary disk space one request can use.tempDirectory- directory for temporary document filesinlineDocumentResources- types of the resources whosecreateinteraction carries a document inline, i.e. the resource types below the FHIR base for which aPOSTis a candidate for the split. APOSTto the FHIR base itself always is one, because a transaction bundle may contain anything. SeeMHD_INLINE_DOCUMENT_RESOURCESfor the value that covers MHD.
public record StreamingUploadOptions(int engageAboveBytes, int memoryThresholdBytes, long maxDocumentSizeBytes, Path tempDirectory, Set<String> inlineDocumentResources)
extends Record
Settings of the streaming upload split, see
Base64SplittingFilter.
These are the only settings the split needs; whether it is active at all, and where the values come from, is up
to whoever registers the filter. The defaults are meant to be usable as they are — see
defaults().
- Author:
- Christian Ohr
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final longstatic final intThe resource types that carry a document inline in MHD: only ITI-105 does, as aDocumentReferencewith the document incontent.attachment.data. -
Constructor Summary
ConstructorsConstructorDescriptionStreamingUploadOptions(int engageAboveBytes, int memoryThresholdBytes, long maxDocumentSizeBytes, Path tempDirectory, Set<String> inlineDocumentResources) Creates an instance of aStreamingUploadOptionsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic StreamingUploadOptionsdefaults()static PathintReturns the value of theengageAboveBytesrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theinlineDocumentResourcesrecord component.longReturns the value of themaxDocumentSizeBytesrecord component.intReturns the value of thememoryThresholdBytesrecord component.Returns the value of thetempDirectoryrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DEFAULT_ENGAGE_ABOVE_BYTES
public static final int DEFAULT_ENGAGE_ABOVE_BYTES- See Also:
-
DEFAULT_MEMORY_THRESHOLD_BYTES
public static final int DEFAULT_MEMORY_THRESHOLD_BYTES- See Also:
-
DEFAULT_MAX_DOCUMENT_SIZE_BYTES
public static final long DEFAULT_MAX_DOCUMENT_SIZE_BYTES- See Also:
-
MHD_INLINE_DOCUMENT_RESOURCES
The resource types that carry a document inline in MHD: only ITI-105 does, as aDocumentReferencewith the document incontent.attachment.data. ITI-65 arrives as a transaction bundle posted to the FHIR base instead and is therefore covered without being named here. The remaining MHD transactions that accept aDocumentReferencebody — the ITI-57 based updates — are metadata-only, so they are of no interest here even though they are uploads.
-
-
Constructor Details
-
StreamingUploadOptions
public StreamingUploadOptions(int engageAboveBytes, int memoryThresholdBytes, long maxDocumentSizeBytes, Path tempDirectory, Set<String> inlineDocumentResources) Creates an instance of aStreamingUploadOptionsrecord class.- Parameters:
engageAboveBytes- the value for theengageAboveBytesrecord componentmemoryThresholdBytes- the value for thememoryThresholdBytesrecord componentmaxDocumentSizeBytes- the value for themaxDocumentSizeBytesrecord componenttempDirectory- the value for thetempDirectoryrecord componentinlineDocumentResources- the value for theinlineDocumentResourcesrecord component
-
-
Method Details
-
defaults
- Returns:
- options that split MHD uploads into the JVM temporary directory, with the thresholds the measurements this implementation was built on found reasonable
-
defaultTempDirectory
- Returns:
- the JVM temporary directory
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
engageAboveBytes
public int engageAboveBytes()Returns the value of theengageAboveBytesrecord component.- Returns:
- the value of the
engageAboveBytesrecord component
-
memoryThresholdBytes
public int memoryThresholdBytes()Returns the value of thememoryThresholdBytesrecord component.- Returns:
- the value of the
memoryThresholdBytesrecord component
-
maxDocumentSizeBytes
public long maxDocumentSizeBytes()Returns the value of themaxDocumentSizeBytesrecord component.- Returns:
- the value of the
maxDocumentSizeBytesrecord component
-
tempDirectory
Returns the value of thetempDirectoryrecord component.- Returns:
- the value of the
tempDirectoryrecord component
-
inlineDocumentResources
Returns the value of theinlineDocumentResourcesrecord component.- Returns:
- the value of the
inlineDocumentResourcesrecord component
-