Skip to content
Snippets Groups Projects
Commit dbca39a1 authored by ajf5's avatar ajf5
Browse files

mapper complete for testing

parent 52524ca5
No related branches found
No related tags found
No related merge requests found
...@@ -33,3 +33,4 @@ ...@@ -33,3 +33,4 @@
Node Node
Node.dsym Node.dsym
Wc.dsym
APP := Node APP := Node
APP2 := Wc
INC_DIR := ./inc INC_DIR := ./inc
CFLAGS := -g -Wall -std=c++11 -I$(INC_DIR) CFLAGS := -g -Wall -std=c++11 -I$(INC_DIR)
LIBS := -lpthread LIBS := -lpthread
SRC_FILES := src/Node.cpp src/Messages.cpp src/Member.cpp src/UdpSocket.cpp src/Threads.cpp src/Utils.cpp src/Logger.cpp src/TcpSocket.cpp src/TestBench.cpp src/main.cpp src/HashRing.cpp src/FileObject.cpp SRC_FILES := src/Node.cpp src/Messages.cpp src/Member.cpp src/UdpSocket.cpp src/Threads.cpp src/Utils.cpp src/Logger.cpp src/TcpSocket.cpp src/TestBench.cpp src/main.cpp src/HashRing.cpp src/FileObject.cpp
SRC_FILES2 := mappers/wc.cpp src/Utils.cpp
.PHONY: clean .PHONY: clean
all: clean app all: clean app
map:
$(CXX) -o $(APP2) $(SRC_FILES2) $(CFLAGS) $(LIBS)
app: app:
$(CXX) -o $(APP) $(SRC_FILES) $(CFLAGS) $(LIBS) $(CXX) -o $(APP) $(SRC_FILES) $(CFLAGS) $(LIBS)
clean: clean:
$(RM) -f $(APP) *.o $(RM) -f $(APP) *.o
$(RM) -f $(APP2) *.o
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef MEMBER_H #ifndef MEMBER_H
#define MEMBER_H #define MEMBER_H
#include <iostream> #include <iostream>
#include <string> #include <string>
using namespace std; using namespace std;
...@@ -21,4 +21,4 @@ public: ...@@ -21,4 +21,4 @@ public:
}; };
#endif //MEMBER_H #endif //MEMBER_H
\ No newline at end of file
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
enum ModeType {ALL2ALL, GOSSIP}; enum ModeType {ALL2ALL, GOSSIP};
#endif //MODES_H #endif //MODES_H
\ No newline at end of file
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
#include <pthread.h> #include <pthread.h>
#include <time.h> #include <time.h>
#include <signal.h> #include <signal.h>
#include <unistd.h>
#include <dirent.h>
#include <sys/types.h>
#include "Messages.h" #include "Messages.h"
#include "Modes.h" #include "Modes.h"
...@@ -33,7 +36,7 @@ using namespace std; ...@@ -33,7 +36,7 @@ using namespace std;
#define N_b 5 // how many nodes GOSSIP want to use #define N_b 5 // how many nodes GOSSIP want to use
#define T_election 15 // in T_period #define T_election 15 // in T_period
#define T_switch 3 // in seconds #define T_switch 3 // in seconds
#define T_maples // lines to process #define T_maples 80 // lines to process
// //
void *runUdpServer(void *udpSocket); void *runUdpServer(void *udpSocket);
...@@ -76,10 +79,12 @@ public: ...@@ -76,10 +79,12 @@ public:
map<string, tuple<bool, bool, bool>> pendingRequestSent; //? map<string, tuple<bool, bool, bool>> pendingRequestSent; //?
//master properties for MAPLEJUICE //master properties for MAPLEJUICE
map<string, vector<tuple<string, string, string>>> mapleProccessing; //ip -> [ (file, chunk_start, originIP) ] map<string, vector<tuple<string, string, string>>> mapleProcessing; //ip -> [ (file, chunk_start, originIP) ]
map<string, tuple<long int, int>> fileSizes; //used so master can partition in the map phase tuple is (bytes, lines) map<string, tuple<long int, int>> fileSizes; //used so master can partition in the map phase tuple is (bytes, lines)
HashRing *mapleRing; HashRing *mapleRing;
map<string, vector<tuple<string, string>>> mapleSending; //originIP -> (file, chunk_start); map<string, vector<tuple<string, string>>> mapleSending; //originIP -> (file, chunk_start);
string mapleExe;
string sdfsPre;
Node(); Node();
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "MessageTypes.h" #include "MessageTypes.h"
#include "Messages.h" #include "Messages.h"
#include "Utils.h" #include "Utils.h"
#include "FileObject.h"
#ifdef __linux__ #ifdef __linux__
#include <bits/stdc++.h> #include <bits/stdc++.h>
#endif #endif
...@@ -41,7 +42,6 @@ using std::get; ...@@ -41,7 +42,6 @@ using std::get;
#define DEFAULT_TCP_BLKSIZE (128 * 1024) #define DEFAULT_TCP_BLKSIZE (128 * 1024)
#define BACKLOG 10 #define BACKLOG 10
#define TCPPORT "4950" #define TCPPORT "4950"
class TcpSocket { class TcpSocket {
public: public:
//tcp server directly handles PUTs. If put received, request from //tcp server directly handles PUTs. If put received, request from
...@@ -53,13 +53,13 @@ public: ...@@ -53,13 +53,13 @@ public:
queue<string> mapleMessages; //keeps track of sending queue<string> mapleMessages; //keeps track of sending
void bindServer(string port); void bindServer(string port);
void sendFile(string ip, string port, string localfilename, string sdfsfilename, string remoteLocalfilename); void sendFile(string ip, string port, string localfilename, string sdfsfilename, string remoteLocalfilename, string overwrite);
void sendLines(string ip, string port, string localfilename, int start, int end); void sendLines(string ip, string port, string execFile, string localFile, string prefix, int start, int end);
void sendMessage(string ip, string port, string message); void sendMessage(string ip, string port, string message);
int messageHandler(int sockfd, string payloadMessage, string returnID); int messageHandler(int sockfd, string payloadMessage, string returnID);
int createConnection(string ip, string port); int createConnection(string ip, string port);
TcpSocket(); TcpSocket();
private: private:
string getFileMetadata(int size, string checksum, string sdfsfilename, string localfilename, string remoteLocalfilename); string getFileMetadata(int size, string checksum, string sdfsfilename, string localfilename, string remoteLocalfilename, string overwrite);
}; };
#endif //TCPSOCKET_H #endif //TCPSOCKET_H
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