0d1919657b707a93c86c551a83a17cc6131f365e
[vtn.git] /
1 /*
2  * Copyright (c) 2014, 2015 NEC Corporation. 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.vtn.manager.internal.packet.cache;
10
11 import org.opendaylight.vtn.manager.VTNException;
12 import org.opendaylight.vtn.manager.packet.Packet;
13
14 /**
15  * {@code CachedPacket} defines interfaces that implements cache for a
16  * {@link Packet} instance.
17  */
18 public interface CachedPacket extends Cloneable {
19     /**
20      * Return a {@link Packet} instance.
21      *
22      * <p>
23      *   Note that modification to this instance is not applied to the
24      *   returned until {@link #commit(CachedPacketContext)} is called.
25      * </p>
26      *
27      * @return  A {@link Packet} instance.
28      */
29     Packet getPacket();
30
31     /**
32      * Finalize modification to the packet.
33      *
34      * @param pctx  The runtime context for modifying packet.
35      * @return  {@code true} only if this packet is modified.
36      * @throws VTNException
37      *    Failed to copy the packet.
38      */
39     boolean commit(CachedPacketContext pctx) throws VTNException;
40
41     /**
42      * Return a deep copy of this instance.
43      *
44      * @return  A deep copy of this instance.
45      */
46     CachedPacket clone();
47 }