package com.hypixel.hytale.server.core.universe.world.storage;

import com.hypixel.hytale.component.Holder;
import it.unimi.dsi.fastutil.longs.LongSet;

import javax.annotation.Nonnull;
import java.io.Closeable;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;

public interface IChunkSaver extends Closeable {
    @Nonnull
    CompletableFuture<Void> saveHolder(int var1, int var2, @Nonnull Holder<ChunkStore> var3);

    @Nonnull
    CompletableFuture<Void> removeHolder(int var1, int var2);

    /**
     * Deletes the entire region file containing the specified chunk coordinates.
     * Used for corruption recovery when the region file is unrecoverable.
     */
    @Nonnull
    default CompletableFuture<Void> deleteRegionFile(int x, int z) {
        return CompletableFuture.completedFuture(null);
    }

    @Nonnull
    LongSet getIndexes() throws IOException;

    void flush() throws IOException;
}
