/** * @param QueryRequest $queryRequest * @return mixed * @throws OverlappingException * @throws WriteReadException */ public function updateSnapshot(QueryRequest $queryRequest) { // Mode 0 is the live mode $strategyFactory = new StrategyFactory(); $strategyFactory->setQueryValidator($this->queryValidator); $strategy = $strategyFactory->createStrategy(SnapshotService::LIVE_MODE); $results = $strategy->getResults($queryRequest); $duration = $strategy->getDuration(); $this->snapshotManager->init(); $this->snapshotManager->setQueryRequest($queryRequest); try { $this->snapshotManager->writeSnapshot($results); } catch (WriteReadException $e) { throw $e; } catch (IOException $e) { throw $e; } return $duration; }