- changed seed file storage to clear text

- fixed kill script
- fixed saving of seed file (had been corrupted by latest changes)
- some refactoring

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4799 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
orbiter 2008-05-14 20:30:44 +00:00
parent 5fde679acb
commit 78087da287
9 changed files with 23 additions and 44 deletions

View File

@ -435,14 +435,6 @@ browserPopUpTrigger=true
browserPopUpPage=Status.html
browserPopUpApplication=netscape
# the proxy saves it's own seed information. It is positive for the network if
# the seed does not change it's configuration often (or not at all).
# The reason for that is that the seed hash is the target for the
# distributed hash table distribution function.
# The following file will contain the saved seed:
yacyOwnSeedFile=DATA/YACYDB/mySeed.txt
yacyDB=DATA/YACYDB
# index sharing attributes: by default, sharing is on.
# If you want to use YaCy only for local indexing (robinson mode),
# you may switch this off

View File

@ -4,7 +4,7 @@
# To stop YaCy, use stopYACY.sh
cd `dirname $0`
PID=`fuser DATA/LOG/yacy00.log | awk '{print $2}'`
PID=`fuser DATA/LOG/yacy00.log | awk '{print $1}'`
echo "process-id is " $PID
kill -3 $PID
sleep 1

View File

@ -627,8 +627,6 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<plasmaSwitchbo
* <p>Name of the setting how many active crawler-threads may maximal be running on the same time</p>
*/
public static final String CRAWLER_THREADS_ACTIVE_MAX = "crawler.MaxActiveThreads";
public static final String OWN_SEED_FILE = "yacyOwnSeedFile";
public static final String YACY_MODE_DEBUG = "yacyDebugMode";
public static final String WORDCACHE_INIT_COUNT = "wordCacheInitCount";
/**
@ -814,11 +812,6 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<plasmaSwitchbo
* @see bookmarksDB for more detailed overview about the bookmarks structure
*/
public static final String DBFILE_BOOKMARKS_DATES = "bookmarkDates.db";
/**
* <p><code>public static final String <strong>DBFILE_OWN_SEED</strong> = "mySeed.txt"</code></p>
* <p>Name of the file containing the database holding this peer's seed</p>
*/
public static final String DBFILE_OWN_SEED = "mySeed.txt";
/**
* <p><code>public static final String <strong>DBFILE_CRAWL_PROFILES</strong> = "crawlProfiles0.db"</code>
* <p>Name of the file containing the database holding all recent crawl profiles</p>
@ -2057,14 +2050,6 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<plasmaSwitchbo
}
}
/**
* Creates a new File instance with absolute path of ours Seed File.<br>
* @return a new File instance
*/
public File getOwnSeedFile() {
return getConfigPath(OWN_SEED_FILE, DBFILE_OWN_SEED);
}
/**
* With this function the crawling process can be paused
* @param jobType

View File

@ -120,7 +120,7 @@ public final class plasmaWordIndex implements indexRI {
// create or init seed cache
File networkRoot = new File(this.primaryRoot, "NETWORK");
networkRoot.mkdirs();
File mySeedFile = new File(networkRoot, "mySeed.txt");
File mySeedFile = new File(networkRoot, yacySeedDB.DBFILE_OWN_SEED);
File oldSeedFile = new File(new File(indexPrimaryRoot.getParentFile(), "YACYDB"), "mySeed.txt");
if (oldSeedFile.exists()) oldSeedFile.renameTo(mySeedFile);
seedDB = new yacySeedDB(

View File

@ -117,7 +117,6 @@ public class yacyCore {
// create a peer news channel
RSSFeed peernews = RSSFeed.channels(RSSFeed.PEERNEWS);
peernews.setMaxsize(1000);
peernews.addMessage(new RSSMessage("YaCy started", "", ""));
loadSeedUploadMethods();
@ -406,7 +405,7 @@ public class yacyCore {
// going through the peer list and starting a new publisher thread for each peer
int i = 0;
while (si. hasNext()) {
while (si.hasNext()) {
seed = (yacySeed) si.next();
if (seed == null) {
sync.P();
@ -503,17 +502,15 @@ public class yacyCore {
log.logInfo("PeerPing: No data, staying at myType: " + sb.wordIndex.seedDB.mySeed().orVirgin());
}
if (newSeeds >= 0) {
// success! we have published our peer to a senior peer
// update latest news from the other peer
// log.logInfo("publish: handshaked " + t.seed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) + " peer '" + t.seed.getName() + "' at " + t.seed.getAddress());
peerActions.saveMySeed();
return newSeeds;
}
// success! we have published our peer to a senior peer
// update latest news from the other peer
// log.logInfo("publish: handshaked " + t.seed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) + " peer '" + t.seed.getName() + "' at " + t.seed.getAddress());
sb.wordIndex.seedDB.saveMySeed();
// if we have an address, we do nothing
if (sb.wordIndex.seedDB.mySeed().isProper() == null && !force) { return 0; }
if (newSeeds > 0) return newSeeds;
// still no success: ask own NAT or internet responder
//final boolean DI604use = switchboard.getConfig("DI604use", "false").equals("true");
//final String DI604pw = switchboard.getConfig("DI604pw", "");
@ -526,7 +523,7 @@ public class yacyCore {
sb.wordIndex.seedDB.mySeed().put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR); // to start bootstraping, we need to be recognised as PEERTYPE_SENIOR peer
log.logInfo("publish: no recipient found, our address is " +
((sb.wordIndex.seedDB.mySeed().getPublicAddress() == null) ? "unknown" : sb.wordIndex.seedDB.mySeed().getPublicAddress()));
peerActions.saveMySeed();
sb.wordIndex.seedDB.saveMySeed();
return 0;
} catch (InterruptedException e) {
try {

View File

@ -263,7 +263,6 @@ public class yacyNewsPool {
private yacyNewsQueue outgoingNews, publishedNews, incomingNews, processedNews;
private int maxDistribution;
public yacyNewsPool(File yacyDBPath) {
newsDB = new yacyNewsDB(new File(yacyDBPath, "news.db"));
outgoingNews = new yacyNewsQueue(new File(yacyDBPath, "newsOut.stack"), newsDB);

View File

@ -127,12 +127,6 @@ public class yacyPeerActions {
seedDB.mySeed().setFlagAcceptRemoteIndex(sb.getConfig("allowReceiveIndex", "").equals("true"));
//mySeed.setFlagAcceptRemoteIndex(true);
}
public void saveMySeed() {
try {
seedDB.mySeed().save(sb.getOwnSeedFile());
} catch (IOException e) {}
}
public void loadSeedLists() {
// uses the superseed to initialize the database with known seeds

View File

@ -875,7 +875,7 @@ public class yacySeed {
}
public final void save(File f) throws IOException {
final String out = this.genSeedStr('z', null);
final String out = this.genSeedStr('p', null);
final FileWriter fw = new FileWriter(f);
fw.write(out, 0, out.length());
fw.close();

View File

@ -93,6 +93,12 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {
public static final int commonHashLength = 12;
public static final int dhtActivityMagic = 32;
/**
* <p><code>public static final String <strong>DBFILE_OWN_SEED</strong> = "mySeed.txt"</code></p>
* <p>Name of the file containing the database holding this peer's seed</p>
*/
public static final String DBFILE_OWN_SEED = "mySeed.txt";
public static final String[] sortFields = new String[] {yacySeed.LCOUNT, yacySeed.ICOUNT, yacySeed.UPTIME, yacySeed.VERSION, yacySeed.LASTSEEN};
public static final String[] longaccFields = new String[] {yacySeed.LCOUNT, yacySeed.ICOUNT, yacySeed.ISPEED};
public static final String[] doubleaccFields = new String[] {yacySeed.RSPEED};
@ -215,6 +221,12 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {
} catch (IOException e) {}
}
public void saveMySeed() {
try {
this.mySeed().save(myOwnSeedFile);
} catch (IOException e) {}
}
public boolean noDHTActivity() {
// for small networks, we don't perform DHT transmissions, because it is possible to search over all peers
return this.sizeConnected() <= dhtActivityMagic;