@Override public void onResume(ClientContext context) throws ResumeFailedException { underlying.onResume(context); this.masterKey = context.getPersistentMasterSecret(); baseSetup(masterKey); }
public void setupMasterSecret(MasterSecret persistentSecret) { if(clientContext.getPersistentMasterSecret() == null) clientContext.setPersistentMasterSecret(persistentSecret); persistentTempBucketFactory.setMasterSecret(persistentSecret); persistentRAFFactory.setMasterSecret(persistentSecret); }
public SplitFileFetcher(ClientGetter getter, DataInputStream dis, ClientContext context) throws StorageFormatException, ResumeFailedException, IOException { Logger.normal(this, "Resuming splitfile download for "+this); boolean completeViaTruncation = dis.readBoolean(); if(completeViaTruncation) { fileCompleteViaTruncation = new File(dis.readUTF()); if(!fileCompleteViaTruncation.exists()) throw new ResumeFailedException("Storage file does not exist: "+fileCompleteViaTruncation); callbackCompleteViaTruncation = (FileGetCompletionCallback) getter; long rafSize = dis.readLong(); if(fileCompleteViaTruncation.length() != rafSize) throw new ResumeFailedException("Storage file is not of the correct length"); // FIXME check against finalLength too, maybe we can finish straight away. this.raf = new PooledFileRandomAccessBuffer(fileCompleteViaTruncation, false, rafSize, null, -1, true); } else { this.raf = BucketTools.restoreRAFFrom(dis, context.persistentFG, context.persistentFileTracker, context.getPersistentMasterSecret()); fileCompleteViaTruncation = null; callbackCompleteViaTruncation = null; } this.parent = getter; this.cb = getter; this.persistent = true; this.realTimeFlag = parent.realTimeFlag(); token = dis.readLong(); this.blockFetchContext = getter.ctx; this.wantBinaryBlob = getter.collectingBinaryBlob(); // onResume() will do the rest. Logger.normal(this, "Resumed splitfile download for "+this); lastNotifiedStoreFetch = System.currentTimeMillis(); }
@Override public void onResume(ClientContext context) throws ResumeFailedException { underlyingBuffer.onResume(context); try { setup(context.getPersistentMasterSecret(), false); } catch (IOException e) { Logger.error(this, "Disk I/O error resuming: "+e, e); throw new ResumeFailedException(e); } catch (GeneralSecurityException e) { Logger.error(this, "Impossible security error resuming - maybe we lost a codec?: "+e, e); throw new ResumeFailedException(e); } }
extensionCheck = null; if(dis.readBoolean()) { initialMetadata = BucketTools.restoreFrom(dis, context.persistentFG, context.persistentFileTracker, context.getPersistentMasterSecret()); new DataInputStream(checker.checksumReaderWithLength(dis, context.tempBucketFactory, 65536)); try { returnBucketDirect = BucketTools.restoreFrom(innerDIS, context.persistentFG, context.persistentFileTracker, context.getPersistentMasterSecret()); } catch (IOException e) { Logger.error(this, "Failed to restore completed download-to-temp-space request, restarting instead");
context.memoryLimitedJobRunner, context.getJobRunner(true), context.ticker, context.getChkInsertScheduler(realTime).fetchingKeys(), context.persistentFG, context.persistentFileTracker, context.getPersistentMasterSecret()); storage.onResume(context); this.sender = new SplitFileInserterSender(this, storage);