Class GHDirectory

java.lang.Object
com.graphhopper.storage.GHDirectory
All Implemented Interfaces:
Directory
Direct Known Subclasses:
MMapDirectory, RAMDirectory

public class GHDirectory extends Object implements Directory
Implements some common methods for the subclasses.
Author:
Peter Karich
  • Field Details

    • location

      protected final String location
  • Constructor Details

    • GHDirectory

      public GHDirectory(String _location, DAType defaultType)
  • Method Details

    • configure

      public Directory configure(LinkedHashMap<String,String> config)
      Configure the DAType (specified by the value) of a single DataAccess object (specified by the key). For "MMAP" you can prepend "preload." to the name and specify a percentage which preloads the DataAccess into physical memory of the specified percentage (only applied for load, not for import). As keys can be patterns the order is important and the LinkedHashMap is forced as type.
    • loadMMap

      public void loadMMap()
    • create

      public DataAccess create(String name)
      Description copied from interface: Directory
      Creates a new DataAccess object with the given name in the location of this Directory. Each name can only be used once.
      Specified by:
      create in interface Directory
    • create

      public DataAccess create(String name, int segmentSize)
      Specified by:
      create in interface Directory
      Parameters:
      segmentSize - segment size in bytes or -1 to use the default of the corresponding DataAccess implementation
    • create

      public DataAccess create(String name, DAType type)
      Specified by:
      create in interface Directory
    • create

      public DataAccess create(String name, DAType type, int segmentSize)
      Specified by:
      create in interface Directory
    • close

      public void close()
      Description copied from interface: Directory
      Releases all allocated resources from the directory without removing backing files.
      Specified by:
      close in interface Directory
    • clear

      public void clear()
      Description copied from interface: Directory
      Removes all contained objects from the directory and releases its resources.
      Specified by:
      clear in interface Directory
    • remove

      public void remove(String name)
      Description copied from interface: Directory
      Removes the specified object from the directory.
      Specified by:
      remove in interface Directory
    • getDefaultType

      public DAType getDefaultType()
      Specified by:
      getDefaultType in interface Directory
      Returns:
      the default type of a newly created DataAccess object
    • getDefaultType

      public DAType getDefaultType(String dataAccess, boolean preferInts)
      This method returns the default DAType of the specified DataAccess (as string). If preferInts is true then this method returns e.g. RAM_INT if the type of the specified DataAccess is RAM.
      Specified by:
      getDefaultType in interface Directory
    • isStoring

      public boolean isStoring()
    • create

      public Directory create()
      Specified by:
      create in interface Directory
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getLocation

      public String getLocation()
      Specified by:
      getLocation in interface Directory
      Returns:
      an id or location in the local filesystem.
    • getDAs

      public Map<String,DataAccess> getDAs()
      Specified by:
      getDAs in interface Directory