2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.controller.cluster.raft;
11 import akka.actor.ActorRef;
12 import akka.actor.ActorSelection;
13 import akka.actor.ActorSystem;
14 import akka.actor.Props;
17 * The RaftActorContext contains that portion of the RaftActors state that
18 * needs to be shared with it's behaviors. A RaftActorContext should NEVER be
19 * used in any actor context outside the RaftActor that constructed it.
21 public interface RaftActorContext {
23 * Create a new local actor
27 ActorRef actorOf(Props props);
30 * Create a actor selection
34 ActorSelection actorSelection(String path);
37 * Get the identifier for the RaftActor. This identifier represents the
38 * name of the actor whose common state is being shared. For example the
39 * id could be 'inventory'
40 * @return the identifier
45 * A reference to the RaftActor itself. This could be used to send messages
52 * Get the ElectionTerm information
55 ElectionTerm getTermInformation();
58 * index of highest log entry known to be
59 * committed (initialized to 0, increases
63 long getCommitIndex();
69 void setCommitIndex(long commitIndex);
72 * index of highest log entry applied to state
73 * machine (initialized to 0, increases
77 long getLastApplied();
83 void setLastApplied(long lastApplied);
86 * @return A representation of the log
88 ReplicatedLog getReplicatedLog();
91 * @return The ActorSystem associated with this context
93 ActorSystem getActorSystem();