[go: up one dir, main page]

Menu

[r19]: / server / store.h  Maximize  Restore  History

Download this file

93 lines (69 with data), 1.5 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
#ifndef __STORE_H__
#define __STORE_H__
#include <routing.h>
#include <gmp.h>
#include <udt.h>
#include <log.h>
#include <conf.h>
#include <index.h>
class CStore
{
public:
CStore(const string& ip);
~CStore();
public:
int init(char* ip = NULL, int port = 0);
int run();
private:
struct Param1
{
CStore* s;
char ip[64];
int port;
int32_t id;
CCBMsg* msg;
};
struct Param2
{
CStore* s;
string fn; // filename
UDTSOCKET u;
int t; // TCP socket
int c; // connection type
int m; // file access mode
};
struct Param3
{
CStore* s;
string fn; // filename
string q; // query
UDTSOCKET u;
int t; // TCP socket
int c; // connection type
};
static void* run(void* s);
static void* process(void* p);
static void* fileHandler(void* p);
static void* SQLHandler(void* p);
private:
void updateOutLink();
void updateInLink();
int initLocalFile();
void updateNameIndex(int& next);
private:
int checkIndexLoc(const unsigned int& id);
private:
CRouting m_Router;
CGMP m_GMP;
CIndex m_LocalFile;
CIndex m_RemoteFile;
CNameIndex m_NameIndex;
string m_strLocalHost;
int m_iLocalPort;
static const int m_iKeySpace = 16;
string m_strHomeDir;
CAccessLog m_AccessLog;
CPerfLog m_PerfLog;
SECTORParam m_SysConfig;
};
#endif