Madan Jampani | 08822c4 | 2014-11-04 17:17:46 -0800 | [diff] [blame] | 1 | package org.onlab.onos.store.service.impl; |
| 2 | |
| 3 | import org.onlab.onos.store.service.WriteResult; |
| 4 | |
Madan Jampani | 686fa18 | 2014-11-04 23:16:27 -0800 | [diff] [blame] | 5 | /** |
| 6 | * Result of a write operation executed on the DatabaseStateMachine. |
| 7 | */ |
Madan Jampani | 08822c4 | 2014-11-04 17:17:46 -0800 | [diff] [blame] | 8 | public class InternalWriteResult { |
| 9 | |
| 10 | public enum Status { |
| 11 | OK, |
| 12 | ABORTED, |
| 13 | NO_SUCH_TABLE, |
Yuta HIGUCHI | 361664e | 2014-11-06 17:28:47 -0800 | [diff] [blame] | 14 | PREVIOUS_VERSION_MISMATCH, |
Madan Jampani | 08822c4 | 2014-11-04 17:17:46 -0800 | [diff] [blame] | 15 | PREVIOUS_VALUE_MISMATCH |
| 16 | } |
| 17 | |
| 18 | private final Status status; |
| 19 | private final WriteResult result; |
| 20 | |
Yuta HIGUCHI | 361664e | 2014-11-06 17:28:47 -0800 | [diff] [blame] | 21 | public static InternalWriteResult ok(WriteResult result) { |
| 22 | return new InternalWriteResult(Status.OK, result); |
| 23 | } |
| 24 | |
Madan Jampani | 08822c4 | 2014-11-04 17:17:46 -0800 | [diff] [blame] | 25 | public InternalWriteResult(Status status, WriteResult result) { |
| 26 | this.status = status; |
| 27 | this.result = result; |
| 28 | } |
| 29 | |
| 30 | public Status status() { |
| 31 | return status; |
| 32 | } |
| 33 | |
| 34 | public WriteResult result() { |
| 35 | return result; |
| 36 | } |
| 37 | } |