Use memory-mapped segmented journal by default
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / ShardReadTransaction.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 package org.opendaylight.controller.cluster.datastore;
9
10 import static java.util.Objects.requireNonNull;
11
12 import akka.actor.ActorRef;
13 import org.opendaylight.controller.cluster.datastore.messages.DataExists;
14 import org.opendaylight.controller.cluster.datastore.messages.ReadData;
15
16 /**
17  * Actor for a shard read transaction.
18  *
19  * @author syedbahm
20  */
21 public class ShardReadTransaction extends ShardTransaction {
22     private final AbstractShardDataTreeTransaction<?> transaction;
23
24     public ShardReadTransaction(final AbstractShardDataTreeTransaction<?> transaction, final ActorRef shardActor,
25             final ShardStats shardStats) {
26         super(shardActor, shardStats, transaction.getIdentifier());
27         this.transaction = requireNonNull(transaction);
28     }
29
30     @Override
31     public void handleReceive(final Object message) {
32         if (ReadData.isSerializedType(message)) {
33             readData(transaction, ReadData.fromSerializable(message));
34         } else if (DataExists.isSerializedType(message)) {
35             dataExists(transaction, DataExists.fromSerializable(message));
36         } else {
37             super.handleReceive(message);
38         }
39     }
40
41     @Override
42     protected AbstractShardDataTreeTransaction<?> getDOMStoreTransaction() {
43         return transaction;
44     }
45
46     @Override
47     protected boolean returnCloseTransactionReply() {
48         return false;
49     }
50 }

©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.