Class OffloadPoliciesImpl
- java.lang.Object
-
- org.apache.pulsar.common.policies.data.OffloadPoliciesImpl
-
- All Implemented Interfaces:
java.io.Serializable,org.apache.pulsar.common.policies.data.OffloadPolicies
public class OffloadPoliciesImpl extends java.lang.Object implements java.io.Serializable, org.apache.pulsar.common.policies.data.OffloadPoliciesDefinition of the offload policies.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOffloadPoliciesImpl.OffloadPoliciesImplBuilder
-
Field Summary
Fields Modifier and Type Field Description static java.util.List<java.lang.reflect.Field>CONFIGURATION_FIELDSstatic intDEFAULT_MAX_BLOCK_SIZE_IN_BYTESstatic java.lang.LongDEFAULT_OFFLOAD_DELETION_LAG_IN_MILLISstatic intDEFAULT_OFFLOAD_MAX_PREFETCH_ROUNDSstatic intDEFAULT_OFFLOAD_MAX_THREADSstatic java.lang.LongDEFAULT_OFFLOAD_THRESHOLD_IN_BYTESstatic org.apache.pulsar.common.policies.data.OffloadedReadPriorityDEFAULT_OFFLOADED_READ_PRIORITYstatic java.lang.StringDEFAULT_OFFLOADER_DIRECTORYstatic intDEFAULT_READ_BUFFER_SIZE_IN_BYTESstatic java.lang.StringDELETION_LAG_NAME_IN_CONF_FILEstatic com.google.common.collect.ImmutableList<java.lang.String>DRIVER_NAMESstatic java.lang.StringOFFLOAD_THRESHOLD_NAME_IN_CONF_FILE
-
Constructor Summary
Constructors Constructor Description OffloadPoliciesImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanbucketValid()static OffloadPoliciesImpl.OffloadPoliciesImplBuilderbuilder()voidcompatibleWithBrokerConfigFile(java.util.Properties properties)static OffloadPoliciesImplcreate(java.lang.String driver, java.lang.String region, java.lang.String bucket, java.lang.String endpoint, java.lang.String role, java.lang.String roleSessionName, java.lang.String credentialId, java.lang.String credentialSecret, java.lang.Integer maxBlockSizeInBytes, java.lang.Integer readBufferSizeInBytes, java.lang.Long offloadThresholdInBytes, java.lang.Long offloadDeletionLagInMillis, org.apache.pulsar.common.policies.data.OffloadedReadPriority readPriority)static OffloadPoliciesImplcreate(java.util.Properties properties)booleandriverSupported()static java.lang.StringgetSupportedDriverNames()booleanisFileSystemDriver()booleanisGcsDriver()booleanisS3Driver()static OffloadPoliciesImplmergeConfiguration(OffloadPoliciesImpl topicLevelPolicies, OffloadPoliciesImpl nsLevelPolicies, java.util.Properties brokerProperties)Merge different level offload policies.static OffloadPoliciesImploldPoliciesCompatible(OffloadPoliciesImpl nsLevelPolicies, org.apache.pulsar.common.policies.data.Policies policies)This method is used to make a compatible with old policies.java.util.PropertiestoProperties()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pulsar.common.policies.data.OffloadPolicies
getFileSystemProfilePath, getFileSystemURI, getGcsManagedLedgerOffloadBucket, getGcsManagedLedgerOffloadMaxBlockSizeInBytes, getGcsManagedLedgerOffloadReadBufferSizeInBytes, getGcsManagedLedgerOffloadRegion, getGcsManagedLedgerOffloadServiceAccountKeyFile, getManagedLedgerOffloadBucket, getManagedLedgerOffloadDeletionLagInMillis, getManagedLedgerOffloadDriver, getManagedLedgerOffloadedReadPriority, getManagedLedgerOffloadMaxBlockSizeInBytes, getManagedLedgerOffloadMaxThreads, getManagedLedgerOffloadPrefetchRounds, getManagedLedgerOffloadReadBufferSizeInBytes, getManagedLedgerOffloadRegion, getManagedLedgerOffloadServiceEndpoint, getManagedLedgerOffloadThresholdInBytes, getOffloadersDirectory, getS3ManagedLedgerOffloadBucket, getS3ManagedLedgerOffloadCredentialId, getS3ManagedLedgerOffloadCredentialSecret, getS3ManagedLedgerOffloadMaxBlockSizeInBytes, getS3ManagedLedgerOffloadReadBufferSizeInBytes, getS3ManagedLedgerOffloadRegion, getS3ManagedLedgerOffloadRole, getS3ManagedLedgerOffloadRoleSessionName, getS3ManagedLedgerOffloadServiceEndpoint
-
-
-
-
Field Detail
-
CONFIGURATION_FIELDS
public static final java.util.List<java.lang.reflect.Field> CONFIGURATION_FIELDS
-
DEFAULT_MAX_BLOCK_SIZE_IN_BYTES
public static final int DEFAULT_MAX_BLOCK_SIZE_IN_BYTES
- See Also:
- Constant Field Values
-
DEFAULT_READ_BUFFER_SIZE_IN_BYTES
public static final int DEFAULT_READ_BUFFER_SIZE_IN_BYTES
- See Also:
- Constant Field Values
-
DEFAULT_OFFLOAD_MAX_THREADS
public static final int DEFAULT_OFFLOAD_MAX_THREADS
- See Also:
- Constant Field Values
-
DEFAULT_OFFLOAD_MAX_PREFETCH_ROUNDS
public static final int DEFAULT_OFFLOAD_MAX_PREFETCH_ROUNDS
- See Also:
- Constant Field Values
-
DRIVER_NAMES
public static final com.google.common.collect.ImmutableList<java.lang.String> DRIVER_NAMES
-
DEFAULT_OFFLOADER_DIRECTORY
public static final java.lang.String DEFAULT_OFFLOADER_DIRECTORY
- See Also:
- Constant Field Values
-
DEFAULT_OFFLOAD_THRESHOLD_IN_BYTES
public static final java.lang.Long DEFAULT_OFFLOAD_THRESHOLD_IN_BYTES
-
DEFAULT_OFFLOAD_DELETION_LAG_IN_MILLIS
public static final java.lang.Long DEFAULT_OFFLOAD_DELETION_LAG_IN_MILLIS
-
OFFLOAD_THRESHOLD_NAME_IN_CONF_FILE
public static final java.lang.String OFFLOAD_THRESHOLD_NAME_IN_CONF_FILE
- See Also:
- Constant Field Values
-
DELETION_LAG_NAME_IN_CONF_FILE
public static final java.lang.String DELETION_LAG_NAME_IN_CONF_FILE
- See Also:
- Constant Field Values
-
DEFAULT_OFFLOADED_READ_PRIORITY
public static final org.apache.pulsar.common.policies.data.OffloadedReadPriority DEFAULT_OFFLOADED_READ_PRIORITY
-
-
Method Detail
-
create
public static OffloadPoliciesImpl create(java.lang.String driver, java.lang.String region, java.lang.String bucket, java.lang.String endpoint, java.lang.String role, java.lang.String roleSessionName, java.lang.String credentialId, java.lang.String credentialSecret, java.lang.Integer maxBlockSizeInBytes, java.lang.Integer readBufferSizeInBytes, java.lang.Long offloadThresholdInBytes, java.lang.Long offloadDeletionLagInMillis, org.apache.pulsar.common.policies.data.OffloadedReadPriority readPriority)
-
create
public static OffloadPoliciesImpl create(java.util.Properties properties)
-
builder
public static OffloadPoliciesImpl.OffloadPoliciesImplBuilder builder()
-
compatibleWithBrokerConfigFile
public void compatibleWithBrokerConfigFile(java.util.Properties properties)
-
driverSupported
public boolean driverSupported()
-
getSupportedDriverNames
public static java.lang.String getSupportedDriverNames()
-
isS3Driver
public boolean isS3Driver()
-
isGcsDriver
public boolean isGcsDriver()
-
isFileSystemDriver
public boolean isFileSystemDriver()
-
bucketValid
public boolean bucketValid()
-
toProperties
public java.util.Properties toProperties()
-
oldPoliciesCompatible
public static OffloadPoliciesImpl oldPoliciesCompatible(OffloadPoliciesImpl nsLevelPolicies, org.apache.pulsar.common.policies.data.Policies policies)
This method is used to make a compatible with old policies.The filed
Policies.offload_thresholdis primitive, so it can't be known whether it had been set. In the old logic, if the field value is -1, it could be thought that the field had not been set.- Parameters:
nsLevelPolicies- namespace level offload policiespolicies- namespace policies- Returns:
- offload policies
-
mergeConfiguration
public static OffloadPoliciesImpl mergeConfiguration(OffloadPoliciesImpl topicLevelPolicies, OffloadPoliciesImpl nsLevelPolicies, java.util.Properties brokerProperties)
Merge different level offload policies.policies level priority: topic > namespace > broker
- Parameters:
topicLevelPolicies- topic level offload policiesnsLevelPolicies- namespace level offload policiesbrokerProperties- broker level offload configuration- Returns:
- offload policies
-
-