Class 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.OffloadPolicies
    Definition of the offload policies.
    See Also:
    Serialized Form
    • 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
    • Constructor Detail

      • OffloadPoliciesImpl

        public OffloadPoliciesImpl()
    • 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)
      • 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_threshold is 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 policies
        policies - 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 policies
        nsLevelPolicies - namespace level offload policies
        brokerProperties - broker level offload configuration
        Returns:
        offload policies