Rewrite of the file model and pulling mechanism. Needs lots of cleanup and bugfixes, now...
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
"io/ioutil"
|
||||
mr "math/rand"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -27,7 +27,7 @@ func main() {
|
||||
|
||||
for i := 0; i < files; i++ {
|
||||
n := name()
|
||||
p0 := path.Join(string(n[0]), n[0:2])
|
||||
p0 := filepath.Join(string(n[0]), n[0:2])
|
||||
os.MkdirAll(p0, 0755)
|
||||
s := 1 << uint(mr.Intn(maxexp))
|
||||
a := 128 * 1024
|
||||
@@ -37,7 +37,7 @@ func main() {
|
||||
s += mr.Intn(a)
|
||||
b := make([]byte, s)
|
||||
rand.Reader.Read(b)
|
||||
p1 := path.Join(p0, n)
|
||||
p1 := filepath.Join(p0, n)
|
||||
ioutil.WriteFile(p1, b, 0644)
|
||||
|
||||
os.Chmod(p1, os.FileMode(mr.Intn(0777)|0400))
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<configuration version="1">
|
||||
<repository directory="s1">
|
||||
<node id="I6KAH7666SLLL5PFXSOAUFJCDZYAOMLEKCP2GB3BV5RQST3PSROA" name="s1">
|
||||
<address>dynamic</address>
|
||||
<address>127.0.0.1:22001</address>
|
||||
</node>
|
||||
<node id="JMFJCXBGZDE4BOCJE3VF65GYZNAIVJRET3J6HMRAUQIGJOFKNHMQ" name="s2">
|
||||
<address>dynamic</address>
|
||||
<address>127.0.0.1:22002</address>
|
||||
</node>
|
||||
<node id="373HSRPQLPNLIJYKZVQFP4PKZ6R2ZE6K3YD442UJHBGBQGWWXAHA" name="s3">
|
||||
<address>dynamic</address>
|
||||
<address>127.0.0.1:22003</address>
|
||||
</node>
|
||||
</repository>
|
||||
<options>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<configuration version="1">
|
||||
<repository directory="s2">
|
||||
<node id="I6KAH7666SLLL5PFXSOAUFJCDZYAOMLEKCP2GB3BV5RQST3PSROA" name="s1">
|
||||
<address>dynamic</address>
|
||||
<address>127.0.0.1:22001</address>
|
||||
</node>
|
||||
<node id="JMFJCXBGZDE4BOCJE3VF65GYZNAIVJRET3J6HMRAUQIGJOFKNHMQ" name="s2">
|
||||
<address>dynamic</address>
|
||||
<address>127.0.0.1:22002</address>
|
||||
</node>
|
||||
<node id="373HSRPQLPNLIJYKZVQFP4PKZ6R2ZE6K3YD442UJHBGBQGWWXAHA" name="s3">
|
||||
<address>dynamic</address>
|
||||
<address>127.0.0.1:22003</address>
|
||||
</node>
|
||||
</repository>
|
||||
<options>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<configuration version="1">
|
||||
<repository directory="s3">
|
||||
<node id="I6KAH7666SLLL5PFXSOAUFJCDZYAOMLEKCP2GB3BV5RQST3PSROA" name="s1">
|
||||
<address>dynamic</address>
|
||||
<address>127.0.0.1:22001</address>
|
||||
</node>
|
||||
<node id="JMFJCXBGZDE4BOCJE3VF65GYZNAIVJRET3J6HMRAUQIGJOFKNHMQ" name="s2">
|
||||
<address>dynamic</address>
|
||||
<address>127.0.0.1:22002</address>
|
||||
</node>
|
||||
<node id="373HSRPQLPNLIJYKZVQFP4PKZ6R2ZE6K3YD442UJHBGBQGWWXAHA" name="s3">
|
||||
<address>dynamic</address>
|
||||
<address>127.0.0.1:22003</address>
|
||||
</node>
|
||||
</repository>
|
||||
<options>
|
||||
|
||||
@@ -68,25 +68,17 @@ for i in 1 2 3 ; do
|
||||
../genfiles -maxexp 22 -files 600
|
||||
echo " $i: empty file"
|
||||
touch "empty-$i"
|
||||
echo " $i: common file"
|
||||
dd if=/dev/urandom of=common bs=1000 count=1000 2>/dev/null
|
||||
echo " $i: large file"
|
||||
dd if=/dev/urandom of=large-$i bs=1024k count=55 2>/dev/null
|
||||
popd >/dev/null
|
||||
done
|
||||
|
||||
# instance 1 common file should be the newest, the other should disappear
|
||||
sleep 2
|
||||
touch "s1/common"
|
||||
|
||||
echo "MD5-summing..."
|
||||
for i in 1 2 3 ; do
|
||||
pushd "s$i" >/dev/null
|
||||
../md5r -l > ../md5-$i
|
||||
popd >/dev/null
|
||||
done
|
||||
grep -v common md5-2 > t ; mv t md5-2
|
||||
grep -v common md5-3 > t ; mv t md5-3
|
||||
|
||||
testConvergence
|
||||
|
||||
|
||||
Reference in New Issue
Block a user