Contents
Interface IResourceStorage
- All Known Implementing Classes:
DiskResourceStorageProvider.DiskResourceStorage, EmptyResourceStorage
public interface IResourceStorage
An interface for resource storage operations.
-
Method Summary
Modifier and TypeMethodDescription<T extends Resource<ECS_TYPE>, ECS_TYPE>
CompletableFuture<T> load(Store<ECS_TYPE> store, ComponentRegistry.Data<ECS_TYPE> data, ResourceType<ECS_TYPE, T> resourceType) Called to load a resource from the given store and data.<T extends Resource<ECS_TYPE>, ECS_TYPE>
CompletableFuture<Void> remove(Store<ECS_TYPE> store, ComponentRegistry.Data<ECS_TYPE> data, ResourceType<ECS_TYPE, T> resourceType) Called to remove a resource from the given store and data.<T extends Resource<ECS_TYPE>, ECS_TYPE>
CompletableFuture<Void> save(Store<ECS_TYPE> store, ComponentRegistry.Data<ECS_TYPE> data, ResourceType<ECS_TYPE, T> resourceType, T resource) Called to save a resource to the given store and data.
-
Method Details
-
load
@Nonnull <T extends Resource<ECS_TYPE>, ECS_TYPE> CompletableFuture<T> load(@Nonnull Store<ECS_TYPE> store, @Nonnull ComponentRegistry.Data<ECS_TYPE> data, @Nonnull ResourceType<ECS_TYPE, T> resourceType) Called to load a resource from the given store and data.- Type Parameters:
T- The type of resource.ECS_TYPE- The ECS type.- Parameters:
store- The store to load from.data- The component data associated with the resource.resourceType- The type of resource to load.- Returns:
- a
CompletableFuturethat will complete with the loaded resource.
-
save
@Nonnull <T extends Resource<ECS_TYPE>, ECS_TYPE> CompletableFuture<Void> save(@Nonnull Store<ECS_TYPE> store, @Nonnull ComponentRegistry.Data<ECS_TYPE> data, @Nonnull ResourceType<ECS_TYPE, T> resourceType, T resource) Called to save a resource to the given store and data.- Type Parameters:
T- The type of resource.ECS_TYPE- The ECS type.- Parameters:
store- The store to save to.data- The component data associated with the resource.resourceType- The type of resource to save.resource- The resource to save.- Returns:
- a
CompletableFuturethat will complete when the save operation is done.
-
remove
@Nonnull <T extends Resource<ECS_TYPE>, ECS_TYPE> CompletableFuture<Void> remove(@Nonnull Store<ECS_TYPE> store, @Nonnull ComponentRegistry.Data<ECS_TYPE> data, @Nonnull ResourceType<ECS_TYPE, T> resourceType) Called to remove a resource from the given store and data.- Type Parameters:
T- The type of resource.ECS_TYPE- The ECS type.- Parameters:
store- The store to remove from.data- The component data associated with the resource.resourceType- The type of resource to remove.- Returns:
- a
CompletableFuturethat will complete when the remove operation is done.
-