public interface DataStore
GroundAtoms
available via Databases
.
GroundAtoms with StandardPredicates
can be persisted
in a DataStore's Partitions
. If a StandardPredicate has not
been persisted before in a DataStore, it must be registered via
registerPredicate(StandardPredicate)
.
Modifier and Type | Method and Description |
---|---|
void |
close()
Releases all resources and locks obtained by this DataStore.
|
int |
deletePartition(Partition partition)
Deletes all
GroundAtoms persisted in a Partition. |
Database |
getDatabase(Partition write,
Partition... read)
Creates a Database that can read from and write to a
Partition and
optionally read from additional Partitions. |
Database |
getDatabase(Partition write,
Set<StandardPredicate> toClose,
Partition... read)
Creates a Database that can read from and write to a
Partition and
optionally read from additional Partitions. |
Database |
getDatabase(Partition write,
StandardPredicate[] toClose,
Partition... read) |
Inserter |
getInserter(StandardPredicate predicate,
Partition partition)
Creates an Inserter for persisting new
GroundAtoms
in a Partition . |
Partition |
getNewPartition()
Requests a new
Partition that is assigned an auto-generated name
and the next unused ID. |
Iterable<Database> |
getOpenDatabases()
Get all the currenly open databases associated with this data store.
|
Partition |
getPartition(String partitionName)
Gets a new
Partition of the DataStore with the given name. |
Set<Partition> |
getPartitions() |
Set<StandardPredicate> |
getRegisteredPredicates()
Returns the set of StandardPredicates registered with this DataStore.
|
void |
registerPredicate(StandardPredicate predicate)
Registers a StandardPredicate so that
GroundAtoms of that
StandardPredicate can be persisted in this DataStore. |
void registerPredicate(StandardPredicate predicate)
GroundAtoms
of that
StandardPredicate can be persisted in this DataStore.
If GroundAtoms of a StandardPredicate were already persisted in this DataStore at initialization, that StandardPredicate is already registered.
predicate
- the predicate to registerPartition getPartition(String partitionName)
Partition
of the DataStore with the given name.
If the partition doesn't exist, a new one will be created and added to the DataStore
metadata.partitionName
- a human-readable name for the partitionDatabase getDatabase(Partition write, Partition... read)
Partition
and
optionally read from additional Partitions.write
- the Partition to write to and read fromread
- additional Partitions to read fromIllegalArgumentException
- if write is in use or if read is the write
Partition of another DatabaseDatabase getDatabase(Partition write, StandardPredicate[] toClose, Partition... read)
Database getDatabase(Partition write, Set<StandardPredicate> toClose, Partition... read)
Partition
and
optionally read from additional Partitions.
Additionally, defines a set of StandardPredicates as closed in the Database, meaning that all GroundAtoms of that Predicate are ObservedAtoms.
write
- the Partition to write to and read fromtoClose
- set of StandardPredicates to closeread
- additional Partitions to read fromIllegalArgumentException
- if write is in use or if read is the
write Partition of another DatabaseIterable<Database> getOpenDatabases()
Inserter getInserter(StandardPredicate predicate, Partition partition)
GroundAtoms
in a Partition
.predicate
- the Predicate of the Atoms to be insertedpartition
- the Partition into which Atoms will be insertedIllegalArgumentException
- if partition is in use or predicate is
not registeredSet<StandardPredicate> getRegisteredPredicates()
Set<Partition> getPartitions()
Partitions
of this DataStoreint deletePartition(Partition partition)
GroundAtoms
persisted in a Partition.partition
- the partition to deleteIllegalArgumentException
- if partition is in usePartition getNewPartition()
Partition
that is assigned an auto-generated name
and the next unused ID. This partition will remain in the datastore
metadata unless explicitly deleted.void close()
IllegalStateException
- if any Partitions are in useCopyright © 2022 University of California, Santa Cruz. All rights reserved.