scalaris目录结构
1 +bin
2 +contrib
3 +data
4 +doc
5 +docroot
6 +docroot_node
7 +ebin
8 +include
9 +java-api
10 +log
11 +src
12 +test
13 +user-dev-guide
14 AUTHORS
15 bootstrap.sh
16 build.bat
17 configure
18 configure.ac
19 distr-archive.sh
20 Emakefile.in
21 LICENSE
22 Makefile.in
23 README
24 VERSION
2 +contrib
3 +data
4 +doc
5 +docroot
6 +docroot_node
7 +ebin
8 +include
9 +java-api
10 +log
11 +src
12 +test
13 +user-dev-guide
14 AUTHORS
15 bootstrap.sh
16 build.bat
17 configure
18 configure.ac
19 distr-archive.sh
20 Emakefile.in
21 LICENSE
22 Makefile.in
23 README
24 VERSION
1 +src目录
2 启动顺序为boot.erl->加载bin/boot_cs.app->boot_app->process_dictionary和boot_sup
3 boot_sup启动了Config,Logger,%Tracer,CommPort, FailureDetector, AdminServer,%XMLRPC, Node,YAWS, BenchServer, CSNode
2 启动顺序为boot.erl->加载bin/boot_cs.app->boot_app->process_dictionary和boot_sup
3 boot_sup启动了Config,Logger,%Tracer,CommPort, FailureDetector, AdminServer,%XMLRPC, Node,YAWS, BenchServer, CSNode
1 node.erl
2-record(node, {pid, id, uniqueId}).
3提供对node record的创建和访问的api
1 cs_state.erl
2 Chord算法中每个node需要保存的记录,
3 prenode, nextnode, 和finger table
4 -record(state, {routingtable, successor, predecessor, me, my_range, lb, deadnodes, join_time, trans_log, db}).
5 这个文件提供了对state记录访问的api
2 Chord算法中每个node需要保存的记录,
3 prenode, nextnode, 和finger table
4 -record(state, {routingtable, successor, predecessor, me, my_range, lb, deadnodes, join_time, trans_log, db}).
5 这个文件提供了对state记录访问的api
1 db_ets.erl
2 chord节点的数据库
3 每条记录的格式为{Key, {Value, WriteLock, ReadLock, Version}}
4 WriteLock = true | false
5 ReadLock = integer()
2 chord节点的数据库
3 每条记录的格式为{Key, {Value, WriteLock, ReadLock, Version}}
4 WriteLock = true | false
5 ReadLock = integer()
6 关于Key:Key就是Chord算法里的数据id,每个Chord节点负责保存 myid > Key > preid 的所有数据,当有新节点加入时,一部分数据会划分出去
1.comm_layer
comm_layer模块提供了进程间通信的接口,由{ip, port, pid}三元组标识一个进程,
相同机器之间通过erlang提供的 pid ! message进行发送
不同机器之间通过tcp发送,再由侦听进程通过 pid ! message 发送给本地进程
tcp连接在第一次发送消息时建立,之后一直保持连接.comm_layer会新建一个进程负责管理这个tcp连接
接口:comm_layer:send({Ip, Port, Pid}, Message).