Class InMemoryStorage<ModelOutput_ extends ModelOutput>
java.lang.Object
ai.timefold.solver.service.definition.impl.storage.inmemory.InMemoryStorage<ModelOutput_>
- All Implemented Interfaces:
Storage<ModelOutput_>
public abstract class InMemoryStorage<ModelOutput_ extends ModelOutput>
extends Object
implements Storage<ModelOutput_>
-
Field Summary
Fields inherited from interface Storage
DATASETS_PREFIX, RUNS_PREFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclean(StorageAddress options) Cleans up the storage starting in the location defined byStorageOptions.voidcomplete(StorageAddress options, String id, ModelOutput_ dataset) Final update of the data set upon completion of solving into location defined byStorageOptionsvoidcreate(String location, StorageConfiguration configuration) Create required data store specific settings to be able to storage data in given location.voiddelete(StorageAddress options, String id) Deletes data set with given identifier from location defined byStorageOptionsvoidDestroy data store specific settings, this will also remove all data stored under given locationbooleanexists(StorageAddress options, String id) Checks if data set with given identifier exists in the location defined byStorageOptionsbooleanexistsSubModel(StorageAddress options, String id, SubModelKind kind) Checks if data set with given identifier exists in the location defined byStorageOptionsget(StorageAddress options, String id) Retrieves data set by its unique identifier from location defined byStorageOptions<T> TgetSubModel(StorageAddress options, String id, SubModelKind kind, com.fasterxml.jackson.core.type.TypeReference<T> configurationClass) <T> TgetSubModel(StorageAddress options, String id, SubModelKind kind, Class<T> clazz) Retrieves sub resource associated with data set with given identifier in the location defined byStorageOptionsvoidgetSubModelStream(StorageAddress options, String id, SubModelKind subModelKind, OutputStream output) Retrieves sub resource associated with data set with given identifier in the default location in the underlying data store as a stream of datalist(StorageAddress options, int pageNumber, int pageSize) Lists data sets (as statuses) stored in the location defined byStorageOptionsvoidreconfigure(String location, StorageConfiguration configuration) Reconfigures already existing storage based on provided configurationvoidrestore(StorageAddress options, String id) Restores previously deleted data set with given identifier from location defined byStorageOptionsvoidstore(StorageAddress options, String id, ModelOutput_ dataset) Stores given data set into location defined byStorageOptionsvoidstoreSubModel(StorageAddress options, String id, SubModelKind kind, Object subModel) Stores sub resource associated with given data set given by identifier in the location defined byStorageOptionsvoidupdate(StorageAddress options, String id, ModelOutput_ dataset) Updates existing data set in the storage into location defined byStorageOptionsvoidupdateSubModel(StorageAddress options, String id, SubModelKind subModelKind, Object subModel) Stores sub resource associated with given data set given by identifier in the location defined byStorageOptionsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Storage
clazz, clean, complete, delete, exists, existsSubModel, get, getSubModel, getSubModel, getSubModelStream, list, restore, store, storeSubModel, update, updateSubModel
-
Constructor Details
-
InMemoryStorage
public InMemoryStorage() -
InMemoryStorage
public InMemoryStorage(com.fasterxml.jackson.databind.ObjectMapper mapper)
-
-
Method Details
-
store
Description copied from interface:StorageStores given data set into location defined byStorageOptions- Specified by:
storein interfaceStorage<ModelOutput_ extends ModelOutput>- Parameters:
options- storage option to apply during the operationid- unique identifier of the data setdataset- data set to be stored
-
update
Description copied from interface:StorageUpdates existing data set in the storage into location defined byStorageOptions- Specified by:
updatein interfaceStorage<ModelOutput_ extends ModelOutput>- Parameters:
options- storage option to apply during the operationid- unique identifier of the data setdataset- data set to be stored
-
complete
Description copied from interface:StorageFinal update of the data set upon completion of solving into location defined byStorageOptions- Specified by:
completein interfaceStorage<ModelOutput_ extends ModelOutput>- Parameters:
options- storage option to apply during the operationid- unique identifier of the data setdataset- data set to be stored
-
get
Description copied from interface:StorageRetrieves data set by its unique identifier from location defined byStorageOptions- Specified by:
getin interfaceStorage<ModelOutput_ extends ModelOutput>- Parameters:
options- storage option to apply during the operationid- unique identifier of the data set- Returns:
- loaded data set if found
-
delete
Description copied from interface:StorageDeletes data set with given identifier from location defined byStorageOptions- Specified by:
deletein interfaceStorage<ModelOutput_ extends ModelOutput>- Parameters:
options- storage option to apply during the operationid- unique identifier of the data set
-
restore
Description copied from interface:StorageRestores previously deleted data set with given identifier from location defined byStorageOptions- Specified by:
restorein interfaceStorage<ModelOutput_ extends ModelOutput>- Parameters:
options- storage option to apply during the operationid- unique identifier of the data set
-
exists
Description copied from interface:StorageChecks if data set with given identifier exists in the location defined byStorageOptions- Specified by:
existsin interfaceStorage<ModelOutput_ extends ModelOutput>- Parameters:
options- storage option to apply during the operationid- unique identifier of the data set- Returns:
- true if exists false otherwise
-
list
Description copied from interface:StorageLists data sets (as statuses) stored in the location defined byStorageOptions- Specified by:
listin interfaceStorage<ModelOutput_ extends ModelOutput>- Parameters:
options- storage option to apply during the operationpageNumber- number of page to return (0-based)pageSize- number of data sets to return per page- Returns:
- non null list of found data sets as statuses
-
getSubModel
Description copied from interface:StorageRetrieves sub resource associated with data set with given identifier in the location defined byStorageOptions- Specified by:
getSubModelin interfaceStorage<ModelOutput_ extends ModelOutput>- Type Parameters:
T- type representing the returned value- Parameters:
options- storage option to apply during the operationid- unique identifier of the data setkind- kind of the sub resource e.g. waypointsclazz- class that the sub resource should be unmarshalled- Returns:
- loaded sub resource or null if no sub resource found
-
storeSubModel
Description copied from interface:StorageStores sub resource associated with given data set given by identifier in the location defined byStorageOptions- Specified by:
storeSubModelin interfaceStorage<ModelOutput_ extends ModelOutput>- Parameters:
options- storage option to apply during the operationid- unique identifier of the data setkind- kind of the sub resource e.g. waypointssubModel- the sub resource to be stored
-
updateSubModel
public void updateSubModel(StorageAddress options, String id, SubModelKind subModelKind, Object subModel) Description copied from interface:StorageStores sub resource associated with given data set given by identifier in the location defined byStorageOptions- Specified by:
updateSubModelin interfaceStorage<ModelOutput_ extends ModelOutput>- Parameters:
options- storage option to apply during the operationid- unique identifier of the data setsubModelKind- kind of the sub resource e.g. waypointssubModel- the sub resource to be stored
-
existsSubModel
Description copied from interface:StorageChecks if data set with given identifier exists in the location defined byStorageOptions- Specified by:
existsSubModelin interfaceStorage<ModelOutput_ extends ModelOutput>- Parameters:
options- storage option to apply during the operationid- unique identifier of the data setkind- type of sub model- Returns:
- true if exists false otherwise
-
getSubModelStream
public void getSubModelStream(StorageAddress options, String id, SubModelKind subModelKind, OutputStream output) Description copied from interface:StorageRetrieves sub resource associated with data set with given identifier in the default location in the underlying data store as a stream of data- Specified by:
getSubModelStreamin interfaceStorage<ModelOutput_ extends ModelOutput>- Parameters:
options- storage option to apply during the operationid- unique identifier of the data setsubModelKind- kind of the sub resource e.g. waypointsoutput- output stream where data should be written
-
clean
Description copied from interface:StorageCleans up the storage starting in the location defined byStorageOptions. Removes all resources regardless of their type e.g. data sets, waypoints etc- Specified by:
cleanin interfaceStorage<ModelOutput_ extends ModelOutput>- Parameters:
options- storage option to apply during the operation
-
create
Description copied from interface:StorageCreate required data store specific settings to be able to storage data in given location.- Specified by:
createin interfaceStorage<ModelOutput_ extends ModelOutput>- Parameters:
location- named location to be created in the underlying storage e.g. name of the bucketconfiguration- storage specific configuration
-
reconfigure
Description copied from interface:StorageReconfigures already existing storage based on provided configuration- Specified by:
reconfigurein interfaceStorage<ModelOutput_ extends ModelOutput>- Parameters:
location- named location to be reconfigured in the underlying storage e.g. name of the bucketconfiguration- storage specific configuration
-
destroy
Description copied from interface:StorageDestroy data store specific settings, this will also remove all data stored under given location- Specified by:
destroyin interfaceStorage<ModelOutput_ extends ModelOutput>- Parameters:
id- named location to be destroyed in the underlying storage e.g. name of the bucket
-
getSubModel
public <T> T getSubModel(StorageAddress options, String id, SubModelKind kind, com.fasterxml.jackson.core.type.TypeReference<T> configurationClass) - Specified by:
getSubModelin interfaceStorage<ModelOutput_ extends ModelOutput>
-