Class MediaPropertiesBuilder

java.lang.Object
org.rostore.entity.media.MediaPropertiesBuilder

public class MediaPropertiesBuilder extends Object
This one is needed to create MediaProperties. As the MediaProperties are immutable once the media is created, it can't expose any changeable fields, yet at the creation phase one needs to set them. So, the builder is used to initially populate the fields that are frozen once the builder is transformed to MediaProperties after the Media creation.
  • Constructor Details

    • MediaPropertiesBuilder

      public MediaPropertiesBuilder()
  • Method Details

    • maxTotalSize

      public MediaPropertiesBuilder maxTotalSize(long maxTotalSize)
      Sets the maximum total size of the storage
      Parameters:
      maxTotalSize - the maximum total size in bytes
      Returns:
      the builder object
    • blockSize

      public MediaPropertiesBuilder blockSize(int blockSize)
      Sets the block size that will be used by the storage

      It should be aligned with the physical memory page in the hosting system to achieve the best alignment and memory usage.

      Parameters:
      blockSize - the block size in bytes
      Returns:
      the builder object
    • closeUnusedBlocksAfterMillis

      public MediaPropertiesBuilder closeUnusedBlocksAfterMillis(long closeUnusedBlocksAfterMillis)
      Sets the time interval in milliseconds after each the unused blocks will be removed from the memory.

      The caching of unused block is only used fo the blocks of CATALOG or KEY types.

      Parameters:
      closeUnusedBlocksAfterMillis - time interval to remove the unused blocks from the memory
      Returns:
      the builder object
    • closeUnusedSequencesAfterMillis

      public MediaPropertiesBuilder closeUnusedSequencesAfterMillis(long closeUnusedSequencesAfterMillis)
      Sets the time interval in milliseconds after each the unused block sequences will be removed from the memory.

      Sequences combine several blocks in one continues data block, which is used in the ro-store controlling structures such as catalogs or key blocks.

      Parameters:
      closeUnusedSequencesAfterMillis - the time interval in milliseconds
      Returns:
      the builder object
    • getMaxTotalSize

      public long getMaxTotalSize()
      Provides the total maximum size of the storage
      Returns:
      the size in bytes
    • setMaxTotalSize

      public void setMaxTotalSize(long maxTotalSize)
      Sets the maximum total size of the storage
      Parameters:
      maxTotalSize - the maximum total size in bytes
    • getBlockSize

      public int getBlockSize()
      Provides the block size
      Returns:
      the block size in bytes
    • setBlockSize

      public void setBlockSize(int blockSize)
      Sets the block size that will be used by the storage

      It should be aligned with the physical memory page in the hosting system to achieve the best alignment and memory usage.

      Parameters:
      blockSize - the block size in bytes
    • getCloseUnusedBlocksAfterMillis

      public long getCloseUnusedBlocksAfterMillis()
      Provides the time interval in milliseconds after each the unused blocks will be removed from the memory.

      The caching of unused block is only used fo the blocks of CATALOG or KEY types.

      Returns:
      the time interval in milliseconds
    • setCloseUnusedBlocksAfterMillis

      public void setCloseUnusedBlocksAfterMillis(long closeUnusedBlocksAfterMillis)
      Sets the time interval in milliseconds after each the unused blocks will be removed from the memory.

      The caching of unused block is only used fo the blocks of CATALOG or KEY types.

      Parameters:
      closeUnusedBlocksAfterMillis - time interval to remove the unused blocks from the memory
    • getCloseUnusedSequencesAfterMillis

      public long getCloseUnusedSequencesAfterMillis()
      Gets the time interval in milliseconds after each the unused block sequences will be removed from the memory.

      Sequences combine several blocks in one continues data block, which is used in the ro-store controlling structures such as catalogs or key blocks.

      Returns:
      the time interval in milliseconds
    • setCloseUnusedSequencesAfterMillis

      public void setCloseUnusedSequencesAfterMillis(long closeUnusedSequencesAfterMillis)
      Sets the time interval in milliseconds after each the unused block sequences will be removed from the memory.

      Sequences combine several blocks in one continues data block, which is used in the ro-store controlling structures such as catalogs or key blocks.

      Parameters:
      closeUnusedSequencesAfterMillis - the time interval in milliseconds