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.Props;
14 import akka.actor.UntypedActorContext;
16 import java.util.concurrent.atomic.AtomicLong;
18 public class RaftActorContextImpl implements RaftActorContext{
20 private final ActorRef actor;
22 private final UntypedActorContext context;
24 private final String id;
26 private final ElectionTerm termInformation;
28 private final AtomicLong commitIndex;
30 private final AtomicLong lastApplied;
32 private final ReplicatedLog replicatedLog;
34 public RaftActorContextImpl(ActorRef actor, UntypedActorContext context,
36 ElectionTerm termInformation, AtomicLong commitIndex,
37 AtomicLong lastApplied, ReplicatedLog replicatedLog) {
39 this.context = context;
41 this.termInformation = termInformation;
42 this.commitIndex = commitIndex;
43 this.lastApplied = lastApplied;
44 this.replicatedLog = replicatedLog;
47 public ActorRef actorOf(Props props){
48 return context.actorOf(props);
51 public ActorSelection actorSelection(String path){
52 return context.actorSelection(path);
55 public String getId() {
59 public ActorRef getActor() {
63 public ElectionTerm getTermInformation() {
64 return termInformation;
67 public AtomicLong getCommitIndex() {
71 public AtomicLong getLastApplied() {
75 @Override public ReplicatedLog getReplicatedLog() {