Interface RegionDatabase

All Known Implementing Classes:
MemoryRegionDatabase, YamlRegionFile

public interface RegionDatabase
A region database stores a set of regions for a single world.

If there are multiple worlds, then there should be one region database per world. To manage multiple region databases, consider using an implementation of a RegionDriver.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Get a displayable name for this store.
    Load all regions from storage and place them into the passed map.
    void
    Replace all the data in the store with the given collection of regions.
    void
    Perform a partial save that only commits changes, rather than the entire region index.
  • Method Details

    • getName

      String getName()
      Get a displayable name for this store.
    • loadAll

      Load all regions from storage and place them into the passed map.

      The map will only be modified from one thread. The keys of each map entry will be in respect to the ID of the region but transformed to be lowercase. Until this method returns, the map may not be modified by any other thread simultaneously. If an exception is thrown, then the state in which the map is left is undefined.

      The provided map should have reasonably efficient get() and put() calls in order to maximize performance.

      Parameters:
      flags - a flag registry
      Returns:
      a set of loaded regions
      Throws:
      StorageException - thrown on read error
    • saveAll

      void saveAll(Set<ProtectedRegion> regions) throws StorageException
      Replace all the data in the store with the given collection of regions.
      Parameters:
      regions - a set of regions
      Throws:
      StorageException - thrown on write error
    • saveChanges

      void saveChanges(RegionDifference difference) throws DifferenceSaveException, StorageException
      Perform a partial save that only commits changes, rather than the entire region index.
      Parameters:
      difference - the difference
      Throws:
      DifferenceSaveException - thrown if partial saves are not supported
      StorageException - thrown on write error