a78b8909503a5ca2b17713635fe9a58ee0dedd46
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / RaftActorContext.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.raft;
10
11 import akka.actor.ActorRef;
12 import akka.actor.ActorSelection;
13 import akka.actor.Props;
14
15 import java.util.concurrent.atomic.AtomicLong;
16
17 /**
18  * The RaftActorContext contains that portion of the RaftActors state that
19  * needs to be shared with it's behaviors. A RaftActorContext should NEVER be
20  * used in any actor context outside the RaftActor that constructed it.
21  */
22 public interface RaftActorContext {
23     /**
24      * Create a new local actor
25       * @param props
26      * @return
27      */
28     ActorRef actorOf(Props props);
29
30     /**
31      * Create a actor selection
32      * @param path
33      * @return
34      */
35     ActorSelection actorSelection(String path);
36
37     /**
38      * Get the identifier for the RaftActor. This identifier represents the
39      * name of the actor whose common state is being shared. For example the
40      * id could be 'inventory'
41      * @return the identifier
42      */
43     String getId();
44
45     /**
46      * A reference to the RaftActor itself. This could be used to send messages
47      * to the RaftActor
48      * @return
49      */
50     ActorRef getActor();
51
52     /**
53      * Get the ElectionTerm information
54      * @return
55      */
56     ElectionTerm getTermInformation();
57
58     /**
59      * index of highest log entry known to be
60      * committed (initialized to 0, increases
61      *    monotonically)
62      * @return
63      */
64     AtomicLong getCommitIndex();
65
66     /**
67      * index of highest log entry applied to state
68      * machine (initialized to 0, increases
69      *    monotonically)
70      * @return
71      */
72     AtomicLong getLastApplied();
73
74     /**
75      *
76      */
77     ReplicatedLog getReplicatedLog();
78 }

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