Package freenet.store

Examples of freenet.store.PubkeyStore


    try {
      DSAPublicKey key = null;
      if(pubKeyClientcache != null && canReadClientCache)
        key = pubKeyClientcache.fetch(hash, false, false, meta);
      if(node.oldPKClientCache != null && canReadClientCache && key == null) {
        PubkeyStore pks = node.oldPKClientCache;
        if(pks != null) key = pks.fetch(hash, false, false, meta);
        if(key != null && logMINOR)
          Logger.minor(this, "Got "+HexUtil.bytesToHex(hash)+" from old client cache");
      }
      // We can *read* from the datastore even if nearby, but we cannot promote in that case.
      if(key == null) {
        key = pubKeyDatastore.fetch(hash, false, ignoreOldBlocks, meta);
        if(key != null && logMINOR)
          Logger.minor(this, "Got "+HexUtil.bytesToHex(hash)+" from store");
      }
      if(key == null) {
        PubkeyStore pks = node.oldPK;
        if(pks != null) key = pks.fetch(hash, false, ignoreOldBlocks, meta);
        if(key != null && logMINOR)
          Logger.minor(this, "Got "+HexUtil.bytesToHex(hash)+" from old store");
      }
      if (key == null) {
        key = pubKeyDatacache.fetch(hash, false, ignoreOldBlocks, meta);
        if(key != null && logMINOR)
          Logger.minor(this, "Got "+HexUtil.bytesToHex(hash)+" from cache");
      }
      if(key == null) {
        PubkeyStore pks = node.oldPKCache;
        if(pks != null) key = pks.fetch(hash, false, ignoreOldBlocks, meta);
        if(key != null && logMINOR)
          Logger.minor(this, "Got "+HexUtil.bytesToHex(hash)+" from old cache");
      }
      if(key == null && pubKeySlashdotcache != null && forULPR) {
        key = pubKeySlashdotcache.fetch(hash, false, ignoreOldBlocks, meta);
View Full Code Here


    maxSlashdotCacheKeys = (int) Math.min(maxSlashdotCacheSize / sizePerKey, Integer.MAX_VALUE);

    chkSlashdotcache = new CHKStore();
    chkSlashdotcacheStore = new SlashdotStore<CHKBlock>(chkSlashdotcache, maxSlashdotCacheKeys, slashdotCacheLifetime, PURGE_INTERVAL, ticker, this.clientCore.tempBucketFactory);
    pubKeySlashdotcache = new PubkeyStore();
    pubKeySlashdotcacheStore = new SlashdotStore<DSAPublicKey>(pubKeySlashdotcache, maxSlashdotCacheKeys, slashdotCacheLifetime, PURGE_INTERVAL, ticker, this.clientCore.tempBucketFactory);
    getPubKey.setLocalSlashdotcache(pubKeySlashdotcache);
    sskSlashdotcache = new SSKStore(getPubKey);
    sskSlashdotcacheStore = new SlashdotStore<SSKBlock>(sskSlashdotcache, maxSlashdotCacheKeys, slashdotCacheLifetime, PURGE_INTERVAL, ticker, this.clientCore.tempBucketFactory);
View Full Code Here

  }

  private void initRAMClientCacheFS() {
    chkClientcache = new CHKStore();
    new RAMFreenetStore<CHKBlock>(chkClientcache, (int) Math.min(Integer.MAX_VALUE, maxClientCacheKeys));
    pubKeyClientcache = new PubkeyStore();
    new RAMFreenetStore<DSAPublicKey>(pubKeyClientcache, (int) Math.min(Integer.MAX_VALUE, maxClientCacheKeys));
    sskClientcache = new SSKStore(getPubKey);
    new RAMFreenetStore<SSKBlock>(sskClientcache, (int) Math.min(Integer.MAX_VALUE, maxClientCacheKeys));
  }
View Full Code Here

  }

  private void initNoClientCacheFS() {
    chkClientcache = new CHKStore();
    new NullFreenetStore<CHKBlock>(chkClientcache);
    pubKeyClientcache = new PubkeyStore();
    new NullFreenetStore<DSAPublicKey>(pubKeyClientcache);
    sskClientcache = new SSKStore(getPubKey);
    new NullFreenetStore<SSKBlock>(sskClientcache);
  }
View Full Code Here

  private void initRAMFS() {
    chkDatastore = new CHKStore();
    new RAMFreenetStore<CHKBlock>(chkDatastore, (int) Math.min(Integer.MAX_VALUE, maxStoreKeys));
    chkDatacache = new CHKStore();
    new RAMFreenetStore<CHKBlock>(chkDatacache, (int) Math.min(Integer.MAX_VALUE, maxCacheKeys));
    pubKeyDatastore = new PubkeyStore();
    new RAMFreenetStore<DSAPublicKey>(pubKeyDatastore, (int) Math.min(Integer.MAX_VALUE, maxStoreKeys));
    pubKeyDatacache = new PubkeyStore();
    getPubKey.setDataStore(pubKeyDatastore, pubKeyDatacache);
    new RAMFreenetStore<DSAPublicKey>(pubKeyDatacache, (int) Math.min(Integer.MAX_VALUE, maxCacheKeys));
    sskDatastore = new SSKStore(getPubKey);
    new RAMFreenetStore<SSKBlock>(sskDatastore, (int) Math.min(Integer.MAX_VALUE, maxStoreKeys));
    sskDatacache = new SSKStore(getPubKey);
View Full Code Here

      final CHKStore chkDatastore = new CHKStore();
      final FreenetStore<CHKBlock> chkDataFS = makeStore("CHK", true, chkDatastore, dontResizeOnStart, masterKey);
      final CHKStore chkDatacache = new CHKStore();
      final FreenetStore<CHKBlock> chkCacheFS = makeStore("CHK", false, chkDatacache, dontResizeOnStart, masterKey);
      ((SaltedHashFreenetStore<CHKBlock>) chkCacheFS.getUnderlyingStore()).setAltStore(((SaltedHashFreenetStore<CHKBlock>) chkDataFS.getUnderlyingStore()));
      final PubkeyStore pubKeyDatastore = new PubkeyStore();
      final FreenetStore<DSAPublicKey> pubkeyDataFS = makeStore("PUBKEY", true, pubKeyDatastore, dontResizeOnStart, masterKey);
      final PubkeyStore pubKeyDatacache = new PubkeyStore();
      final FreenetStore<DSAPublicKey> pubkeyCacheFS = makeStore("PUBKEY", false, pubKeyDatacache, dontResizeOnStart, masterKey);
      ((SaltedHashFreenetStore<DSAPublicKey>) pubkeyCacheFS.getUnderlyingStore()).setAltStore(((SaltedHashFreenetStore<DSAPublicKey>) pubkeyDataFS.getUnderlyingStore()));
      final SSKStore sskDatastore = new SSKStore(getPubKey);
      final FreenetStore<SSKBlock> sskDataFS = makeStore("SSK", true, sskDatastore, dontResizeOnStart, masterKey);
      final SSKStore sskDatacache = new SSKStore(getPubKey);
View Full Code Here

  private void initSaltHashClientCacheFS(final String suffix, boolean dontResizeOnStart, byte[] clientCacheMasterKey) throws NodeInitException {

    try {
      final CHKStore chkClientcache = new CHKStore();
      final FreenetStore<CHKBlock> chkDataFS = makeClientcache("CHK", true, chkClientcache, dontResizeOnStart, clientCacheMasterKey);
      final PubkeyStore pubKeyClientcache = new PubkeyStore();
      final FreenetStore<DSAPublicKey> pubkeyDataFS = makeClientcache("PUBKEY", true, pubKeyClientcache, dontResizeOnStart, clientCacheMasterKey);
      final SSKStore sskClientcache = new SSKStore(getPubKey);
      final FreenetStore<SSKBlock> sskDataFS = makeClientcache("SSK", true, sskClientcache, dontResizeOnStart, clientCacheMasterKey);

      boolean delay =
View Full Code Here

  public void testSimpleSSK() throws IOException, KeyCollisionException, SSKVerifyException, KeyDecodeException, SSKEncodeException, InvalidCompressionCodecException {
    File f = new File(tempDir, "saltstore");
    FileUtil.removeAll(f);

    final int keys = 5;
    PubkeyStore pk = new PubkeyStore();
    new RAMFreenetStore<DSAPublicKey>(pk, keys);
    GetPubkey pubkeyCache = new SimpleGetPubkey(pk);
    SSKStore store = new SSKStore(pubkeyCache);
    SaltedHashFreenetStore<SSKBlock> saltStore = SaltedHashFreenetStore.construct(f, "testSaltedHashFreenetStoreSSK", store, weakPRNG, 20, false, SemiOrderedShutdownHook.get(), true, true, ticker, null);
    saltStore.start(null, true);
View Full Code Here

  private void checkOnCollisionsSSK(boolean useSlotFilter) throws IOException, SSKEncodeException, InvalidCompressionCodecException, SSKVerifyException, KeyDecodeException, KeyCollisionException {
    File f = new File(tempDir, "saltstore");
    FileUtil.removeAll(f);

    final int keys = 5;
    PubkeyStore pk = new PubkeyStore();
    new RAMFreenetStore<DSAPublicKey>(pk, keys);
    GetPubkey pubkeyCache = new SimpleGetPubkey(pk);
    SSKStore store = new SSKStore(pubkeyCache);
    SaltedHashFreenetStore<SSKBlock> saltStore = SaltedHashFreenetStore.construct(f, "testSaltedHashFreenetStoreOnCloseSSK", store, weakPRNG, 10, true, SemiOrderedShutdownHook.get(), true, true, ticker, null);
    saltStore.start(null, true);
View Full Code Here

TOP

Related Classes of freenet.store.PubkeyStore

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.