/** * Tests if the <code>DeletionInfoPacket</code> contains a given DHT key. * @param dhtKey * @return <code>true</code> if the packet containes the DHT key, <code>false</code> otherwise. */ public boolean contains(Hash dhtKey) { return getEntry(dhtKey) != null; }
@Override public UniqueId getDeleteAuthorization(Hash dhtKey) { String delFileName = getDeletionFileName(dhtKey); DeletionInfoPacket delInfo = createDelInfoPacket(delFileName); if (delInfo != null) { DeletionRecord delRecord = delInfo.getEntry(dhtKey); if (delRecord != null) return delRecord.delAuthorization; } return null; }
@Override public DeleteRequest storeAndCreateDeleteRequest(DhtStorablePacket packetToStore) { if (!(packetToStore instanceof EncryptedEmailPacket)) throw new IllegalArgumentException("Invalid packet type: " + packetToStore.getClass().getSimpleName() + "; this folder only stores packets of type " + EncryptedEmailPacket.class.getSimpleName() + "."); DeleteRequest delRequest = null; // read the deletion info file for the email packet's DHT key Hash dhtKey = packetToStore.getDhtKey(); String delFileName = getDeletionFileName(dhtKey); DeletionInfoPacket delInfo = createDelInfoPacket(delFileName); if (delInfo != null) { DeletionRecord delRecord = delInfo.getEntry(dhtKey); if (delRecord != null) delRequest = new EmailPacketDeleteRequest(delRecord.dhtKey, delRecord.delAuthorization); } else // if the DHT key has not been recorded as deleted, store the email packet store(packetToStore); return delRequest; } }
delRequest = null; for (IndexPacketEntry entry: indexPacketToStore) { DeletionRecord delRecord = delInfo.getEntry(entry.emailPacketKey); if (delRecord != null) {
if (response instanceof DeletionInfoPacket) { DeletionInfoPacket delInfo = (DeletionInfoPacket)response; DeletionRecord delRecord = delInfo.getEntry(dhtKey); if (delRecord != null) { boolean valid = Util.isDeleteAuthorizationValid(verificationHash, delRecord.delAuthorization);