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;
16 import java.util.concurrent.atomic.AtomicLong;
19 * The RaftActorContext contains that portion of the RaftActors state that
20 * needs to be shared with it's behaviors. A RaftActorContext should NEVER be
21 * used in any actor context outside the RaftActor that constructed it.
23 public interface RaftActorContext {
25 * Create a new local actor
29 ActorRef actorOf(Props props);
32 * Create a actor selection
36 ActorSelection actorSelection(String path);
39 * Get the identifier for the RaftActor. This identifier represents the
40 * name of the actor whose common state is being shared. For example the
41 * id could be 'inventory'
42 * @return the identifier
47 * A reference to the RaftActor itself. This could be used to send messages
54 * Get the ElectionTerm information
57 ElectionTerm getTermInformation();
60 * index of highest log entry known to be
61 * committed (initialized to 0, increases
65 AtomicLong getCommitIndex();
68 * index of highest log entry applied to state
69 * machine (initialized to 0, increases
73 AtomicLong getLastApplied();
76 * @return A representation of the log
78 ReplicatedLog getReplicatedLog();
81 * @return The ActorSystem associated with this context
83 ActorSystem getActorSystem();