Interface IResourceStorage

All Known Implementing Classes:
DiskResourceStorageProvider.DiskResourceStorage, EmptyResourceStorage

public interface IResourceStorage
An interface for resource storage operations.
  • 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 CompletableFuture that 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 CompletableFuture that 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 CompletableFuture that will complete when the remove operation is done.