OKIO implementation of the Storage interface, providing cross platform IO using the OKIO library.

Summary

Public constructors

<T : Any?> OkioStorage(
    fileSystem: FileSystem,
    serializer: OkioSerializer<T>,
    coordinatorProducer: (Path, FileSystem) -> InterProcessCoordinator,
    producePath: () -> Path
)
Cmn

Public functions

open StorageConnection<T>

Creates a storage connection which allows reading and writing to the underlying storage.

Cmn

Public constructors

OkioStorage

<T : Any?> OkioStorage(
    fileSystem: FileSystem,
    serializer: OkioSerializer<T>,
    coordinatorProducer: (Path, FileSystem) -> InterProcessCoordinator = { path, _ -> createSingleProcessCoordinator(path) },
    producePath: () -> Path
)
Parameters
fileSystem: FileSystem

The file system to perform IO operations on.

serializer: OkioSerializer<T>

The serializer for T.

coordinatorProducer: (Path, FileSystem) -> InterProcessCoordinator = { path, _ -> createSingleProcessCoordinator(path) }

The producer to provide InterProcessCoordinator that coordinates IO operations across processes if needed. By default it provides single process coordinator, which doesn't support cross process use cases.

producePath: () -> Path

The file producer that returns the file path that will be read and written.

Public functions

createConnection

open fun createConnection(): StorageConnection<T>

Creates a storage connection which allows reading and writing to the underlying storage.

Should be closed after usage.

Throws
okio.IOException

Unrecoverable IO exception when trying to access the underlying storage.