Interface FileManager<T>

  • Type Parameters:
    T - type of id
    All Superinterfaces:
    java.lang.AutoCloseable
    All Known Implementing Classes:
    DummyFileManager, MysqlFileManager

    public interface FileManager<T>
    extends java.lang.AutoCloseable
    This interface represents the basic functions a FileManager should have.
    Author:
    Maksim Tkachenko, Truong Quoc Tuan
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      @NotNull Record get​(@NotNull Request request)
      Returns latest record matching request.
      Record get​(T id)
      Returns record by the internal record id.
      @NotNull Callback getCallback()
      Get callback upon completion of request.
      @NotNull java.lang.String put​(@NotNull Request request, @NotNull Response response)
      Puts record into database.
      • Methods inherited from interface java.lang.AutoCloseable

        close
    • Method Detail

      • getCallback

        @NotNull
        @NotNull Callback getCallback()
        Get callback upon completion of request.

        Please note that blocking callbacks will significantly reduce the rate at which request are processed. Please implement your own executors on I/O blocking callbacks.

        Returns:
        Callback for FileManager
      • put

        @NotNull
        @NotNull java.lang.String put​(@NotNull
                                      @NotNull Request request,
                                      @NotNull
                                      @NotNull Response response)
                               throws StorageException
        Puts record into database.
        Parameters:
        request - request
        response - Response
        Returns:
        id of record
        Throws:
        StorageException - throws StorageException
      • get

        @Nullable
        Record get​(T id)
            throws StorageException
        Returns record by the internal record id.
        Parameters:
        id - record id
        Returns:
        stored record
        Throws:
        StorageException - throws StorageException
      • get

        @NotNull
        @NotNull Record get​(@NotNull
                            @NotNull Request request)
                     throws StorageException
        Returns latest record matching request.
        Parameters:
        request - request
        Returns:
        stored record
        Throws:
        StorageException - throws StorageException