Class OffloadPoliciesImpl

java.lang.Object
org.apache.pulsar.common.policies.data.OffloadPoliciesImpl
All Implemented Interfaces:
Serializable, OffloadPolicies

public class OffloadPoliciesImpl extends Object implements Serializable, OffloadPolicies
Definition of the offload policies.
See Also:
  • Field Details

    • CONFIGURATION_FIELDS

      public static final List<Field> CONFIGURATION_FIELDS
    • INTERNAL_SUPPORTED_DRIVER

      public static final com.google.common.collect.ImmutableList<String> INTERNAL_SUPPORTED_DRIVER
    • DRIVER_NAMES

      public static final com.google.common.collect.ImmutableList<String> DRIVER_NAMES
    • DEFAULT_MAX_BLOCK_SIZE_IN_BYTES

      public static final int DEFAULT_MAX_BLOCK_SIZE_IN_BYTES
      See Also:
    • DEFAULT_READ_BUFFER_SIZE_IN_BYTES

      public static final int DEFAULT_READ_BUFFER_SIZE_IN_BYTES
      See Also:
    • DEFAULT_OFFLOAD_MAX_THREADS

      public static final int DEFAULT_OFFLOAD_MAX_THREADS
      See Also:
    • DEFAULT_OFFLOAD_MAX_PREFETCH_ROUNDS

      public static final int DEFAULT_OFFLOAD_MAX_PREFETCH_ROUNDS
      See Also:
    • DEFAULT_OFFLOADER_DIRECTORY

      public static final String DEFAULT_OFFLOADER_DIRECTORY
      See Also:
    • DEFAULT_OFFLOAD_THRESHOLD_IN_BYTES

      public static final Long DEFAULT_OFFLOAD_THRESHOLD_IN_BYTES
    • DEFAULT_OFFLOAD_THRESHOLD_IN_SECONDS

      public static final Long DEFAULT_OFFLOAD_THRESHOLD_IN_SECONDS
    • DEFAULT_OFFLOAD_DELETION_LAG_IN_MILLIS

      public static final Long DEFAULT_OFFLOAD_DELETION_LAG_IN_MILLIS
    • EXTRA_CONFIG_PREFIX

      public static final String EXTRA_CONFIG_PREFIX
      See Also:
    • OFFLOAD_THRESHOLD_NAME_IN_CONF_FILE

      public static final String OFFLOAD_THRESHOLD_NAME_IN_CONF_FILE
      See Also:
    • DELETION_LAG_NAME_IN_CONF_FILE

      public static final String DELETION_LAG_NAME_IN_CONF_FILE
      See Also:
    • DATA_READ_PRIORITY_NAME_IN_CONF_FILE

      public static final String DATA_READ_PRIORITY_NAME_IN_CONF_FILE
      See Also:
    • DEFAULT_OFFLOADED_READ_PRIORITY

      public static final OffloadedReadPriority DEFAULT_OFFLOADED_READ_PRIORITY
  • Constructor Details

    • OffloadPoliciesImpl

      public OffloadPoliciesImpl()
  • Method Details

    • create

      public static OffloadPoliciesImpl create(String driver, String region, String bucket, String endpoint, String role, String roleSessionName, String credentialId, String credentialSecret, Integer maxBlockSizeInBytes, Integer readBufferSizeInBytes, Long offloadThresholdInBytes, Long offloadThresholdInSeconds, Long offloadDeletionLagInMillis, OffloadedReadPriority readPriority)
    • create

      public static OffloadPoliciesImpl create(Properties properties)
    • builder

    • compatibleWithBrokerConfigFile

      public void compatibleWithBrokerConfigFile(Properties properties)
    • driverSupported

      public boolean driverSupported()
    • getSupportedDriverNames

      public static String getSupportedDriverNames()
    • isS3Driver

      public boolean isS3Driver()
    • isGcsDriver

      public boolean isGcsDriver()
    • isFileSystemDriver

      public boolean isFileSystemDriver()
    • bucketValid

      public boolean bucketValid()
    • toProperties

      public Properties toProperties()
    • oldPoliciesCompatible

      public static OffloadPoliciesImpl oldPoliciesCompatible(OffloadPoliciesImpl nsLevelPolicies, 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, 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