Class LocalS3.Builder

java.lang.Object
com.robothy.s3.rest.LocalS3.Builder
Enclosing class:
LocalS3

public static class LocalS3.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • port

      public LocalS3.Builder port(int port)
      Set the port that local-s3 service listen to. Default port is 8080. Set the value to -1 if you want to assign a random port.
      Parameters:
      port - customized port.
      Returns:
      builder.
    • dataPath

      public LocalS3.Builder dataPath(String dataPath)
      Set the LocalS3 data directory. The default value is null, while data is stored in Java Heap.

      If the path is specified and the mode is PERSISTENCE, then the LocalS3 service load data from and store data in this directory.

      If the data directory is set and LocalS3 runs in IN_MEMORY mode, then data from that path will be loaded as initial data. All changes are only available in the memory, i.e. won't write back to the specified path. Besides, LocalS3 will cache accessed data from this path; which could reduce disk I/O when start LocalS3 in IN_MEMORY mode with the same initial data for multi-times.

      Parameters:
      dataPath - data path.
      Returns:
      builder.
    • mode

      public LocalS3.Builder mode(LocalS3Mode mode)
      Set LocalS3 service running mode. Default value is PERSISTENCE.
      Parameters:
      mode - LocalS3 service running mode.
      Returns:
      builder.
    • initialDataCacheEnabled

      public LocalS3.Builder initialDataCacheEnabled(boolean enabled)
      This option only available when running LocalS3 in IN_MEMORY mode with initial data. If initial data cache is enabled, LocalS3 caches the accessed initial data in memory. This could reduce dist I/O when running tests with initial data in the same path.

      The default value is true.

      Parameters:
      enabled - is the initial data cache enabled.
      Returns:
      if the initial data cache enabled.
    • nettyParentEventGroupThreadNum

      public LocalS3.Builder nettyParentEventGroupThreadNum(int nettyParentEventGroupThreadNum)
      Set netty parent event group thread number. Default values is 1.
      Parameters:
      nettyParentEventGroupThreadNum - netty parent event group thread number.
      Returns:
      builder.
    • nettyChildEventGroupThreadNum

      public LocalS3.Builder nettyChildEventGroupThreadNum(int nettyChildEventGroupThreadNum)
      Set netty child event group thread number. Default value is 2.
      Parameters:
      nettyChildEventGroupThreadNum - netty child event group thread number.
      Returns:
      builder.
    • s3ExecutorThreadNum

      public LocalS3.Builder s3ExecutorThreadNum(int s3ExecutorThreadNum)
      Set local-s3 executor thread number. Default value is 4.
      Parameters:
      s3ExecutorThreadNum - local-s3 executor thread number.
      Returns:
      builder.
    • build

      public LocalS3 build()
      Build a LocalS3 instance.
      Returns:
      created LocalS3 instance.