org.apache.ignite.ml.inference.storage.model

## Class DefaultModelStorage

- java.lang.Object
- - org.apache.ignite.ml.inference.storage.model.DefaultModelStorage

- All Implemented Interfaces:
    ModelStorage

      public class DefaultModelStorage
      extends Object
      implements ModelStorage

  Default implementation of `ModelStorage` that can use any `ModelStorageProvider` as a backend storage system.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultModelStorage(ModelStorageProvider storageProvider)` Constructs a new instance of Ignite model storage.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `exists(String path)` Returns `true` if a regular file or directory exist, otherwise `false`.
    `byte[]` | `getFile(String path)` Returns file content.
    `boolean` | `isDirectory(String path)` Returns `true` if the specified path associated with a directory.
    `boolean` | `isFile(String path)` Returns `true` if the specified path associated with a regular file.
    `Set<String>` | `listFiles(String path)` Returns list of files in the specified directory.
    `void` | `mkdir(String path, boolean onlyIfNotExist)` Creates directory.
    `void` | `mkdirs(String path)` Creates directory and all required parent directories in the path.
    `void` | `putFile(String path, byte[] data, boolean onlyIfNotExist)` Creates a new or replaces existing file.
    `void` | `remove(String path)` Removes specified directory or file.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.ignite.ml.inference.storage.model.ModelStorage

      `mkdir, putFile`

- - ### Constructor Detail

    - #### DefaultModelStorage

          public DefaultModelStorage(ModelStorageProvider storageProvider)

      Constructs a new instance of Ignite model storage.
      Parameters:
        `storageProvider` - Model storage provider.

  - ### Method Detail

    - #### putFile

          public void putFile(String path,
                              byte[] data,
                              boolean onlyIfNotExist)

      Creates a new or replaces existing file.
      Specified by:
        `putFile` in interface `ModelStorage`
      Parameters:
        `path` - Path to file.
        `data` - File content.
        `onlyIfNotExist` - If file already exists throw an exception.

    - #### getFile

          public byte[] getFile(String path)

      Returns file content.
      Specified by:
        `getFile` in interface `ModelStorage`
      Parameters:
        `path` - Path to file.
      Returns:
        File content.

    - #### mkdir

          public void mkdir(String path,
                            boolean onlyIfNotExist)

      Creates directory.
      Specified by:
        `mkdir` in interface `ModelStorage`
      Parameters:
        `path` - Path to directory.
        `onlyIfNotExist` - If directory already exists throw an exception.

    - #### mkdirs

          public void mkdirs(String path)

      Creates directory and all required parent directories in the path.
      Specified by:
        `mkdirs` in interface `ModelStorage`
      Parameters:
        `path` - Path to directory.

    - #### listFiles

          public Set<String> listFiles(String path)

      Returns list of files in the specified directory.
      Specified by:
        `listFiles` in interface `ModelStorage`
      Parameters:
        `path` - Path to directory.
      Returns:
        List of files in the specified directory.

    - #### remove

          public void remove(String path)

      Removes specified directory or file.
      Specified by:
        `remove` in interface `ModelStorage`
      Parameters:
        `path` - Path to directory or file.

    - #### exists

          public boolean exists(String path)

      Returns `true` if a regular file or directory exist, otherwise `false`.
      Specified by:
        `exists` in interface `ModelStorage`
      Parameters:
        `path` - Path to directory or file.
      Returns:
        `true` if a regular file or directory exist, otherwise `false`.

    - #### isDirectory

          public boolean isDirectory(String path)

      Returns `true` if the specified path associated with a directory.
      Specified by:
        `isDirectory` in interface `ModelStorage`
      Parameters:
        `path` - Path to directory or file.
      Returns:
        `true` if the specified path associated with a directory.

    - #### isFile

          public boolean isFile(String path)

      Returns `true` if the specified path associated with a regular file.
      Specified by:
        `isFile` in interface `ModelStorage`
      Parameters:
        `path` - Path to directory or file.
      Returns:
        `true` if the specified path associated with a regular file.

2021 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.10.0
Release Date | : March 10 2021