Package com.powsybl.afs.storage
Interface AppStorage
-
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
ListenableAppStorage
- All Known Implementing Classes:
AbstractAppStorage
,ForwardingAppStorage
public interface AppStorage extends AutoCloseable
A storage which maintains data for an application file system. This is a low level object, and should not be used by users of the AFS API, but only when extending the AFS API with a new storage implementation or new file types for example.An AppStorage implements low level methods to walk through a filesystem and to write and read data from this filesystem. It relies on nodes uniquely identified by and ID.
- Author:
- Geoffroy Jamgotchian
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
addDependency(String nodeId, String name, String toNodeId)
Adds a dependency from node with IDnodeId
to node with IDtoNodeId
.void
addDoubleTimeSeriesData(String nodeId, int version, String timeSeriesName, List<com.powsybl.timeseries.DoubleDataChunk> chunks)
Adds data (double) to the time series with namestimeSeriesNames
associated with node with IDnodeId
.void
addStringTimeSeriesData(String nodeId, int version, String timeSeriesName, List<com.powsybl.timeseries.StringDataChunk> chunks)
Adds data (string) to the time series with namestimeSeriesNames
associated with node with IDnodeId
.default List<FileSystemCheckIssue>
checkFileSystem(FileSystemCheckOptions options)
Check file system for consistency issues.void
clearTimeSeries(String nodeId)
Deletes time series associated with node with IDnodeId
void
close()
Closes any resource associated with this storage.NodeInfo
createNode(String parentNodeId, String name, String nodePseudoClass, String description, int version, NodeGenericMetadata genericMetadata)
Creates a new node in the tree under a parent node.NodeInfo
createRootNodeIfNotExists(String name, String nodePseudoClass)
Returns the root node of the tree, creating it if it does not exist.void
createTimeSeries(String nodeId, com.powsybl.timeseries.TimeSeriesMetadata metadata)
Creates a time series associated with node with IDnodeId
.boolean
dataExists(String nodeId, String name)
Returnstrue
if data namedname
associated with the node with IDnodeId
exists.String
deleteNode(String nodeId)
Deletes the node with IDnodeId
.void
flush()
Flush any changes to underlying storage.Set<NodeInfo>
getBackwardDependencies(String nodeId)
GetsNodeInfo
objects of nodes which depend on the node with IDnodeId
.Optional<NodeInfo>
getChildNode(String nodeId, String name)
GetsNodeInfo
for child node with namename
of the node with IDnodeId
, empty if such a node does not exist or node is inconsistent.List<NodeInfo>
getChildNodes(String nodeId)
GetsNodeInfo
for consistent child nodes of the node with IDnodeId
.Set<String>
getDataNames(String nodeId)
Returns the lists of names of data associated to the node with IDnodeId
.Set<NodeDependency>
getDependencies(String nodeId)
Gets all dependencies (NodeDependency
objects) of node with IDnodeId
.Set<NodeInfo>
getDependencies(String nodeId, String name)
GetsNodeInfo
objects for dependencies of node with IDnodeId
, and associated to the dependency namename
.Map<String,List<com.powsybl.timeseries.DoubleDataChunk>>
getDoubleTimeSeriesData(String nodeId, Set<String> timeSeriesNames, int version)
Gets data (double) for the time series with namestimeSeriesNames
associated with node with IDnodeId
.EventsBus
getEventsBus()
Get the events store.String
getFileSystemName()
default List<NodeInfo>
getInconsistentNodes()
GetsNodeInfo
for all inconsistent nodes.NodeInfo
getNodeInfo(String nodeId)
Gets NodeInfo object for the node with IDnodeId
.Optional<NodeInfo>
getParentNode(String nodeId)
GetsNodeInfo
for parent node of the node with IDnodeId
, empty if such a node does not exist or inconsistent.Map<String,List<com.powsybl.timeseries.StringDataChunk>>
getStringTimeSeriesData(String nodeId, Set<String> timeSeriesNames, int version)
Gets data (string) for the time series with namestimeSeriesNames
associated with node with IDnodeId
.default List<String>
getSupportedFileSystemChecks()
The list of supported file system checks.Set<Integer>
getTimeSeriesDataVersions(String nodeId)
Gets versions of time series data associated with node with IDnodeId
.Set<Integer>
getTimeSeriesDataVersions(String nodeId, String timeSeriesName)
Gets versions of data for the time series with nametimeSeriesName
associated with node with IDnodeId
.List<com.powsybl.timeseries.TimeSeriesMetadata>
getTimeSeriesMetadata(String nodeId, Set<String> timeSeriesNames)
Returns metadata of time series associated with node with IDnodeId
and with name intimeSeriesNames
.Set<String>
getTimeSeriesNames(String nodeId)
Returns names of all time series associated with node with IDnodeId
.boolean
isClosed()
Check if storage is closed.default boolean
isConsistent(String nodeId)
Return true if the node with IDnodeId
is consistent, otherwise it returns false .boolean
isRemote()
boolean
isWritable(String nodeId)
Optional<InputStream>
readBinaryData(String nodeId, String name)
Reads data associated to the node with IDnodeId
.boolean
removeData(String nodeId, String name)
Removes the data blob namedname
associated with the node with IDnodeId
.void
removeDependency(String nodeId, String name, String toNodeId)
Removes a dependency namedname
from node with IDnodeId
to node with IDtoNodeId
.default void
renameNode(String nodeId, String name)
Rename the node with IDnodeId
default void
setConsistent(String nodeId)
mark the node with IDnodeId
as consistent node.void
setDescription(String nodeId, String description)
default void
setMetadata(String nodeId, NodeGenericMetadata genericMetadata)
Update a node metadatavoid
setParentNode(String nodeId, String newParentNodeId)
Sets new parent node for the node with IDnodeId
.boolean
timeSeriesExists(String nodeId, String timeSeriesName)
Returnstrue
if a time series namedtimeSeriesName
associated with the node with IDnodeId
exists.void
updateModificationTime(String nodeId)
OutputStream
writeBinaryData(String nodeId, String name)
Returns anOutputStream
to write data associated to the node with IDnodeId
.
-
-
-
Method Detail
-
getFileSystemName
String getFileSystemName()
-
isRemote
boolean isRemote()
-
createRootNodeIfNotExists
NodeInfo createRootNodeIfNotExists(String name, String nodePseudoClass)
Returns the root node of the tree, creating it if it does not exist.
-
createNode
NodeInfo createNode(String parentNodeId, String name, String nodePseudoClass, String description, int version, NodeGenericMetadata genericMetadata)
Creates a new node in the tree under a parent node. ReturnsNodeInfo
corresponding to the newly created node. The new node is by default inconsistent,setConsistent(String nodeId)
method should explicitly be called to set it consistent.
-
setMetadata
default void setMetadata(String nodeId, NodeGenericMetadata genericMetadata)
Update a node metadata- Parameters:
nodeId
- id of the nodegenericMetadata
- new metadata that will override previous ones
-
isWritable
boolean isWritable(String nodeId)
-
isConsistent
default boolean isConsistent(String nodeId)
Return true if the node with IDnodeId
is consistent, otherwise it returns false .
-
setConsistent
default void setConsistent(String nodeId)
mark the node with IDnodeId
as consistent node.
-
updateModificationTime
void updateModificationTime(String nodeId)
-
getChildNodes
List<NodeInfo> getChildNodes(String nodeId)
GetsNodeInfo
for consistent child nodes of the node with IDnodeId
.
-
getInconsistentNodes
default List<NodeInfo> getInconsistentNodes()
GetsNodeInfo
for all inconsistent nodes.
-
getChildNode
Optional<NodeInfo> getChildNode(String nodeId, String name)
GetsNodeInfo
for child node with namename
of the node with IDnodeId
, empty if such a node does not exist or node is inconsistent.
-
getParentNode
Optional<NodeInfo> getParentNode(String nodeId)
GetsNodeInfo
for parent node of the node with IDnodeId
, empty if such a node does not exist or inconsistent.
-
setParentNode
void setParentNode(String nodeId, String newParentNodeId)
Sets new parent node for the node with IDnodeId
.
-
readBinaryData
Optional<InputStream> readBinaryData(String nodeId, String name)
Reads data associated to the node with IDnodeId
. A node may have several data blobs associated to it, with different names. The parametersname
specifies which of those data is requested.
-
writeBinaryData
OutputStream writeBinaryData(String nodeId, String name)
Returns anOutputStream
to write data associated to the node with IDnodeId
. A node may have several data blobs associated to it, with different names.
-
dataExists
boolean dataExists(String nodeId, String name)
Returnstrue
if data namedname
associated with the node with IDnodeId
exists.
-
getDataNames
Set<String> getDataNames(String nodeId)
Returns the lists of names of data associated to the node with IDnodeId
.
-
removeData
boolean removeData(String nodeId, String name)
Removes the data blob namedname
associated with the node with IDnodeId
.
-
createTimeSeries
void createTimeSeries(String nodeId, com.powsybl.timeseries.TimeSeriesMetadata metadata)
Creates a time series associated with node with IDnodeId
.
-
getTimeSeriesNames
Set<String> getTimeSeriesNames(String nodeId)
Returns names of all time series associated with node with IDnodeId
.
-
timeSeriesExists
boolean timeSeriesExists(String nodeId, String timeSeriesName)
Returnstrue
if a time series namedtimeSeriesName
associated with the node with IDnodeId
exists.
-
getTimeSeriesMetadata
List<com.powsybl.timeseries.TimeSeriesMetadata> getTimeSeriesMetadata(String nodeId, Set<String> timeSeriesNames)
Returns metadata of time series associated with node with IDnodeId
and with name intimeSeriesNames
.
-
getTimeSeriesDataVersions
Set<Integer> getTimeSeriesDataVersions(String nodeId)
Gets versions of time series data associated with node with IDnodeId
.
-
getTimeSeriesDataVersions
Set<Integer> getTimeSeriesDataVersions(String nodeId, String timeSeriesName)
Gets versions of data for the time series with nametimeSeriesName
associated with node with IDnodeId
.
-
getDoubleTimeSeriesData
Map<String,List<com.powsybl.timeseries.DoubleDataChunk>> getDoubleTimeSeriesData(String nodeId, Set<String> timeSeriesNames, int version)
Gets data (double) for the time series with namestimeSeriesNames
associated with node with IDnodeId
.
-
addDoubleTimeSeriesData
void addDoubleTimeSeriesData(String nodeId, int version, String timeSeriesName, List<com.powsybl.timeseries.DoubleDataChunk> chunks)
Adds data (double) to the time series with namestimeSeriesNames
associated with node with IDnodeId
.
-
getStringTimeSeriesData
Map<String,List<com.powsybl.timeseries.StringDataChunk>> getStringTimeSeriesData(String nodeId, Set<String> timeSeriesNames, int version)
Gets data (string) for the time series with namestimeSeriesNames
associated with node with IDnodeId
.
-
addStringTimeSeriesData
void addStringTimeSeriesData(String nodeId, int version, String timeSeriesName, List<com.powsybl.timeseries.StringDataChunk> chunks)
Adds data (string) to the time series with namestimeSeriesNames
associated with node with IDnodeId
.
-
clearTimeSeries
void clearTimeSeries(String nodeId)
Deletes time series associated with node with IDnodeId
-
addDependency
void addDependency(String nodeId, String name, String toNodeId)
Adds a dependency from node with IDnodeId
to node with IDtoNodeId
. The dependency will be associated with the specifiedname
.
-
getDependencies
Set<NodeInfo> getDependencies(String nodeId, String name)
GetsNodeInfo
objects for dependencies of node with IDnodeId
, and associated to the dependency namename
.
-
getDependencies
Set<NodeDependency> getDependencies(String nodeId)
Gets all dependencies (NodeDependency
objects) of node with IDnodeId
.
-
getBackwardDependencies
Set<NodeInfo> getBackwardDependencies(String nodeId)
GetsNodeInfo
objects of nodes which depend on the node with IDnodeId
.
-
removeDependency
void removeDependency(String nodeId, String name, String toNodeId)
Removes a dependency namedname
from node with IDnodeId
to node with IDtoNodeId
.
-
getEventsBus
EventsBus getEventsBus()
Get the events store.
-
flush
void flush()
Flush any changes to underlying storage.
-
isClosed
boolean isClosed()
Check if storage is closed.
-
close
void close()
Closes any resource associated with this storage.- Specified by:
close
in interfaceAutoCloseable
-
checkFileSystem
default List<FileSystemCheckIssue> checkFileSystem(FileSystemCheckOptions options)
Check file system for consistency issues.
-
-