public boolean setCurrentFile(String streamFileName, long currentLineNum) throws IOException { if (fileMap.containsFile(streamFileName)) { currentFile = fileMap.getValue(streamFileName); setIterator(); this.currentLineNum = currentLineNum; LOG.debug("Set current file:" + currentFile + "currentLineNum:" + currentLineNum); openCurrentFile(false); return true; } else { LOG.info("Did not find current file." + streamFileName + " Trying to set next higher"); if (!setNextHigher(streamFileName)) { return false; } else { return true; } } }
public boolean initFromStart() throws IOException { initCurrentFile(); currentFile = fileMap.getFirstFile(); if (currentFile != null) { LOG.debug("CurrentFile:" + currentFile + " currentLineNum:" + currentLineNum); setIterator(); } return currentFile != null; }
public boolean initializeCurrentFile(Date timestamp) throws IOException { initCurrentFile(); this.timestamp = timestamp; currentFile = fileMap.getCeilingValue(getStreamFileName(streamName, timestamp)); if (currentFile != null) { setIterator(); LOG.debug("CurrentFile:" + currentFile + " currentLineNum:" + currentLineNum); } return currentFile != null; }
protected boolean setNextHigher(String currentFileName) throws IOException { LOG.debug("finding next higher for " + currentFileName); Path nextHigherFile = fileMap.getHigherValue(currentFileName); if (nextHigherFile != null) { currentFile = nextHigherFile; LOG.debug("Next higher entry:" + currentFile); setIterator(); openCurrentFile(true); return true; } return false; }
protected boolean nextFile() throws IOException { LOG.debug("In next file"); if (!setIterator()) { LOG.info("could not set iterator for currentfile"); return false; } Path nextFile = fileMap.getNext(); if (nextFile != null) { currentFile = nextFile; openCurrentFile(true); return true; } return false; }
public boolean initializeCurrentFile(PartitionCheckpoint checkpoint) throws IOException { initCurrentFile(); if (!isStreamFile(checkpoint.getFileName())) { LOG.info("The file " + checkpoint.getFileName() + " is not a " + "stream file"); return false; } this.checkpoint = checkpoint; LOG.debug("checkpoint:" + checkpoint); currentFile = fileMap.getValue(checkpoint.getFileName()); if (currentFile != null) { currentLineNum = checkpoint.getLineNum(); LOG.debug("CurrentFile:" + currentFile + " currentLineNum:" + currentLineNum); setIterator(); } return currentFile != null; }
protected boolean setIterator() { return fileMap.setIterator(currentFile); }
public void build() throws IOException { fileMap.build(); }
public boolean isBeforeStream(String fileName) throws IOException { return fileMap.isBefore(fileName); }
public boolean isEmpty() { return fileMap.isEmpty(); }