@InterfaceAudience.Private @InterfaceStability.Unstable public abstract class ChangeDetectionPolicy extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ChangeDetectionPolicy.Mode
What to do when change is detected.
|
static class |
ChangeDetectionPolicy.Source
The S3 object attribute used to detect change.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
CHANGE_DETECTED |
| Modifier | Constructor and Description |
|---|---|
protected |
ChangeDetectionPolicy(ChangeDetectionPolicy.Mode mode,
boolean requireVersion) |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
applyRevisionConstraint(software.amazon.awssdk.services.s3.model.CopyObjectRequest.Builder requestBuilder,
String revisionId)
Applies the given
revisionId
as a server-side qualification on the CopyObjectRequest. |
abstract void |
applyRevisionConstraint(software.amazon.awssdk.services.s3.model.GetObjectRequest.Builder request,
String revisionId)
Applies the given
revisionId
as a server-side qualification on the GetObjectRequest.Builder. |
abstract void |
applyRevisionConstraint(software.amazon.awssdk.services.s3.model.HeadObjectRequest.Builder requestBuilder,
String revisionId)
Applies the given
revisionId
as a server-side qualification on the GetObjectMetadataRequest. |
static ChangeDetectionPolicy |
createPolicy(ChangeDetectionPolicy.Mode mode,
ChangeDetectionPolicy.Source source,
boolean requireVersion)
Create a policy.
|
org.apache.hadoop.fs.store.LogExactlyOnce |
getLogNoVersionSupport() |
ChangeDetectionPolicy.Mode |
getMode() |
static ChangeDetectionPolicy |
getPolicy(org.apache.hadoop.conf.Configuration configuration)
Reads the change detection policy from Configuration.
|
abstract String |
getRevisionId(software.amazon.awssdk.services.s3.model.CopyObjectResponse copyObjectResponse)
Like {
getRevisionId(HeadObjectResponse, String)}, but retrieves the
revision identifier from CopyObjectResponse. |
abstract String |
getRevisionId(software.amazon.awssdk.services.s3.model.GetObjectResponse getObjectResponse,
String uri)
Like {
getRevisionId(HeadObjectResponse, String)}, but retrieves the
* revision identifier from GetObjectResponse. |
abstract String |
getRevisionId(software.amazon.awssdk.services.s3.model.HeadObjectResponse objectMetadata,
String uri)
Pulls the attribute this policy uses to detect change out of the S3 object
metadata.
|
abstract String |
getRevisionId(S3ObjectAttributes s3Attributes)
Like {
getRevisionId(HeadObjectResponse, String)}, but retrieves the
revision identifier from S3ObjectAttributes. |
abstract ChangeDetectionPolicy.Source |
getSource() |
boolean |
isRequireVersion() |
org.apache.commons.lang3.tuple.ImmutablePair<Boolean,RemoteFileChangedException> |
onChangeDetected(String revisionId,
String newRevisionId,
String uri,
long position,
String operation,
long timesAlreadyDetected)
Takes appropriate action based on
mode when a change has
been detected. |
String |
toString()
String value for logging.
|
@VisibleForTesting public static final String CHANGE_DETECTED
protected ChangeDetectionPolicy(ChangeDetectionPolicy.Mode mode, boolean requireVersion)
public ChangeDetectionPolicy.Mode getMode()
public abstract ChangeDetectionPolicy.Source getSource()
public boolean isRequireVersion()
public org.apache.hadoop.fs.store.LogExactlyOnce getLogNoVersionSupport()
public static ChangeDetectionPolicy getPolicy(org.apache.hadoop.conf.Configuration configuration)
configuration - the configuration@VisibleForTesting public static ChangeDetectionPolicy createPolicy(ChangeDetectionPolicy.Mode mode, ChangeDetectionPolicy.Source source, boolean requireVersion)
mode - mode pf checkssource - source of changerequireVersion - throw exception when no version available?public String toString()
public abstract String getRevisionId(software.amazon.awssdk.services.s3.model.HeadObjectResponse objectMetadata, String uri)
revisionId.objectMetadata - the s3 object metadatauri - the URI of the objectpublic abstract String getRevisionId(software.amazon.awssdk.services.s3.model.GetObjectResponse getObjectResponse, String uri)
getRevisionId(HeadObjectResponse, String)}, but retrieves the
* revision identifier from GetObjectResponse.getObjectResponse - the response instanceuri - the URI of the objectpublic abstract String getRevisionId(S3ObjectAttributes s3Attributes)
getRevisionId(HeadObjectResponse, String)}, but retrieves the
revision identifier from S3ObjectAttributes.s3Attributes - the object attributespublic abstract String getRevisionId(software.amazon.awssdk.services.s3.model.CopyObjectResponse copyObjectResponse)
getRevisionId(HeadObjectResponse, String)}, but retrieves the
revision identifier from CopyObjectResponse.copyObjectResponse - the copy responsepublic abstract void applyRevisionConstraint(software.amazon.awssdk.services.s3.model.GetObjectRequest.Builder request,
String revisionId)
revisionId
as a server-side qualification on the GetObjectRequest.Builder.request - the requestrevisionId - the revision idpublic abstract void applyRevisionConstraint(software.amazon.awssdk.services.s3.model.CopyObjectRequest.Builder requestBuilder,
String revisionId)
revisionId
as a server-side qualification on the CopyObjectRequest.requestBuilder - the copy object request builderrevisionId - the revision idpublic abstract void applyRevisionConstraint(software.amazon.awssdk.services.s3.model.HeadObjectRequest.Builder requestBuilder,
String revisionId)
revisionId
as a server-side qualification on the GetObjectMetadataRequest.requestBuilder - the head object request builderrevisionId - the revision idpublic org.apache.commons.lang3.tuple.ImmutablePair<Boolean,RemoteFileChangedException> onChangeDetected(String revisionId, String newRevisionId, String uri, long position, String operation, long timesAlreadyDetected)
mode when a change has
been detected.revisionId - the expected revision idnewRevisionId - the detected revision iduri - the URI of the object being accessedposition - the position being read in the objectoperation - the operation being performed on the object (e.g. open or
re-open) that triggered the change detectiontimesAlreadyDetected - number of times a change has already been
detected on the current streamCopyright © 2008–2024 Apache Software Foundation. All rights reserved.