Package ai.preferred.venom.storage
Interface FileManager<T>
-
- Type Parameters:
T
- type of id
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
DummyFileManager
,MysqlFileManager
public interface FileManager<T> extends 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<T>
get(@NotNull Request request)
Returns latest record matching request.Record<T>
get(T id)
Returns record by the internal record id.@NotNull Callback
getCallback()
Get callback upon completion of request.@NotNull 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 String put(@NotNull @NotNull Request request, @NotNull @NotNull Response response) throws StorageException
Puts record into database.- Parameters:
request
- requestresponse
- Response- Returns:
- id of record
- Throws:
StorageException
- throws StorageException
-
get
@Nullable Record<T> 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<T> get(@NotNull @NotNull Request request) throws StorageException
Returns latest record matching request.- Parameters:
request
- request- Returns:
- stored record
- Throws:
StorageException
- throws StorageException
-
-