BUG-2184 Fix subtree filtering for identity-ref leaves
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / behaviors / RaftActorBehavior.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.behaviors;
10
11 import akka.actor.ActorRef;
12 import org.opendaylight.controller.cluster.raft.RaftState;
13
14 /**
15  * A RaftActorBehavior represents the specific behavior of a RaftActor
16  * <p>
17  * A RaftActor can behave as one of the following,
18  * <ul>
19  *     <li> Follower </li>
20  *     <li> Candidate </li>
21  *     <li> Leader </li>
22  * </ul>
23  * <p>
24  * In each of these behaviors the Raft Actor handles the same Raft messages
25  * differently.
26  */
27 public interface RaftActorBehavior extends AutoCloseable{
28     /**
29      * Handle a message. If the processing of the message warrants a state
30      * change then a new state should be returned otherwise this method should
31      * return the state for the current behavior.
32      *
33      * @param sender The sender of the message
34      * @param message A message that needs to be processed
35      *
36      * @return The new state or self (this)
37      */
38     RaftState handleMessage(ActorRef sender, Object message);
39
40     /**
41      * The state associated with a given behavior
42      *
43      * @return
44      */
45     RaftState state();
46
47     /**
48      *
49      * @return
50      */
51     String getLeaderId();
52 }