CPS-314 Delete Dataspace

CPS-314 Delete Dataspace

CPS-314: Delete DataspaceClosed

Currently, in CPS, it is only possible to create a dataspace that will hold YANG modules and allow the service to create instances of the models via anchors.

It will be advantageous to provide a function that allows the deletion of the created dataspace provided that all anchors in that dataspace have also been deleted. 

To realise 'Delete dataspace' functionality, the following must be implemented:

  1. REST Endpoint in CPS-Core

  2. Java API method in CPS-Service

  3. Data Persistence Service

Issues

#

Issue

Notes

Decision

#

Issue

Notes

Decision

1

Abandoned SchemaSets

Question: Will the SchemaSets be automatically deleted once all anchors using them have been deleted?

SchemaSets are not automatically deleted once the anchors using them have been deleted

SchemaSets are deleted once dataspace holding it is deleted

 

Nov 15, 2021 Agreed with @Toine Siebelink that a dataspace can only be deleted if there are no anchors and no schemasets associated with it. The existence of either of these will lead to an exception. see issue #2 below

2

Dataspace not empty exception

If dataspace is not empty throw exception 'DataspaceInUseException' with response code 409(Conflict)

Nov 17, 2021 We decided that a new exception is needed as CPSException does not return the correct response code

Implementation Proposal

REST layers

cpsAdmin.yml

AdminRestController.java

Service layers

cpsAdminService.java

void deleteDataspace {String dataspaceName)

cpsAdminServiceImpl.java

Persistence layers

cpsAdminPersistenceService.java

void deleteDataspace {String dataspaceName)

cpsAdminPersistenceServiceImpl.java

 

Gliffy Diagram