Interface StorageSystem

All Known Implementing Classes:
FileStorageSystem

public interface StorageSystem
Represents a way of storing data by key/value. The location does not have to be a file or folder path. It is the 'identifier' of the data location.
  • Method Summary

    Modifier and Type Method Description
    void close()
    Called when the location is closed, generally during server shutdown.
    void delete​(java.lang.String key)
    Deletes the specified key from the database.
    boolean exists​(java.lang.String location)
    Gets if the location exists.
    byte[] get​(java.lang.String key)
    Gets the data associated to a key.
    void open​(java.lang.String location, StorageOptions storageOptions)
    Called when a StorageLocation is opened with this StorageSystem.
    void set​(java.lang.String key, byte[] data)
    Sets the specified data to the defined key.
  • Method Details

    • exists

      boolean exists​(@NotNull java.lang.String location)
      Gets if the location exists.
      Parameters:
      location - the location
      Returns:
      true if the location exists
    • open

      void open​(@NotNull java.lang.String location, @NotNull StorageOptions storageOptions)
      Called when a StorageLocation is opened with this StorageSystem.
      Parameters:
      location - the location name
      storageOptions - the StorageOptions
    • get

      @Nullable byte[] get​(@NotNull java.lang.String key)
      Gets the data associated to a key.
      Parameters:
      key - the key to retrieve
      Returns:
      the retrieved data, null if the data doesn't exist
    • set

      void set​(@NotNull java.lang.String key, byte[] data)
      Sets the specified data to the defined key.
      Parameters:
      key - the key of the data
      data - the data
    • delete

      void delete​(@NotNull java.lang.String key)
      Deletes the specified key from the database.
      Parameters:
      key - the key to delete
    • close

      void close()
      Called when the location is closed, generally during server shutdown.