-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfserve.h
62 lines (37 loc) · 1.13 KB
/
fserve.h
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
#ifndef __FSERVE__
#define __FSERVE__
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <linux/aio_abi.h>
#include <glib.h>
#define MAX_KEY_LENGTH 20
#define MAX_BUFFER_SIZE 1024
extern GHashTable* pendingKeyMap;
extern pthread_mutex_t eventTaskQueueMutex;
extern GQueue* eventTaskQueue;
extern int NUMBER_OF_WORKERS;
extern int epollFD;
extern int listenerSocketFD;
extern int * workerEpollFDArray;
extern pthread_mutex_t connectionNumberMutex;
extern unsigned long connectionNumber;
extern unsigned long workerTaskNumber;
extern unsigned long doneWorkerTaskNumber;
// Read from disk
int readFromDisk(char * fileName, size_t numberOfBytes, off_t offset);
// Write to disk
int writeToDisk(char *fileName, size_t numberOfBytes, off_t offset, void *data);
// Accept socket connection on the listening FD
//int acceptConnection();
// Read from socket
int readFromSocket(int fd);
// Write to socket
int writeToSocket(int fd);
// Close socket
int closeSocket(int fd);
// Connect to another host
int connectToHost(char * host, int port);
// Stream a file to an FD
int streamFile(int fd, char * fileName);
#endif //__FSERVE__