Skip to content

Commit

Permalink
KAA-1300: Add general general configuration description.
Browse files Browse the repository at this point in the history
  • Loading branch information
sashadidukh committed Aug 9, 2016
1 parent 1c57cc9 commit 131b17a
Show file tree
Hide file tree
Showing 51 changed files with 353 additions and 174 deletions.
Expand Up @@ -400,7 +400,7 @@ kaa_access_point_t *kaa_bootstrap_manager_get_bootstrap_access_point(kaa_bootstr
} else {
kaa_error_t error_code = get_next_bootstrap_access_point_index(protocol_id, 0, &index, &execute_failover);
if (error_code) {
KAA_LOG_FATAL(self->logger, error_code, "Error: No bootstrap servers's been found. Please regenerate SDK.");
KAA_LOG_FATAL(self->logger, error_code, "Error: No bootstrap services been found. Please regenerate SDK.");
return NULL;
}

Expand All @@ -425,7 +425,7 @@ kaa_error_t kaa_bootstrap_manager_handle_server_sync(kaa_bootstrap_manager_t *se
(void)extension_length;

KAA_RETURN_IF_NIL2(self, reader, KAA_ERR_BADPARAM);
KAA_LOG_INFO(self->logger, KAA_ERR_NONE, "Received bootstrap server sync: options %u, payload size %u", extension_options, extension_length);
KAA_LOG_INFO(self->logger, KAA_ERR_NONE, "Received bootstrap service sync: options %u, payload size %u", extension_options, extension_length);

kaa_list_clear(self->operations_access_points, destroy_operations_access_points);

Expand Down Expand Up @@ -555,7 +555,7 @@ kaa_error_t kaa_bootstrap_manager_on_access_point_failed(kaa_bootstrap_manager_t
kaa_error_t error_code = get_next_bootstrap_access_point_index(protocol_id, index_from, &next_index, &execute_failover);

if (error_code) {
KAA_LOG_FATAL(self->logger, error_code, "Error: No bootstrap servers's been found. Please regenerate SDK.");
KAA_LOG_FATAL(self->logger, error_code, "Error: No bootstrap services been found. Please regenerate SDK.");
return KAA_ERR_SDK_STOP;
}

Expand Down
Expand Up @@ -89,7 +89,7 @@ void BootstrapManager::useNextOperationsServer(const TransportProtocolId& protoc
case FailoverStrategyAction::RETRY:
{
std::size_t period = decision.getRetryPeriod();
KAA_LOG_WARN(boost::format("Attempt to receive operations server list will be made in %1% secs "
KAA_LOG_WARN(boost::format("Attempt to receive operations service list will be made in %1% secs "
"according to failover strategy decision.") % period);
retryTimer_.stop();
retryTimer_.start(period, [&] { receiveOperationsServerList(); });
Expand All @@ -112,7 +112,7 @@ void BootstrapManager::useNextOperationsServerByAccessPointId(std::int32_t id)
{
KAA_R_MUTEX_UNIQUE_DECLARE(lock, guard_);

KAA_LOG_DEBUG(boost::format("Going to use new operations server: access_point=0x%X") % id);
KAA_LOG_DEBUG(boost::format("Going to use new operations service: access_point=0x%X") % id);

auto servers = getOPSByAccessPointId(id);
if (servers.size() > 0) {
Expand Down Expand Up @@ -142,7 +142,7 @@ void BootstrapManager::setChannelManager(IKaaChannelManager* manager)
void BootstrapManager::onServerListUpdated(const std::vector<ProtocolMetaData>& operationsServers)
{
if (operationsServers.empty()) {
KAA_LOG_WARN("Received empty operations server list");
KAA_LOG_WARN("Received empty operations service list");

KaaFailoverReason failoverReason = KaaFailoverReason::NO_OPERATION_SERVERS_RECEIVED;
FailoverStrategyDecision decision = failoverStrategy_->onFailover(failoverReason);
Expand All @@ -153,14 +153,14 @@ void BootstrapManager::onServerListUpdated(const std::vector<ProtocolMetaData>&
case FailoverStrategyAction::RETRY:
{
std::size_t period = decision.getRetryPeriod();
KAA_LOG_WARN(boost::format("Attempt to receive operations server list will be made in %1% secs "
KAA_LOG_WARN(boost::format("Attempt to receive operations service list will be made in %1% secs "
"according to failover strategy decision.") % period);
retryTimer_.stop();
retryTimer_.start(period, [&] { receiveOperationsServerList(); });
break;
}
case FailoverStrategyAction::USE_NEXT_BOOTSTRAP:
KAA_LOG_WARN("Try next bootstrap server.");
KAA_LOG_WARN("Try next bootstrap service.");
channelManager_->onServerFailed(channelManager_->getChannelByTransportType(TransportType::BOOTSTRAP)->getServer(),
failoverReason);
break;
Expand All @@ -176,7 +176,7 @@ void BootstrapManager::onServerListUpdated(const std::vector<ProtocolMetaData>&

KAA_R_MUTEX_UNIQUE_DECLARE(lock, guard_);

KAA_LOG_INFO(boost::format("Received %1% new operations servers") % operationsServers.size());
KAA_LOG_INFO(boost::format("Received %1% new operations services") % operationsServers.size());

lastOperationsServers_.clear();
operationServers_.clear();
Expand Down
Expand Up @@ -96,7 +96,7 @@ void KaaChannelManager::onServerFailed(ITransportConnectionInfoPtr connectionInf
case FailoverStrategyAction::RETRY:
{
std::size_t period = decision.getRetryPeriod();
KAA_LOG_WARN(boost::format("Attempt to reconnect to first bootstrap server will be made in %1% secs "
KAA_LOG_WARN(boost::format("Attempt to reconnect to first bootstrap service will be made in %1% secs "
"according to failover strategy decision.") % period);
bsTransportId_ = connectionInfo->getTransportId();
retryTimer_.stop();
Expand Down Expand Up @@ -188,10 +188,10 @@ bool KaaChannelManager::addChannelToList(IDataChannelPtr channel)
channel->setServer(connectionInfo);
} else {
if (channel->getServerType() == ServerType::BOOTSTRAP) {
KAA_LOG_WARN(boost::format("Failed to find bootstrap server for channel \"%1%\" %2%")
KAA_LOG_WARN(boost::format("Failed to find bootstrap service for channel \"%1%\" %2%")
% channel->getId() % LoggingUtils::TransportProtocolIdToString(protocolId));
} else {
KAA_LOG_INFO(boost::format("Failed to find operations server for channel \"%1%\" %2%")
KAA_LOG_INFO(boost::format("Failed to find operations service for channel \"%1%\" %2%")
% channel->getId() % LoggingUtils::TransportProtocolIdToString(protocolId));
}
}
Expand Down
Expand Up @@ -38,7 +38,7 @@ class IBootstrapManager {
virtual void setFailoverStrategy(IFailoverStrategyPtr strategy) = 0;

/**
* Receives the latest list of servers from the bootstrap server.
* Receives the latest list of servers from the bootstrap service.
*/
virtual void receiveOperationsServerList() = 0;

Expand Down
Expand Up @@ -46,7 +46,7 @@ class ITransportConnectionInfo
virtual ServerType getServerType() = 0;

/**
* Retrieves the access point id (operations/bootstrap server id).
* Retrieves the access point id (operations/bootstrap service id).
*
* @return The access point id.
*/
Expand Down
Expand Up @@ -23,7 +23,7 @@
namespace kaa {

enum class KaaFailoverReason {
BOOTSTRAP_SERVERS_NA = 0, /*!< No accessible bootstrap servers. */
BOOTSTRAP_SERVERS_NA = 0, /*!< No accessible bootstrap services. */
NO_OPERATION_SERVERS_RECEIVED,
OPERATION_SERVERS_NA,
CURRENT_BOOTSTRAP_SERVER_NA,
Expand Down
2 changes: 1 addition & 1 deletion client/client-multi/client-cpp/kaa/log/ILogProcessor.hpp
Expand Up @@ -32,7 +32,7 @@ class ILogProcessor {
/**
* Called when log upload response arrived.
*
* \param response Response from operations server.
* \param response Response from operations service.
*/
virtual void onLogUploadResponse(const LogSyncResponse& response) = 0;

Expand Down
Expand Up @@ -190,7 +190,7 @@ protected void setClientState(State state) {

Map<TransportProtocolId, List<TransportConnectionInfo>> bootstrapServers = this.properties.getBootstrapServers();
if (bootstrapServers == null || bootstrapServers.isEmpty()) {
throw new RuntimeException("Unable to obtain list of bootstrap servers."); // NOSONAR
throw new RuntimeException("Unable to obtain list of bootstrap services."); // NOSONAR
}

for (Map.Entry<TransportProtocolId, List<TransportConnectionInfo>> cursor : bootstrapServers.entrySet()) {
Expand Down
Expand Up @@ -35,14 +35,14 @@
public interface BootstrapManager {

/**
* Receives the latest list of servers from the bootstrap server.
* Receives the latest list of services from the bootstrap service.
*
* @throws TransportException the transport exception
*/
void receiveOperationsServerList() throws TransportException;

/**
* Force switch to the next operations server that support given {@link TransportProtocolId}
* Force switch to the next operations service that support given {@link TransportProtocolId}
*
* @param transportId of the transport protocol.
* @param status failover status
Expand Down
Expand Up @@ -153,7 +153,7 @@ public synchronized void onProtocolListUpdated(List<ProtocolMetaData> list) {
mappedIterators.clear();

if (operationsServerList == null || operationsServerList.isEmpty()) {
LOG.trace("Received empty operations server list");
LOG.trace("Received empty operations service list");
resolveFailoverStatus(FailoverStatus.NO_OPERATION_SERVERS_RECEIVED);
return;
}
Expand Down Expand Up @@ -193,21 +193,21 @@ private void resolveFailoverStatus(FailoverStatus status) {
break;
case RETRY:
long retryPeriod = decision.getRetryPeriod();
LOG.warn("Attempt to receive operations server list will be made in {} ms, " +
LOG.warn("Attempt to receive operations service list will be made in {} ms, " +
"according to failover strategy decision", retryPeriod);
executorContext.getScheduledExecutor().schedule(new Runnable() {
@Override
public void run() {
try {
receiveOperationsServerList();
} catch (TransportException e) {
LOG.error("Error while receiving operations server list", e);
LOG.error("Error while receiving operations service list", e);
}
}
}, retryPeriod, TimeUnit.MILLISECONDS);
break;
case USE_NEXT_BOOTSTRAP:
LOG.warn("Trying to switch to the next bootstrap server according to failover strategy decision");
LOG.warn("Trying to switch to the next bootstrap service according to failover strategy decision");
retryPeriod = decision.getRetryPeriod();
failoverManager.onServerFailed(channelManager.getActiveServer(TransportType.BOOTSTRAP), status);
executorContext.getScheduledExecutor().schedule(new Runnable() {
Expand All @@ -216,7 +216,7 @@ public void run() {
try {
receiveOperationsServerList();
} catch (TransportException e) {
LOG.error("Error while receiving operations server list", e);
LOG.error("Error while receiving operations service list", e);
}
}
}, retryPeriod, TimeUnit.MILLISECONDS);
Expand Down
Expand Up @@ -15,6 +15,6 @@
*/

/**
* Provides implementation for bootstrap server communications
* Provides implementation for bootstrap service communications
*/
package org.kaaproject.kaa.client.bootstrap;
Expand Up @@ -41,7 +41,7 @@ public interface TransportConnectionInfo {
TransportProtocolId getTransportId();

/**
* Retrieves the access point id (operations/bootstrap server id)
* Retrieves the access point id (operations/bootstrap service id)
*
* @return access point id
*/
Expand Down
Expand Up @@ -51,7 +51,7 @@ public interface FailoverStrategy {
/**
* Use the {@link #getTimeUnit()} method to get current time unit.
*
* @return period of time after which will be made attempt to tweak bootstrap server.
* @return period of time after which will be made attempt to tweak bootstrap service.
*/
long getBootstrapServersRetryPeriod();

Expand Down
Expand Up @@ -145,14 +145,14 @@ private void addChannelToList(KaaDataChannel channel) {
} else {
if (lastServers != null && lastServers.isEmpty()) {
if (channel.getServerType() == ServerType.BOOTSTRAP) {
LOG.warn("Failed to find bootstrap server for channel [{}] type {}", channel.getId(),
LOG.warn("Failed to find bootstrap service for channel [{}] type {}", channel.getId(),
channel.getTransportProtocolId());
} else {
LOG.info("Failed to find operations server for channel [{}] type {}", channel.getId(),
LOG.info("Failed to find operations service for channel [{}] type {}", channel.getId(),
channel.getTransportProtocolId());
}
} else {
LOG.debug("list of servers is empty for channel [{}] type {}", channel.getId(), channel.getTransportProtocolId());
LOG.debug("list of services is empty for channel [{}] type {}", channel.getId(), channel.getTransportProtocolId());
}
}
}
Expand Down Expand Up @@ -270,7 +270,7 @@ public synchronized void onTransportConnectionInfoUpdated(TransportConnectionInf
return;
}
if (newServer.getServerType() == ServerType.OPERATIONS) {
LOG.info("Adding new operations server: {}", newServer);
LOG.info("Adding new operations service: {}", newServer);
lastServers.put(newServer.getTransportId(), newServer);
}

Expand All @@ -297,15 +297,15 @@ public synchronized void onServerFailed(final TransportConnectionInfo server, Fa
if (server.getServerType() == ServerType.BOOTSTRAP) {
final TransportConnectionInfo nextConnectionInfo = getNextBootstrapServer(server);
if (nextConnectionInfo != null) {
LOG.trace("Using next bootstrap server");
LOG.trace("Using next bootstrap service");
FailoverDecision decision = failoverManager.onFailover(FailoverStatus.CURRENT_BOOTSTRAP_SERVER_NA);
switch (decision.getAction()) {
case NOOP:
LOG.warn("No operation is performed according to failover strategy decision");
break;
case RETRY:
long retryPeriod = decision.getRetryPeriod();
LOG.warn("Attempt to reconnect to the current bootstrap server will be made in {} ms, " +
LOG.warn("Attempt to reconnect to the current bootstrap service will be made in {} ms, " +
"according to failover strategy decision", retryPeriod);
executorContext.getScheduledExecutor().schedule(new Runnable() {
@Override
Expand All @@ -316,7 +316,7 @@ public void run() {
break;
case USE_NEXT_BOOTSTRAP:
retryPeriod = decision.getRetryPeriod();
LOG.warn("Attempt to connect to the next bootstrap server will be made in {} ms, " +
LOG.warn("Attempt to connect to the next bootstrap service will be made in {} ms, " +
"according to failover strategy decision", retryPeriod);
executorContext.getScheduledExecutor().schedule(new Runnable() {
@Override
Expand All @@ -333,15 +333,15 @@ public void run() {
break;
}
} else {
LOG.trace("Can't find next bootstrap server");
LOG.trace("Can't find next bootstrap service");
FailoverDecision decision = failoverManager.onFailover(status);
switch (decision.getAction()) {
case NOOP:
LOG.warn("No operation is performed according to failover strategy decision");
break;
case RETRY:
long retryPeriod = decision.getRetryPeriod();
LOG.warn("Attempt to reconnect to first bootstrap server will be made in {} ms, " +
LOG.warn("Attempt to reconnect to first bootstrap service will be made in {} ms, " +
"according to failover strategy decision", retryPeriod);
executorContext.getScheduledExecutor().schedule(new Runnable() {
@Override
Expand Down
Expand Up @@ -29,7 +29,7 @@
*/
public interface UserAttachCallback {
/**
* Called when auth result is retrieved from operations server.
* Called when auth result is retrieved from operations service.
*
* @param response Result of user attaching
* @see UserAttachResponse
Expand Down
Expand Up @@ -78,7 +78,7 @@ - (instancetype)initWithPlatformContext:(id<KaaClientPlatformContext>)context de

NSDictionary *bootstrapServers = [self.properties bootstrapServers];
if ([bootstrapServers count] == 0) {
[NSException raise:NSInternalInconsistencyException format:@"Unable to obtain list of bootstrap servers"];
[NSException raise:NSInternalInconsistencyException format:@"Unable to obtain list of bootstrap services"];
}

for (NSMutableArray *serverList in bootstrapServers.allValues) {
Expand Down
Expand Up @@ -31,12 +31,12 @@
@protocol BootstrapManager

/**
* Receives the latest list of servers from the bootstrap server.
* Receives the latest list of servers from the bootstrap service.
*/
- (void)receiveOperationsServerList;

/**
* Force switch to the next operations server that support given <TransportProtocolId>
* Force switch to the next operations service that support given <TransportProtocolId>
*
* @param transportId id of the transport protocol.
* @param status failovers status that causes using of the next operation server.
Expand Down

0 comments on commit 131b17a

Please sign in to comment.