Switch CompositeModification to bypass thread-local streams
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / modification / Modification.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. 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.controller.cluster.datastore.modification;
10
11 import java.io.Externalizable;
12 import java.io.IOException;
13 import java.io.ObjectInput;
14 import java.io.ObjectOutput;
15 import org.opendaylight.controller.cluster.datastore.node.utils.stream.NormalizedNodeDataOutput;
16 import org.opendaylight.mdsal.dom.spi.store.DOMStoreWriteTransaction;
17 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
18
19 /**
20  * Represents a modification to the data store.
21  *
22  * <p>
23  * Simple modifications can be of type,
24  * <ul>
25  * <li> {@link org.opendaylight.controller.cluster.datastore.modification.WriteModification}
26  * <li> {@link org.opendaylight.controller.cluster.datastore.modification.MergeModification}
27  * <li> {@link org.opendaylight.controller.cluster.datastore.modification.DeleteModification}
28  * </ul>
29  *
30  * <p>
31  * Modifications can in turn be lumped into a single
32  * {@link org.opendaylight.controller.cluster.datastore.modification.CompositeModification}
33  * which can then be applied to a write transaction.
34  */
35 public interface Modification extends Externalizable {
36
37     byte COMPOSITE = 1;
38     byte WRITE = 2;
39     byte MERGE = 3;
40     byte DELETE = 4;
41
42     /**
43      * Apply the modification to the specified transaction.
44      *
45      * @param transaction the transaction
46      */
47     void apply(DOMStoreWriteTransaction transaction);
48
49     /**
50      * Apply the modification to the specified transaction.
51      *
52      * @param transaction the transaction
53      */
54     void apply(DataTreeModification transaction);
55
56     byte getType();
57
58     @Override
59     void writeExternal(ObjectOutput out) throws IOException;
60
61     @Override
62     void readExternal(ObjectInput in) throws IOException, ClassNotFoundException;
63
64     void writeTo(NormalizedNodeDataOutput out) throws IOException;
65 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.