Refine search
@NotThreadSafe public interface JoinFilterFunction { boolean filter(int leftPosition, int rightPosition, Page rightPage); }
@NotThreadSafe static abstract class UpdatatingOperation<T> extends Operation<T> { @Nullable protected Constraints.ConstraintHost criteria; protected Constraints.Constraint setFields = Constraints.nilConstraint();
@NotThreadSafe private static class DictionarySourceIdFunction implements Function<DictionaryBlock, DictionaryId> { private final Map<DictionaryId, DictionaryId> dictionarySourceIds = new HashMap<>(); @Override public DictionaryId apply(DictionaryBlock block) { return dictionarySourceIds.computeIfAbsent(block.getDictionarySourceId(), ignored -> randomDictionaryId()); } public void reset() { dictionarySourceIds.clear(); } }
@NotThreadSafe public interface LookupSource extends Closeable { int getChannelCount(); long getInMemorySizeInBytes(); long getJoinPositionCount(); long joinPositionWithinPartition(long joinPosition); long getJoinPosition(int position, Page hashChannelsPage, Page allChannelsPage, long rawHash); long getJoinPosition(int position, Page hashChannelsPage, Page allChannelsPage); long getNextJoinPosition(long currentJoinPosition, int probePosition, Page allProbeChannelsPage); void appendTo(long position, PageBuilder pageBuilder, int outputChannelOffset); boolean isJoinPositionEligible(long currentJoinPosition, int probePosition, Page allProbeChannelsPage); boolean isEmpty(); @Override void close(); }
/** * Policy for determining whether a refresh should be performed. Calls to attempt return * immediately and do not sleep until refresh. */ @NotThreadSafe public interface RefreshPolicy { /** * Checks if it is time to perform the next refresh and returns immediately. * * @return whether a refresh should be performed */ boolean attempt(); }
@NotThreadSafe private static class PendingSplitsForPlanNode { private final Map<Lifespan, PendingSplits> splitsByLifespan = new HashMap<>(); private boolean noMoreSplits; public PendingSplits getLifespan(Lifespan lifespan) { return splitsByLifespan.computeIfAbsent(lifespan, ignored -> new PendingSplits()); } public void setNoMoreSplits() { if (noMoreSplits) { return; } noMoreSplits = true; for (PendingSplits splitsForLifespan : splitsByLifespan.values()) { splitsForLifespan.noMoreSplits(); } } }
@NotThreadSafe static abstract class Operation<T> { protected final Repository<T> repository; protected Operation(Repository<T> repository) { this.repository = repository; } }
@NotThreadSafe public class DefaultConsistencyHandler extends AbstractConsistencyHandler { private static final MetaInfoKey CONSISTENCY_KEY = () -> "repl.consistent"; public DefaultConsistencyHandler(BackendService backendService, Retrier retrier, ThreadFactory threadFactory) { super(backendService, retrier, threadFactory); } @Override public MetaInfoKey getConsistencyKey() { return CONSISTENCY_KEY; } }
@NotThreadSafe public class ShardConsistencyHandler extends AbstractConsistencyHandler { private final MetaInfoKey consistencyKey; ShardConsistencyHandler(String shardId, BackendService backendService, Retrier retrier, ThreadFactory threadFactory) { super(backendService, retrier, threadFactory); this.consistencyKey = () -> "repl.consistent.shard." + shardId; } @Override public MetaInfoKey getConsistencyKey() { return consistencyKey; } }
@NotThreadSafe private class SpillAwareLookupSourceProvider implements LookupSourceProvider
/** * This is the base class for all workers, and contains common functionality. */ @NotThreadSafe // TODO(jiri): make thread-safe (c.f. ALLUXIO-1624) public abstract class AbstractWorker implements Worker { /** The executor service for the master sync. */ private final ExecutorService mExecutorService; /** * @param executorService executor service to use internally */ protected AbstractWorker(ExecutorService executorService) { mExecutorService = Preconditions.checkNotNull(executorService, "executorService"); } /** * @return the executor service */ protected ExecutorService getExecutorService() { return mExecutorService; } }
/** * This class manages reading from the journal. */ @NotThreadSafe public interface JournalReader extends Closeable { /** * Reads an entry from the journal. Return null if there is no more entry left. * * @return the journal entry, null if no more entry left * @throws InvalidJournalEntryException if the journal entry is invalid (e.g. corrupted entry) */ JournalEntry read() throws IOException, InvalidJournalEntryException; /** * Gets the the sequence number of the next journal log entry to read. This method is valid * no matter whether this JournalReader is closed or not. * * @return the next sequence number */ long getNextSequenceNumber(); }
@NotThreadSafe private static class PendingSplits
/** * Policy for determining whether retries should be performed, and potentially waiting for some time * before the next retry attempt. The way that this interface works is that the logic * for delayed retries (retries that sleep) can delay the caller of {@link #attempt()}. */ @NotThreadSafe public interface RetryPolicy { /** * How many retries have been performed. If no retries have been performed, 0 is returned. * * @return number of retries performed */ int getAttemptCount(); /** * Waits until it is time to perform the next retry, then returns. Returns false if no further * retries should be performed. The first call to this method should never delay the caller, this * allow users of the policy to use it in the context of a while-loop. * * @return whether another retry should be performed */ boolean attempt(); }
/** * Under file system periodic clean. */ @NotThreadSafe final class UfsCleaner implements HeartbeatExecutor { private final FileSystemMaster mFileSystemMaster; /** * Constructs a new {@link UfsCleaner}. */ public UfsCleaner(FileSystemMaster fileSystemMaster) { mFileSystemMaster = fileSystemMaster; } @Override public void heartbeat() { mFileSystemMaster.cleanupUfs(); } @Override public void close() { // Nothing to clean up } }
@NotThreadSafe private static abstract class Cache<K, V> { private final Map<K, V> map = Maps.newHashMap(); protected abstract V load(K key) throws Exception; final V get(K key) { @Nullable V value = map.get(key); if (value == null) { try { value = load(key); } catch (Exception ex) { throw Throwables.propagate(ex); } map.put(key, value); } return value; } } }
/** * StorageChecker periodically checks the health of each storage path and report missing blocks to * {@link BlockWorker}. */ @NotThreadSafe public final class StorageChecker implements HeartbeatExecutor { @Override public void heartbeat() { try { if (mBlockStore.checkStorage()) { mSpaceReserver.updateStorageInfo(); } } catch (Exception e) { LOG.warn("Failed to check storage", e.getMessage()); LOG.debug("Exception: ", e); } } @Override public void close() { // Nothing to clean up } } }
/** * Thread class to delete a batch of objects. */ @NotThreadSafe protected class DeleteThread implements Callable<List<String>> { List<String> mBatch; /** * Delete a batch of objects. * @param batch a list of objects to delete */ public DeleteThread(List<String> batch) { mBatch = batch; } @Override public List<String> call() { try { return deleteObjects(mBatch); } catch (IOException e) { // Do not append to success list return Collections.emptyList(); } } } }
/** * Used as a base class for wrapping context around proto messages. * * @param <T> Proto message type */ @NotThreadSafe public class OperationContext<T extends com.google.protobuf.GeneratedMessageV3.Builder<?>> { // Proto message that is being wrapped private T mOptionsBuilder; /** * Creates an instance with given proto message. * * @param optionsBuilder Internal proto message builder instance */ public OperationContext(T optionsBuilder) { mOptionsBuilder = optionsBuilder; } /** * @return underlying proto message instance */ public T getOptions() { return mOptionsBuilder; } }
/** * Context of {@link BlockReadRequest}. */ @NotThreadSafe public final class BlockReadRequestContext extends ReadRequestContext<BlockReadRequest> { private BlockReader mBlockReader; /** * @param request read request in proto */ public BlockReadRequestContext(alluxio.grpc.ReadRequest request) { super(new BlockReadRequest(request)); } /** * @return block reader */ @Nullable public BlockReader getBlockReader() { return mBlockReader; } /** * @param blockReader block reader to set */ public void setBlockReader(BlockReader blockReader) { mBlockReader = blockReader; } }