-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathDistributedSystem.hpp
More file actions
115 lines (98 loc) · 3.42 KB
/
DistributedSystem.hpp
File metadata and controls
115 lines (98 loc) · 3.42 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#ifndef GEODE_DISTRIBUTEDSYSTEM_H_
#define GEODE_DISTRIBUTEDSYSTEM_H_
/**
* @file
*/
#include <memory>
#include <geode/ExceptionTypes.hpp>
#include <geode/Properties.hpp>
#include <geode/internal/geode_globals.hpp>
namespace apache {
namespace geode {
namespace statistics {
class StatisticsManager;
} // namespace statistics
namespace client {
/**
* @class DistributedSystem DistributedSystem.hpp
* DistributedSystem encapsulates this applications "connection" into the
* Geode Java servers distributed system. In order to participate in the
* Geode Java servers distributed system, each application needs to connect to
* the DistributedSystem.
* Each application can only be connected to one DistributedSystem.
*/
class SystemProperties;
class DistributedSystemImpl;
class CacheRegionHelper;
class DistributedSystem {
/**
* @brief public methods
*/
public:
DistributedSystem() = delete;
~DistributedSystem() noexcept;
DistributedSystem(const DistributedSystem&) = delete;
DistributedSystem& operator=(const DistributedSystem&) = delete;
DistributedSystem(DistributedSystem&&);
DistributedSystem& operator=(DistributedSystem&&) = delete;
/**
* Initializes the Native Client system to be able to connect to the
* Geode Java servers. If the name string is empty, then the default
* "NativeDS" is used as the name of distributed system.
* @throws IllegalStateException if GEODE_NATIVE_HOME variable is not set and
* product installation directory cannot be determined
**/
static DistributedSystem create(
const std::string& name,
const std::shared_ptr<Properties>& configPtr = nullptr);
/**
* @brief connects from the distributed system
* @throws AlreadyConnectedException if this call has succeeded once before
*/
void connect();
/**
* @brief disconnect from the distributed system
* @throws IllegalStateException if not connected
*/
void disconnect();
/** Returns the SystemProperties that were used to create this instance of the
* DistributedSystem
* @return SystemProperties
*/
SystemProperties& getSystemProperties() const;
/** Returns the name that identifies the distributed system instance
* @return name
*/
const std::string& getName() const;
protected:
/**
* @brief constructors
*/
DistributedSystem(const std::string& name,
std::unique_ptr<SystemProperties> sysProps);
private:
std::unique_ptr<DistributedSystemImpl> m_impl;
friend class CacheRegionHelper;
friend class DistributedSystemImpl;
};
} // namespace client
} // namespace geode
} // namespace apache
#endif // GEODE_DISTRIBUTEDSYSTEM_H_