New Package dealing with device rollback
[transportpce.git] / renderer / src / main / java / org / opendaylight / transportpce / renderer / provisiondevice / transaction / history / History.java
1 /*
2  * Copyright © 2024 Smartoptics and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.transportpce.renderer.provisiondevice.transaction.history;
10
11 import java.util.List;
12 import org.opendaylight.transportpce.renderer.provisiondevice.transaction.Transaction;
13 import org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete.Delete;
14
15 public interface History {
16
17     /**
18      * Add transaction.
19      *
20      * <p>
21      * Only accepts the transaction if this History
22      * object doesn't already contain the object.
23      *
24      * @return true if the transaction was added.
25      */
26     boolean add(Transaction transaction);
27
28     /**
29      * A list of transactions.
30      *
31      * <p>
32      * Will only accept unique transactions.
33      * @return true if all transactions was added. false if one or more transactions was rejected.
34      */
35     boolean add(List<Transaction> transactions);
36
37     /**
38      * Add an array of interface transactions.
39      *
40      * <p>
41      * Duplicate interface ids, null or empty strings
42      * are silently ignored.
43      * @return may return false
44      */
45     boolean addInterfaces(String nodeId, String interfaceId);
46
47     /**
48      * Add an array of interface transactions.
49      *
50      * <p>
51      * Duplicate interface ids, null or empty strings
52      * are silently ignored.
53      * @return may return false
54      */
55     boolean addInterfaces(String nodeId, String[] interfaceIds);
56
57     /**
58      * Add a list of interface transactions.
59      *
60      * <p>
61      * Duplicate interface ids, null or empty strings
62      * are silently ignored.
63      */
64     boolean addInterfaces(String nodeId, List<String> interfaceIds);
65
66     /**
67      * Rollback all transactions.
68      *
69      * <p>
70      * Typically, the transactions are rolled back in reverse
71      * order, but the implementing class may choose a different
72      * logic.
73      */
74     boolean rollback(Delete delete);
75
76 }