A datastore interface defines the database-access operations that supported datastore implementations must provide. It lets repository and service code remain unchanged when the underlying database technology changes. section 2.3.3
A platform can use the interface to:
- Place a repository layer above datastore implementations and expose consistent database methods to services. section 2.3.3
- Select the correct database interface for relational or unstructured storage and the chosen cloud technology. section 2.3.3
- Support migration between cloud providers or database products by rebuilding with a new datastore library rather than rewriting service code. section 2.3.3
Layered service access
A service calls a repository function for normal database operations. The repository delegates to datastore functions for the selected relational or unstructured database, keeping database-specific choices below the service layer. section 2.3.3
Figure 2.12 When a particular service within the API needs to interact with the API database, it calls a repository function that provides all the normal database methods. The repository function would call the datastore functions for the type of database the API needs to use (relational or unstructured, in our case).
Trace the service, repository, and datastore layers used to route API database operations. section 2.3.3
