blob: 08bfa3687500276ebf45f73b28f5a7baa75e86e9 [file] [log] [blame]
Madan Jampani08822c42014-11-04 17:17:46 -08001package org.onlab.onos.store.service;
2
3import java.util.List;
4
5public interface DatabaseService {
6
7 /**
8 * Performs a read on the database.
9 * @param request read request.
10 * @return ReadResult
11 * @throws DatabaseException
12 */
13 ReadResult read(ReadRequest request);
14
15 /**
16 * Performs a batch read operation on the database.
17 * The main advantage of batch read operation is parallelization.
18 * @param batch batch of read requests to execute.
19 * @return
20 */
21 List<OptionalResult<ReadResult, DatabaseException>> batchRead(List<ReadRequest> batch);
22
23 /**
24 * Performs a write operation on the database.
25 * @param request
26 * @return write result.
27 * @throws DatabaseException
28 */
29 WriteResult write(WriteRequest request);
30
31 /**
32 * Performs a batch write operation on the database.
33 * Batch write provides transactional semantics. Either all operations
34 * succeed or none of them do.
35 * @param batch batch of write requests to execute as a transaction.
36 * @return result of executing the batch write operation.
37 */
38 List<OptionalResult<WriteResult, DatabaseException>> batchWrite(List<WriteRequest> batch);
39}