summaryrefslogtreecommitdiff
path: root/cpp/src/IceStorm/Replica.h
blob: 5f3d742231515e713efea686c7013b98159ece15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//

#ifndef REPLICA_H
#define REPLICA_H

#include <Ice/Ice.h>
#include <IceStorm/Election.h>
#include <set>

namespace IceStormElection
{

struct GroupNodeInfo
{
    explicit GroupNodeInfo(int i);
    GroupNodeInfo(int i, LogUpdate l, std::shared_ptr<Ice::ObjectPrx> o = nullptr);

    bool operator<(const GroupNodeInfo& rhs) const;
    bool operator==(const GroupNodeInfo& rhs) const;

    const int id;
    const LogUpdate llu;
    const std::shared_ptr<Ice::ObjectPrx> observer;
};

class Replica
{
public:

    virtual LogUpdate getLastLogUpdate() const = 0;
    virtual void sync(const std::shared_ptr<Ice::ObjectPrx>&) = 0;
    virtual void initMaster(const std::set<IceStormElection::GroupNodeInfo>&, const LogUpdate&) = 0;
    virtual std::shared_ptr<Ice::ObjectPrx> getObserver() const = 0;
    virtual std::shared_ptr<Ice::ObjectPrx> getSync() const = 0;
};

}

#endif // RELICA_H