summaryrefslogtreecommitdiff
path: root/cpp/src/IceStorm/Replica.h
blob: 7e131904bf16c77a555ab50a5ae4bcb287c8bca0 (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
42
43
44
45
46
47
48
49
50
// **********************************************************************
//
// Copyright (c) 2003-2012 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

#pragma once

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

namespace IceStormElection
{

struct GroupNodeInfo
{
    GroupNodeInfo(int i);
    GroupNodeInfo(int i, LogUpdate l, const Ice::ObjectPrx& o = Ice::ObjectPrx());
    bool operator<(const GroupNodeInfo& rhs) const;
    bool operator==(const GroupNodeInfo& rhs) const;
    //
    // COMPILER FIX: Clang using libc++ requires to define operator=
    //
#if defined(__clang__) && defined(_LIBCPP_VERSION)
	GroupNodeInfo& operator=(const GroupNodeInfo&);
#endif
    const int id;
    const LogUpdate llu;
    const Ice::ObjectPrx observer;
};

class Replica : virtual public IceUtil::Shared
{
public:

    ~Replica();

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

}