public class PgxSession extends PgxManagedObject
ServerInstance
. Every session gets a workspace assigned on the server, which can be used to read graph data, create transient data or custom algorithms for the sake of graph analysis. Once a session gets destroyed, all data in the session workspace gets freed.Modifier and Type | Method and Description |
---|---|
Analyst |
createAnalyst()
Creates a new Analyst.
|
Deque<GraphMetaData> |
getAvailableSnapshots(GraphConfig config)
Blocking version of
getAvailableSnapshotsAsync(GraphConfig) . |
Deque<GraphMetaData> |
getAvailableSnapshots(PgxGraph snapshot)
Blocking version of
getAvailableSnapshotsAsync(PgxGraph) . |
PgxFuture<Deque<GraphMetaData>> |
getAvailableSnapshotsAsync(GraphConfig config)
Gets a list of available in-memory snapshots of a graph described by a graph configuration.
|
PgxFuture<Deque<GraphMetaData>> |
getAvailableSnapshotsAsync(PgxGraph snapshot)
Gets a list of available in-memory snapshots of a given snapshot.
|
String |
getId() |
Long |
getIdleTimeout()
Gets the idle timeout of this session.
|
String |
getName()
alias for
getId() |
ServerInstance |
getServerInstance() |
String |
getSource()
Gets the source.
|
Long |
getTaskTimeout()
Gets the task timeout of this session.
|
PgxGraph |
readGraphWithProperties(GraphConfig config)
Blocking version of
readGraphWithPropertiesAsync(GraphConfig) . |
PgxGraph |
readGraphWithProperties(GraphConfig config, boolean forceUpdateIfNotFresh)
Blocking version of
readGraphWithPropertiesAsync(GraphConfig, boolean) . |
PgxGraph |
readGraphWithProperties(GraphConfig config, boolean forceUpdateIfNotFresh, String newGraphName)
Blocking version of
readGraphWithPropertiesAsync(GraphConfig, boolean, String) . |
PgxGraph |
readGraphWithProperties(GraphConfig config, long maxAge, TimeUnit maxAgeTimeUnit)
Blocking version of
readGraphWithPropertiesAsync(GraphConfig, long, TimeUnit) . |
PgxGraph |
readGraphWithProperties(GraphConfig config, long maxAge, TimeUnit maxAgeTimeUnit, boolean blockIfFull, String newGraphName)
Blocking version of
readGraphWithPropertiesAsync(GraphConfig, long, TimeUnit, boolean, String) . |
PgxGraph |
readGraphWithProperties(GraphConfig config, String newGraphName)
Blocking version of
readGraphWithPropertiesAsync(GraphConfig, String) . |
PgxGraph |
readGraphWithProperties(String path)
Blocking version of
readGraphWithPropertiesAsync(String) . |
PgxGraph |
readGraphWithProperties(String path, String newGraphName)
Blocking version of
readGraphWithPropertiesAsync(String, String) . |
PgxFuture<PgxGraph> |
readGraphWithPropertiesAsync(GraphConfig config)
Reads a graph and its properties, specified a graph config, into memory.
|
PgxFuture<PgxGraph> |
readGraphWithPropertiesAsync(GraphConfig config, boolean forceUpdateIfNotFresh)
Reads a graph and its properties, specified a graph config, into memory.
|
PgxFuture<PgxGraph> |
readGraphWithPropertiesAsync(GraphConfig config, boolean forceUpdateIfNotFresh, String newGraphName)
Reads a graph and its properties, specified a graph config, into memory.
|
PgxFuture<PgxGraph> |
readGraphWithPropertiesAsync(GraphConfig config, long maxAge, TimeUnit maxAgeTimeUnit)
Reads a graph and its properties, specified a graph config, into memory.
|
PgxFuture<PgxGraph> |
readGraphWithPropertiesAsync(GraphConfig config, long maxAge, TimeUnit maxAgeTimeUnit, boolean blockIfFull, String newGraphName)
Reads a graph and its properties, specified a graph config, into memory.
|
PgxFuture<PgxGraph> |
readGraphWithPropertiesAsync(GraphConfig config, String newGraphName)
Reads a graph and its properties, specified a graph config, into memory.
|
PgxFuture<PgxGraph> |
readGraphWithPropertiesAsync(String path)
Reads a graph and its properties, specified by a path to a graph config, into memory.
|
PgxFuture<PgxGraph> |
readGraphWithPropertiesAsync(String path, String newGraphName)
Reads a graph and its properties, specified by a path to a graph config, into memory.
|
void |
setSnapshot(PgxGraph graph, GraphMetaData metaData)
Blocking version of
setSnapshotAsync(PgxGraph, GraphMetaData) . |
void |
setSnapshot(PgxGraph graph, GraphMetaData metaData, boolean forceDeleteProperties)
Blocking version of
setSnapshotAsync(PgxGraph, GraphMetaData, boolean) . |
void |
setSnapshot(PgxGraph graph, long creationTimestamp)
Blocking version of
setSnapshotAsync(PgxGraph, long) . |
void |
setSnapshot(PgxGraph graph, long creationTimestamp, boolean forceDeleteProperties)
Blocking version of
setSnapshotAsync(PgxGraph, long, boolean) . |
PgxFuture<Void> |
setSnapshotAsync(PgxGraph graph, GraphMetaData metaData)
Sets a graph to a specific snapshot.
|
PgxFuture<Void> |
setSnapshotAsync(PgxGraph graph, GraphMetaData metaData, boolean forceDeleteTransientProperties)
Sets a graph to a specific snapshot.
|
PgxFuture<Void> |
setSnapshotAsync(PgxGraph graph, long creationTimestamp)
Sets a graph to a specific snapshot.
|
PgxFuture<Void> |
setSnapshotAsync(PgxGraph graph, long creationTimestamp, boolean forceDeleteTransientProperties)
Sets a graph to a specific snapshot.
|
String |
toString() |
equals, hashCode
close, destroy, destroyAsync
public Analyst createAnalyst()
Analyst
@Generated(value="src/python/synchronize.py") public Deque<GraphMetaData> getAvailableSnapshots(GraphConfig config) throws InterruptedException, ExecutionException
getAvailableSnapshotsAsync(GraphConfig)
. Calls getAvailableSnapshotsAsync(GraphConfig)
and waits for returned PgxFuture
to complete.InterruptedException
- if the caller thread gets interrupted while waiting for completion.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.@Generated(value="src/python/synchronize.py") public Deque<GraphMetaData> getAvailableSnapshots(PgxGraph snapshot) throws InterruptedException, ExecutionException
getAvailableSnapshotsAsync(PgxGraph)
. Calls getAvailableSnapshotsAsync(PgxGraph)
and waits for returned PgxFuture
to complete.InterruptedException
- if the caller thread gets interrupted while waiting for completion.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.public PgxFuture<Deque<GraphMetaData>> getAvailableSnapshotsAsync(GraphConfig config)
#isTransient()
.PgxGraph#getCreationTimestamp(TimeUnit)
value (milliseconds since Jan 1st 1970) - the timestamp when the snapshot was created.public PgxFuture<Deque<GraphMetaData>> getAvailableSnapshotsAsync(PgxGraph snapshot)
PgxGraph.isTransient()
.PgxGraph#getCreationTimestamp(TimeUnit)
value (milliseconds since Jan 1st 1970) - the timestamp when the snapshot was created.public String getId()
public Long getIdleTimeout()
null
indicates this session uses the default session idle timeout as specified by the PGX instance.null
.public String getName()
getId()
getName
in class PgxManagedObject
public ServerInstance getServerInstance()
public String getSource()
public Long getTaskTimeout()
null
indicates this session uses the default session task timeout as specified by the PGX instance.null
.@Generated(value="src/python/synchronize.py") public PgxGraph readGraphWithProperties(GraphConfig config) throws ExecutionException, InterruptedException
readGraphWithPropertiesAsync(GraphConfig)
. Calls readGraphWithPropertiesAsync(GraphConfig)
and waits for returned PgxFuture
to complete.InterruptedException
- if the caller thread gets interrupted while waiting for completion.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.@Generated(value="src/python/synchronize.py") public PgxGraph readGraphWithProperties(GraphConfig config, boolean forceUpdateIfNotFresh) throws InterruptedException, ExecutionException
readGraphWithPropertiesAsync(GraphConfig, boolean)
. Calls readGraphWithPropertiesAsync(GraphConfig, boolean)
and waits for returned PgxFuture
to complete.InterruptedException
- if the caller thread gets interrupted while waiting for completion.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.@Generated(value="src/python/synchronize.py") public PgxGraph readGraphWithProperties(GraphConfig config, boolean forceUpdateIfNotFresh, String newGraphName) throws InterruptedException, ExecutionException
readGraphWithPropertiesAsync(GraphConfig, boolean, String)
. Calls readGraphWithPropertiesAsync(GraphConfig, boolean, String)
and waits for returned PgxFuture
to complete.InterruptedException
- if the caller thread gets interrupted while waiting for completion.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.@Generated(value="src/python/synchronize.py") public PgxGraph readGraphWithProperties(GraphConfig config, long maxAge, TimeUnit maxAgeTimeUnit) throws InterruptedException, ExecutionException
readGraphWithPropertiesAsync(GraphConfig, long, TimeUnit)
. Calls readGraphWithPropertiesAsync(GraphConfig, long, TimeUnit)
and waits for returned PgxFuture
to complete.InterruptedException
- if the caller thread gets interrupted while waiting for completion.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.@Generated(value="src/python/synchronize.py") public PgxGraph readGraphWithProperties(GraphConfig config, long maxAge, TimeUnit maxAgeTimeUnit, boolean blockIfFull, String newGraphName) throws InterruptedException, ExecutionException
readGraphWithPropertiesAsync(GraphConfig, long, TimeUnit, boolean, String)
. Calls readGraphWithPropertiesAsync(GraphConfig, long, TimeUnit, boolean, String)
and waits for returned PgxFuture
to complete.InterruptedException
- if the caller thread gets interrupted while waiting for completion.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.@Generated(value="src/python/synchronize.py") public PgxGraph readGraphWithProperties(GraphConfig config, String newGraphName) throws ExecutionException, InterruptedException
readGraphWithPropertiesAsync(GraphConfig, String)
. Calls readGraphWithPropertiesAsync(GraphConfig, String)
and waits for returned PgxFuture
to complete.InterruptedException
- if the caller thread gets interrupted while waiting for completion.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.public PgxGraph readGraphWithProperties(String path) throws ExecutionException, InterruptedException
readGraphWithPropertiesAsync(String)
. Calls readGraphWithPropertiesAsync(String)
and waits for returned PgxFuture
to complete.InterruptedException
- if the caller thread gets interrupted while waiting for completion.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.public PgxGraph readGraphWithProperties(String path, String newGraphName) throws ExecutionException, InterruptedException
readGraphWithPropertiesAsync(String, String)
. Calls readGraphWithPropertiesAsync(String, String)
and waits for returned PgxFuture
to complete.InterruptedException
- if the caller thread gets interrupted while waiting for completion.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.public PgxFuture<PgxGraph> readGraphWithPropertiesAsync(GraphConfig config)
config
- the graph configpublic PgxFuture<PgxGraph> readGraphWithPropertiesAsync(GraphConfig config, boolean forceUpdateIfNotFresh)
config
- the graph configforceUpdateIfNotFresh
- if another snapshot of the given graph already exists and this flag is true
, a new snapshot will be loaded into memory in case that existing snapshot is not fresh (according to PgxGraph.isFresh()
). If no other snapshot of that graph exists, this flag has no effect.public PgxFuture<PgxGraph> readGraphWithPropertiesAsync(GraphConfig config, boolean forceUpdateIfNotFresh, String newGraphName)
config
- the graph configforceUpdateIfNotFresh
- if another snapshot of the given graph already exists and this flag is true
, a new snapshot will be loaded into memory in case that existing snapshot is not fresh (according to PgxGraph.isFresh()
). If no other snapshot of that graph exists, this flag has no effect.newGraphName
- how the graph should be named. If null
, a name will be generated. If a graph with that name already exists, the returned future will complete exceptionally.public PgxFuture<PgxGraph> readGraphWithPropertiesAsync(GraphConfig config, long maxAge, TimeUnit maxAgeTimeUnit)
config
- the graph configmaxAge
- if another snapshot of the given graph already exists, the age of the latest existing snapshot will be compared to the given maxAge. If the latest snapshot is in the given range, it will be returned, otherwise a new snapshot will be created.maxAgeTimeUnit
- the time unit of the maxAge parameterpublic PgxFuture<PgxGraph> readGraphWithPropertiesAsync(GraphConfig config, long maxAge, TimeUnit maxAgeTimeUnit, boolean blockIfFull, String newGraphName)
config
- the graph configmaxAge
- if another snapshot of the given graph already exists, the age of the latest existing snapshot will be compared to the given maxAge. If the latest snapshot is in the given range, it will be returned, otherwise a new snapshot will be created.maxAgeTimeUnit
- the time unit of the maxAge parameterblockIfFull
- if true
and a new snapshot needs to be created but no more snapshots are allowed by the server configuration, the returned future will not complete until space becomes available. If full and this flage is false
, the returned future will complete exceptionally instead.newGraphName
- how the graph should be named. If null
, a name will be generated. If a graph with that name already exists, the returned future will complete exceptionally.public PgxFuture<PgxGraph> readGraphWithPropertiesAsync(GraphConfig config, String newGraphName)
config
- the graph confignewGraphName
- how the graph should be named. If null
, a name will be generated. If a graph with that name already exists, the returned future will complete exceptionally.public PgxFuture<PgxGraph> readGraphWithPropertiesAsync(String path)
path
- a path to a graph config. All protocols in Protocol
are supported, e.g. 'hdfs:/path/to/config.json' or 'http://myserver.com/my-config.json'public PgxFuture<PgxGraph> readGraphWithPropertiesAsync(String path, String newGraphName)
path
- a path to a graph config. All protocols in Protocol
are supported, e.g. 'hdfs:/path/to/config.json' or 'http://myserver.com/my-config.json'newGraphName
- how the graph should be named. If null
, a name will be generated. If a graph with that name already exists, the returned future will complete exceptionally.@Generated(value="src/python/synchronize.py") public void setSnapshot(PgxGraph graph, GraphMetaData metaData) throws InterruptedException, ExecutionException
setSnapshotAsync(PgxGraph, GraphMetaData)
. Calls setSnapshotAsync(PgxGraph, GraphMetaData)
and waits for returned PgxFuture
to complete.InterruptedException
- if the caller thread gets interrupted while waiting for completion.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.@Generated(value="src/python/synchronize.py") public void setSnapshot(PgxGraph graph, GraphMetaData metaData, boolean forceDeleteProperties) throws InterruptedException, ExecutionException
setSnapshotAsync(PgxGraph, GraphMetaData, boolean)
. Calls setSnapshotAsync(PgxGraph, GraphMetaData, boolean)
and waits for returned PgxFuture
to complete.InterruptedException
- if the caller thread gets interrupted while waiting for completion.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.@Generated(value="src/python/synchronize.py") public void setSnapshot(PgxGraph graph, long creationTimestamp) throws InterruptedException, ExecutionException
setSnapshotAsync(PgxGraph, long)
. Calls setSnapshotAsync(PgxGraph, long)
and waits for returned PgxFuture
to complete.InterruptedException
- if the caller thread gets interrupted while waiting for completion.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.@Generated(value="src/python/synchronize.py") public void setSnapshot(PgxGraph graph, long creationTimestamp, boolean forceDeleteProperties) throws InterruptedException, ExecutionException
setSnapshotAsync(PgxGraph, long, boolean)
. Calls setSnapshotAsync(PgxGraph, long, boolean)
and waits for returned PgxFuture
to complete.InterruptedException
- if the caller thread gets interrupted while waiting for completion.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.public PgxFuture<Void> setSnapshotAsync(PgxGraph graph, GraphMetaData metaData)
graph
- the graph to be checked out to a different version. Note that transient properties cannot be checked out to a different graph version. If the given graph contains any transient properties, the returned future will complete exceptionally with an UnsupportedOperationException
set as cause. You can use setSnapshotAsync(PgxGraph, long, boolean)
to force a checkout on a graph with transient properties.metaData
- the metaData object returned by getAvailableSnapshotsAsync(GraphConfig)
identifying the version to be checked outpublic PgxFuture<Void> setSnapshotAsync(PgxGraph graph, GraphMetaData metaData, boolean forceDeleteTransientProperties)
graph
- the graph to be checked out to a different snapshot versionmetaData
- the metaData object returned by getAvailableSnapshotsAsync(GraphConfig)
identifying the version to be checked outforceDeleteTransientProperties
- Graphs with transient properties cannot be checked out to a different version. If this flag is set to true
, the checked out graph will no longer contain any transient properties. If false
, the returned future will complete exceptionally with an UnsupportedOperationException
as its cause.public PgxFuture<Void> setSnapshotAsync(PgxGraph graph, long creationTimestamp)
graph
- the graph to be checked out to a different version. Note that transient properties cannot be checked out to a different graph version. If the given graph contains any transient properties, the returned future will complete exceptionally with an UnsupportedOperationException
set as cause. You can use setSnapshotAsync(PgxGraph, long, boolean)
to force a checkout on a graph with transient properties.creationTimestamp
- the creation timestamp (milliseconds since Jan 1st 1970) identifying the version to be checked outpublic PgxFuture<Void> setSnapshotAsync(PgxGraph graph, long creationTimestamp, boolean forceDeleteTransientProperties)
graph
- the graph to be checked out to a different snapshot versioncreationTimestamp
- the creation timestamp (milliseconds since Jan 1st 1970) identifying the version to be checked outforceDeleteTransientProperties
- Graphs with transient properties cannot be checked out to a different version. If this flag is set to true
, the checked out graph will no longer contain any transient properties. If false
, the returned future will complete exceptionally with an UnsupportedOperationException
as its cause.public String toString()
toString
in class PgxManagedObject
Copyright © 2015. All rights reserved.