summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/AdminCallbackRouter.h
blob: 7e8184408c70179d4545be91970137bc0d7e7dfa (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
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//

#ifndef ICE_GRID_ADMIN_CALLBACK_ROUTER_H
#define ICE_GRID_ADMIN_CALLBACK_ROUTER_H

#include <Ice/Ice.h>
#include <IceUtil/IceUtil.h>
#include <map>

namespace IceGrid
{

//
// The AdminCallbackRouter routes callbacks from the servers, nodes etc. to the
// admin clients using the admin-client => registry connection.
//

class AdminCallbackRouter : public Ice::BlobjectArrayAsync
{
public:

    void addMapping(const std::string&, const std::shared_ptr<Ice::Connection>&);
    void removeMapping(const std::string&);

    void ice_invokeAsync(std::pair<const Ice::Byte*, const Ice::Byte*>,
                         std::function<void(bool, const std::pair<const Ice::Byte*, const Ice::Byte*>&)>,
                         std::function<void(std::exception_ptr)>,
                         const Ice::Current& current) override;

private:

    std::mutex _mutex;
    std::map<std::string, std::shared_ptr<Ice::Connection>> _categoryToConnection;
};

}

#endif