Skip to content
Snippets Groups Projects
Commit 11cab0a4 authored by KyleKlenk's avatar KyleKlenk
Browse files

added some more verbose output

parent 68831ad3
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@ behavior summa_backup_server_init(stateful_actor<summa_server_state>* self, Dist
self->set_down_handler([=](const down_msg& dm){
if (self->state.current_server_actor == self) {
aout(self) << "\n ******DOWN HANDLER CALLED******\n";
aout(self) << "Lost Connection With A Connected Actor\n";
std::optional<Client> client = self->state.client_container.getClient(dm.source);
if (client.has_value()) {
......@@ -93,7 +94,7 @@ void connecting_backup(stateful_actor<summa_server_state>* self, const std::stri
behavior summa_backup_server(stateful_actor<summa_server_state>* self, const actor& server_actor) {
aout(self) << "summa backup server has started\n";
aout(self) << "\nsumma backup server has started\n";
self->send(server_actor, connect_as_backup_v, self, self->state.hostname);
return {
......@@ -103,52 +104,52 @@ behavior summa_backup_server(stateful_actor<summa_server_state>* self, const act
},
[=](connect_as_backup) {
aout(self) << "We are now connected to the lead server\n";
aout(self) << "\nWe are now connected to the lead server\n";
},
// get the list of batches and clients from the lead server
[=](update_with_current_state, Batch_Container& batch_container, Client_Container& client_container) {
aout(self) << "Received the containers from the lead server\n";
aout(self) << "\nReceived the containers from the lead server\n";
self->state.batch_container = batch_container;
self->state.client_container = client_container;
},
// We have a new backup server that was added to the server
[=](update_backup_server_list, std::vector<std::tuple<caf::actor, std::string>> backup_servers) {
aout(self) << "Received the backup server list from the lead server\n";
aout(self) << "\nReceived the backup server list from the lead server\n";
aout(self) << "Backup Server List = " << backup_servers << std::endl;
self->state.backup_servers_list = backup_servers;
},
// New Client has been received
[=](new_client, caf::actor client_actor, std::string hostname) {
aout(self) << "Received a new client from the lead server\n";
aout(self) << "\nReceived a new client from the lead server\n";
self->monitor(client_actor);
self->state.client_container.addClient(client_actor, hostname);
},
// Lead server had client removed
[=](client_removed, Client& client) {
aout(self) << "Received a client removed message from the lead server\n";
aout(self) << "\nReceived a client removed message from the lead server\n";
self->state.client_container.removeClient(client);
},
// Client finished a batch and the lead server has sent an update
[=](done_batch, actor client_actor, Batch& batch) {
aout(self) << "Batch: " << batch.getBatchID() << " is done\n";
aout(self) << "\nBatch: " << batch.getBatchID() << " is done\n";
self->state.batch_container.updateBatch_success(batch);
},
// Client has been assigned new batch by the lead server
[=](new_assigned_batch, actor client_actor, Batch& batch) {
aout(self) << "New Batch: " << batch.getBatchID() << " has been assigned\n";
aout(self) << "\nNew Batch: " << batch.getBatchID() << " has been assigned\n";
self->state.batch_container.setBatchAssigned(batch);
self->state.client_container.setBatchForClient(client_actor, batch);
},
// Lead server has no more batches to distribute
[=](no_more_batches, actor client_actor) {
aout(self) << "No more batches to distribute\n";
aout(self) << "\nNo more batches to distribute\n";
self->state.client_container.setBatchForClient(client_actor, {});
},
......
......@@ -8,6 +8,7 @@ behavior summa_server_init(stateful_actor<summa_server_state>* self, Distributed
aout(self) << "Summa Server has Started \n";
self->set_down_handler([=](const down_msg& dm) {
aout(self) << "\n\n ********** DOWN HANDLER ********** \n";
aout(self) << "Lost Connection With A Connected Actor\n";
std::optional<Client> client = self->state.client_container.getClient(dm.source);
if (client.has_value()) {
......@@ -49,7 +50,7 @@ behavior summa_server(stateful_actor<summa_server_state>* self) {
// A message from a client requesting to connect
[=](connect_to_server, actor client_actor, std::string hostname) {
aout(self) << "Actor trying to connect with hostname " << hostname << "\n";
aout(self) << "\nActor trying to connect with hostname " << hostname << "\n";
// Check if the client is already connected
std::optional<Client> client = self->state.client_container.getClient(client_actor.address());
if (client.has_value()) {
......@@ -93,7 +94,7 @@ behavior summa_server(stateful_actor<summa_server_state>* self) {
},
[=](connect_as_backup, actor backup_server, std::string hostname) {
aout(self) << "Received Connection Request From a backup server " << hostname << "\n";
aout(self) << "\nReceived Connection Request From a backup server " << hostname << "\n";
self->monitor(backup_server);
// Check if the backup server is already connected
auto backup_server_iterator = find(self->state.backup_servers_list.begin(), self->state.backup_servers_list.end(), std::make_tuple(backup_server, hostname));
......@@ -104,7 +105,7 @@ behavior summa_server(stateful_actor<summa_server_state>* self) {
aout(self) << "Adding Backup Server to list\n";
self->state.backup_servers_list.push_back(std::make_tuple(backup_server, hostname));
}
self->send(backup_server, connect_as_backup_v); // confirm connection with sender
// Now we need to send the backup actor our current state
self->send(backup_server, update_with_current_state_v, self->state.batch_container, self->state.client_container);
......@@ -112,7 +113,7 @@ behavior summa_server(stateful_actor<summa_server_state>* self) {
},
[=](done_batch, actor client_actor, Batch& batch) {
aout(self) << "Received Completed Batch From Client\n";
aout(self) << "\nReceived Completed Batch From Client\n";
aout(self) << batch.toString() << "\n\n";\
Client client = self->state.client_container.getClient(client_actor.address()).value();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment