@Override public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) { synchronized (copies) { return new SourceSwitchingIterator(source.getDeepCopyDataSource(env), onlySwitchAfterRow, copies); } }
private synchronized boolean switchNow() throws IOException { if (closed.get()) return false; ssi.switchNow(); return true; }
public void switchNow() throws IOException { synchronized (copies) { for (SourceSwitchingIterator ssi : copies) ssi._switchNow(); } }
@Override public void next() throws IOException { synchronized (copies) { readNext(false); } }
private void _switchNow() throws IOException { if (onlySwitchAfterRow) throw new IllegalStateException("Can only switch on row boundries"); if (switchSource()) { if (key != null) { iter.seek(new Range(key, true, range.getEndKey(), range.isEndKeyInclusive()), columnFamilies, inclusive); } } }
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { synchronized (copies) { this.range = range; this.inclusive = inclusive; this.columnFamilies = columnFamilies; if (iter == null) { iter = source.iterator(); if (!onlySwitchAfterRow && yield.isPresent()) { iter.enableYielding(yield.get()); } } readNext(true); } }
boolean seekNeeded = yielded || (!onlySwitchAfterRow && switchSource()) || initialSeek; if (onlySwitchAfterRow && iter.hasTop() && !source.isCurrent() && !key.getRowData().equals(iter.getTopKey().getRowData())) { switchSource(); iter.seek(new Range(key.followingKey(PartialKey.ROW), true, range.getEndKey(), range.isEndKeyInclusive()), columnFamilies, inclusive);
public synchronized MemoryIterator skvIterator(SamplerConfigurationImpl iteratorSamplerConfig) { if (map == null) throw new NullPointerException(); if (deleted) throw new IllegalStateException("Can not obtain iterator after map deleted"); int mc = kvCount.get(); MemoryDataSource mds = new MemoryDataSource(iteratorSamplerConfig); // TODO seems like a bug that two MemoryDataSources are created... may need to fix in older // branches SourceSwitchingIterator ssi = new SourceSwitchingIterator(mds); MemoryIterator mi = new MemoryIterator(new PartialMutationSkippingIterator(ssi, mc)); mi.setSSI(ssi); mi.setMDS(mds); activeIters.add(mi); return mi; }
private synchronized boolean switchNow() throws IOException { if (closed.get()) return false; ssi.switchNow(); return true; }
@Override public void next() throws IOException { synchronized (copies) { readNext(false); } }
private void _switchNow() throws IOException { if (onlySwitchAfterRow) throw new IllegalStateException("Can only switch on row boundries"); if (switchSource()) { if (key != null) { iter.seek(new Range(key, true, range.getEndKey(), range.isEndKeyInclusive()), columnFamilies, inclusive); } } }
public void switchNow() throws IOException { synchronized (copies) { for (SourceSwitchingIterator ssi : copies) ssi._switchNow(); } }
public void checkConditions(ConditionChecker checker, Authorizations authorizations, AtomicBoolean iFlag) throws IOException { ScanDataSource dataSource = new ScanDataSource(this, authorizations, this.defaultSecurityLabel, iFlag); try { SortedKeyValueIterator<Key,Value> iter = new SourceSwitchingIterator(dataSource); checker.check(iter); } catch (IOException ioe) { dataSource.close(true); throw ioe; } finally { // code in finally block because always want // to return mapfiles, even when exception is thrown dataSource.close(false); } }
private synchronized boolean switchNow() throws IOException { if (closed.get()) return false; ssi.switchNow(); return true; }
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { synchronized (copies) { this.range = range; this.inclusive = inclusive; this.columnFamilies = columnFamilies; if (iter == null) { iter = source.iterator(); if (!onlySwitchAfterRow && yield.isPresent()) { if (iter instanceof YieldingKeyValueIterator) { ((YieldingKeyValueIterator<Key,Value>) iter).enableYielding(yield.get()); } } } readNext(true); } }
boolean seekNeeded = yielded || (!onlySwitchAfterRow && switchSource()) || initialSeek; if (onlySwitchAfterRow && iter.hasTop() && !source.isCurrent() && !key.getRowData().equals(iter.getTopKey().getRowData())) { switchSource(); iter.seek(new Range(key.followingKey(PartialKey.ROW), true, range.getEndKey(), range.isEndKeyInclusive()), columnFamilies, inclusive);
SortedKeyValueIterator<Key,Value> iter = new SourceSwitchingIterator(dataSource); result = lookup(iter, ranges, columns, results, maxResultSize, batchTimeOut); return result;
FileDataSource fds = new FileDataSource(filename, source); dataSources.add(fds); SourceSwitchingIterator ssi = new SourceSwitchingIterator(fds); iter = new ProblemReportingIterator(context, tablet.getTableId(), filename, continueOnFailure, ssi);
isolatedIter = new SourceSwitchingIterator(dataSource, true); else isolatedDataSource.reattachFileManager(); iter = isolatedIter; } else { iter = new SourceSwitchingIterator(dataSource, false);
@Override public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) { synchronized (copies) { return new SourceSwitchingIterator(source.getDeepCopyDataSource(env), onlySwitchAfterRow, copies); } }