Storage

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.e4graph
Class Storage

    java.lang.Object
      |
      +--com.e4graph.Storage

public final class Storage
extends java.lang.Object

Field Summary
`static int` | `AUTOCOMMIT` AUTOCOMMIT may be set in the state of a Storage, meaning that the storage is auto-committed from time to time by the e4Graph runtime system (off by default).
`static int` | `AUTOGC` AUTOGC may be set in the state of a Storage, meaning that the e4Graph runtime performs GCs on this storage as needed (on by default).
`static int` | `BIGPREALLOC` BIGPREALLOC may be set in the state of a Storage, meaning that big areas are pre-allocated to hold newly created nodes and vertices (off by default).
`static int` | `COMMITATCLOSE` COMMITATCLOSE may be set in the state of a Storage, meaning that the storage should be committed when closed (on by default).
`static int` | `COMPACTATCLOSE` COMPACTATCLOSE may be set in the state of a Storage, meaning that the storag is compacted to its smallest possible on-disk size when it is closed (off by default).
`static int` | `DEFAULTSTATE` DEFAULTSTATE denotes the default state of a Storage, consisting of COMMITATCLOSE, OPENGC and AUTOGC.
`static int` | `GCBEFORECOMMIT` GCBEFORECOMMIT may be set in the state of a Storage, meaning that a GC is performed on this storage before it is committed (off by default).
`static int` | `INVALID` This value represents the storageIndex of an invalid storage.
`static java.lang.String` | `METAKIT` This is the name of the default driver to use to manage the persistence of this storage.
`static int` | `OPENGC` OPENGC may be set in the state of a Storage, meaning that a GC should be performed (as necessary) when the storage is opened (on by default).

Constructor Summary
`Storage()` Default constructor, constructs an invalid storage.
`Storage(java.lang.String name, java.lang.String driver)` Constructor that uses the given name and driver to construct a storage.
`Storage(java.lang.String name, java.lang.String driver, int configuration)` Constructor that in addition to a name and driver for the storage also accepts an initial configuration state.

Method Summary
`void` | `close()` Close the storage, potentially committing any unsaved changes.
`boolean` | `commit()` Commit any unsaved changes in this storage to persistent storage.
`boolean` | `copyTo(com.e4graph.Storage otherStorage, boolean forceCommit)` Copy the contents of this storage (including any uncommitted changes) to the other storage, and if forceCommit is true, force a commit action on the other storage after the copy.
`boolean` | `delete()` Delete the persistent form of this storage.
`void` | `doGC()` Do a garbage collection on this storage now.
`java.lang.String` | `driver()` Retrieve the String for the driver used to manage persistence for this storage.
`boolean` | `equals(com.e4graph.Storage otherStorage)` Two storages are equal if their storageIndex values are the same.
`int` | `getGeneration()` Retrieve the generation index for this storage.
`int` | `getIndex()` Retrieve the storageIndex for this storage.
`com.e4graph.Node` | `getNode()` Create a new detached node in this storage and return the Node object representing it.
`com.e4graph.Node` | `getRoot()` Retrieve a Node representing the currently designated root node of this storage.
`int` | `getState()` Retrieve the current storage state.
`static com.e4graph.Storage` | `getStorage(int index, int generation)` Retrieves a Storage object for a currently open storage, given its storageIndex.
`int` | `getStorageIndex()` Retrieve the storageIndex for this storage.
`static com.e4graph.StorageIterator` | `getStorageIterator()` Create an iterator that iterates over all storages that are accessible in Java.
`com.e4graph.Vertex` | `getVertex(java.lang.String name, byte[] bytes)` Create a new detached vertex with the given name and the binary value bytes, and return the Vertex object representing it.
`com.e4graph.Vertex` | `getVertex(java.lang.String name, double d)` Create a new detached vertex with the given name and the double value d, and return the Vertex object representing it.
`com.e4graph.Vertex` | `getVertex(java.lang.String name, int i)` Create a new detached vertex with the given name and integer value i, and return the Vertex object representing it.
`com.e4graph.Vertex` | `getVertex(java.lang.String name, com.e4graph.Node n)`
`com.e4graph.Vertex` | `getVertex(java.lang.String name, java.lang.String s)` Create a new detached vertex with the given name and the string value s, and return the Vertex object representing it.
`boolean` | `isDirty()` Are there uncommitted changes in this storage?
`boolean` | `isValid()` A storage is valid if the underlying e4Graph storage is valid and its storageIndex is not the constant INVALID.
`void` | `markDirty()` Mark this storage as having uncommitted changes that have not yet been saved to persistent storage.
`java.lang.String` | `name()` Retrieve the String name of this storage.
`boolean` | `needsGC()` Is a garbage collection needed for this storage (it is needed if there may be detached nodes and vertices which are not referenced by the user program).
`boolean` | `setRoot(com.e4graph.Node newRoot)` Set the currently designated root node of this storage to the e4Graph node denoted by the given newRoot.
`int` | `setState(int statemask)` Set the storage state to a new state, with changes taking effect immediately and affecting subsequent behavior.
`static java.lang.String` | `version()` Retrieves the version string for the e4Graph library in use.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### COMMITATCLOSE

    public static final int COMMITATCLOSE

  COMMITATCLOSE may be set in the state of a Storage, meaning that the storage should be committed when closed (on by default).

  See Also:
    Constant Field Values

### AUTOCOMMIT

    public static final int AUTOCOMMIT

  AUTOCOMMIT may be set in the state of a Storage, meaning that the storage is auto-committed from time to time by the e4Graph runtime system (off by default).

  See Also:
    Constant Field Values

### OPENGC

    public static final int OPENGC

  OPENGC may be set in the state of a Storage, meaning that a GC should be performed (as necessary) when the storage is opened (on by default).

  See Also:
    Constant Field Values

### GCBEFORECOMMIT

    public static final int GCBEFORECOMMIT

  GCBEFORECOMMIT may be set in the state of a Storage, meaning that a GC is performed on this storage before it is committed (off by default).

  See Also:
    Constant Field Values

### AUTOGC

    public static final int AUTOGC

  AUTOGC may be set in the state of a Storage, meaning that the e4Graph runtime performs GCs on this storage as needed (on by default).

  See Also:
    Constant Field Values

### BIGPREALLOC

    public static final int BIGPREALLOC

  BIGPREALLOC may be set in the state of a Storage, meaning that big areas are pre-allocated to hold newly created nodes and vertices (off by default).

  See Also:
    Constant Field Values

### COMPACTATCLOSE

    public static final int COMPACTATCLOSE

  COMPACTATCLOSE may be set in the state of a Storage, meaning that the storag is compacted to its smallest possible on-disk size when it is closed (off by default).

  See Also:
    Constant Field Values

### DEFAULTSTATE

    public static final int DEFAULTSTATE

  DEFAULTSTATE denotes the default state of a Storage, consisting of COMMITATCLOSE, OPENGC and AUTOGC.

  See Also:
    Constant Field Values

### INVALID

    public static final int INVALID

  This value represents the storageIndex of an invalid storage.

  See Also:
    Constant Field Values

### METAKIT

    public static final java.lang.String METAKIT

  This is the name of the default driver to use to manage the persistence of this storage.

  See Also:
    Constant Field Values

Constructor Detail

### Storage

    public Storage()

  Default constructor, constructs an invalid storage.

### Storage

    public Storage(java.lang.String name,
                   java.lang.String driver)

  Constructor that uses the given name and driver to construct a storage.

### Storage

    public Storage(java.lang.String name,
                   java.lang.String driver,
                   int configuration)

  Constructor that in addition to a name and driver for the storage also accepts an initial configuration state.

Method Detail

### getStorageIterator

    public static com.e4graph.StorageIterator getStorageIterator()

  Create an iterator that iterates over all storages that are accessible in Java.

### getStorage

    public static com.e4graph.Storage getStorage(int index,
                                                 int generation)
                                          throws StorageIsNotOpenException

  Retrieves a Storage object for a currently open storage, given its storageIndex.

    `StorageIsNotOpenException`

### getIndex

    public int getIndex()

  Retrieve the storageIndex for this storage.

### getStorageIndex

    public int getStorageIndex()

  Retrieve the storageIndex for this storage.

### getGeneration

    public int getGeneration()

  Retrieve the generation index for this storage.

### version

    public static java.lang.String version()

  Retrieves the version string for the e4Graph library in use.

### isValid

    public boolean isValid()

  A storage is valid if the underlying e4Graph storage is valid and its storageIndex is not the constant INVALID.

### equals

    public boolean equals(com.e4graph.Storage otherStorage)

  Two storages are equal if their storageIndex values are the same.

### setState

    public int setState(int statemask)

  Set the storage state to a new state, with changes taking effect immediately and affecting subsequent behavior.

### getState

    public int getState()

  Retrieve the current storage state.

### commit

    public boolean commit()

  Commit any unsaved changes in this storage to persistent storage.

### close

    public void close()

  Close the storage, potentially committing any unsaved changes.

### copyTo

    public boolean copyTo(com.e4graph.Storage otherStorage,
                          boolean forceCommit)

  Copy the contents of this storage (including any uncommitted changes) to the other storage, and if forceCommit is true, force a commit action on the other storage after the copy.

### delete

    public boolean delete()

  Delete the persistent form of this storage.

### getRoot

    public com.e4graph.Node getRoot()

  Retrieve a Node representing the currently designated root node of this storage.

### setRoot

    public boolean setRoot(com.e4graph.Node newRoot)

  Set the currently designated root node of this storage to the e4Graph node denoted by the given newRoot.

### isDirty

    public boolean isDirty()

  Are there uncommitted changes in this storage?

### markDirty

    public void markDirty()

  Mark this storage as having uncommitted changes that have not yet been saved to persistent storage.

### name

    public java.lang.String name()

  Retrieve the String name of this storage.

### driver

    public java.lang.String driver()

  Retrieve the String for the driver used to manage persistence for this storage.

### getNode

    public com.e4graph.Node getNode()

  Create a new detached node in this storage and return the Node object representing it.

### getVertex

    public com.e4graph.Vertex getVertex(java.lang.String name,
                                        com.e4graph.Node n)

### getVertex

    public com.e4graph.Vertex getVertex(java.lang.String name,
                                        int i)

  Create a new detached vertex with the given name and integer value i, and return the Vertex object representing it.

### getVertex

    public com.e4graph.Vertex getVertex(java.lang.String name,
                                        double d)

  Create a new detached vertex with the given name and the double value d, and return the Vertex object representing it.

### getVertex

    public com.e4graph.Vertex getVertex(java.lang.String name,
                                        java.lang.String s)

  Create a new detached vertex with the given name and the string value s, and return the Vertex object representing it.

### getVertex

    public com.e4graph.Vertex getVertex(java.lang.String name,
                                        byte[] bytes)

  Create a new detached vertex with the given name and the binary value bytes, and return the Vertex object representing it.

### doGC

    public void doGC()

  Do a garbage collection on this storage now.

### needsGC

    public boolean needsGC()

  Is a garbage collection needed for this storage (it is needed if there may be detached nodes and vertices which are not referenced by the user program).

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD