Skip to content

v3.3 Custom Storage Driver

Andrey Kurilov edited this page Mar 3, 2017 · 3 revisions

Common Steps

  1. Please review the Storage Driver Inheritance Hierarchy

  2. Implement the custom storage driver by coding the abstract methods (see details below).

  3. Build the storage driver implementation jar file.

  4. Put the storage driver implementation jar file into the Mongoose's directory among with other Mongoose jar files.

  5. Modify the config/defaults.json file by adding the implementation info.

    To do this, find the section storage->driver->impl. This is a list of nodes. Each node reflects the particular storage driver implementation metainfo and contains the following required fields:

    • type: the identifier of the storage driver implementation
    • file: the path to a jar file containing the storage driver implementation
    • fqcn: storage driver implementation FQCN (fully qualified class name)

    Append the node describing the custom storage driver implementation to the list.

    Note:

    When using in the distributed mode, the custom storage driver configuration and implementation jar file are required to be located on the storage driver server host.

  6. Run Mongoose with an argument --storage-driver-type=X where X is the custom storage driver identifier.

NIO Storage Driver Implementation

  • Reference implementations:

    com.emc.mongoose.storage.driver.nio.fs.BasicFileStorageDriver

  • Extend the class com.emc.mongoose.storage.driver.nio.base.NioStorageDriverBase

    Methods to implement:

    1. void invokeNio(O ioTask)
    2. boolean createPath(String path)
    3. List<I> list(ItemFactory<I> itemFactory, String path, String prefix, int idRadix, I lastPrevItem, int count)
    4. void adjustIoBuffers(SizeInBytes avgDataItemSize, IoType ioType)
  • Implement interface com.emc.mongoose.model.storage.StorageDriver

Netty-Based Storage Driver Implementation

This implementation is intended to work with distributed storage with multiple endpoint nodes accessible via the network. Provides high-performance connection pool, simple endpoint node balancing, SSL/TLS functionality.

  • Reference implementations:

    N/A

  • Extend the class com.emc.mongoose.storage.driver.net.base.NetStorageDriverBase

    Methods to implement:

    1. boolean createPath(String path)
    2. List<I> list(ItemFactory<I> itemFactory, String path, String prefix, int idRadix, I lastPrevItem, int count)
    3. ChannelFuture sendRequest(Channel channel, O ioTask)
  • Extend the class com.emc.mongoose.storage.driver.net.base.ResponseHandlerBase

    Methods to implement:

    1. void handle(Channel channel, O ioTask, N msg)
  • Implement the interface:

    com.emc.mongoose.storage.driver.net.base.NetStorageDriver

HTTP Storage Driver Implementation

  • Reference implementations:

    1. com.emc.mongoose.storage.driver.net.http.atmos.AtmosStorageDriver
    2. com.emc.mongoose.storage.driver.net.http.s3.S3StorageDriver
    3. com.emc.mongoose.storage.driver.net.http.swift.SwiftStorageDriver
  • Extend the class com.emc.mongoose.storage.driver.net.http.base.HttpStorageDriverBase

    Methods to implement:

    1. boolean createPath(String path)
    2. List<I> list(ItemFactory<I> itemFactory, String path, String prefix, int idRadix, I lastPrevItem, int count)
    3. HttpMethod getTokenHttpMethod(IoType ioType)
    4. HttpMethod getPathHttpMethod(IoType ioType)
    5. String getTokenUriPath(I item, String srcPath, String dstPath, IoType ioType)
    6. String getPathUriPath(I item, String srcPath, String dstPath, IoType ioType)
    7. void applyMetaDataHeaders(final HttpHeaders httpHeaders)
    8. void applyAuthHeaders(HttpMethod httpMethod, String dstUriPath, HttpHeaders httpHeaders)
    9. void applyCopyHeaders(HttpHeaders httpHeaders, String srcPath)
  • Extend class com.emc.mongoose.storage.driver.net.http.base.HttpResponseHandlerBase

    Methods to implement:

    1. void handleResponseHeaders(O ioTask, HttpHeaders responseHeaders)
  • Implement the interface:

    com.emc.mongoose.storage.driver.net.http.base.HttpStorageDriver

Clone this wiki locally