diff --git a/core/src/main/java/uk/gov/gchq/magmacore/service/MagmaCoreService.java b/core/src/main/java/uk/gov/gchq/magmacore/service/MagmaCoreService.java index 77308fa6..46075179 100644 --- a/core/src/main/java/uk/gov/gchq/magmacore/service/MagmaCoreService.java +++ b/core/src/main/java/uk/gov/gchq/magmacore/service/MagmaCoreService.java @@ -54,6 +54,22 @@ /** * Service for interacting with a {@link MagmaCoreDatabase}. + * + *

+ * Note that Transaction control is manual unless using any of the following: + *

+ *
    + *
  1. getInTransaction()
  2. + *
  3. runInReadTransaction()
  4. + *
  5. runInWriteTransaction()
  6. + *
  7. exportTtl()
  8. + *
  9. importTtl()
  10. + *
  11. verifyModel()
  12. + *
+ *

+ * Nested transactions are not supported so ensure that no transaction is in progress before + * using any of the above methods. + *

*/ public class MagmaCoreService { @@ -675,6 +691,24 @@ public void create(final Thing thing) { database.create(thing); } + /** + * Delete an entity from the collection. + * + * @param object Entity to delete. + */ + void delete(final Thing object) { + database.delete(object); + } + + /** + * Apply a set of deletes to the database. + * + * @param deletes a {@link List} of {@link DbDeleteOperation} + */ + void delete(final List deletes) { + database.delete(deletes); + } + /** * Convert a {@link Collection} of {@link Thing} objects to a {@link DbTransformation} that can be * used to persist them. Typically this should be followed by a call to `runInTransaction`. @@ -843,6 +877,35 @@ public List verifyModel() { return DataIntegrityReport.verify(database); } + /** + * Start a transaction in READ mode. + */ + void beginRead() { + database.beginRead(); + } + + /** + * Start a transaction in Write mode. + */ + void beginWrite() { + database.beginWrite(); + } + + /** + * Commit a transaction - Finish the current transaction and make any changes permanent (if a + * "write" transaction). + */ + void commit() { + database.commit(); + } + + /** + * Abort a transaction - Finish the transaction and undo any changes (if a "write" transaction). + */ + void abort() { + database.abort(); + } + /** * Execute a SELECT query. *