From notifications-return-44568-archive-asf-public=cust-asf.ponee.io@accumulo.apache.org Thu Aug 16 17:53:43 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 25D1B18067A for ; Thu, 16 Aug 2018 17:53:42 +0200 (CEST) Received: (qmail 60470 invoked by uid 500); 16 Aug 2018 15:53:42 -0000 Mailing-List: contact notifications-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jira@apache.org Delivered-To: mailing list notifications@accumulo.apache.org Received: (qmail 60401 invoked by uid 99); 16 Aug 2018 15:53:42 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Aug 2018 15:53:42 +0000 From: GitBox To: notifications@accumulo.apache.org Subject: [GitHub] keith-turner commented on a change in pull request #604: Greatly simplify FileOperations Message-ID: <153443482164.3202.3511738668377389398.gitbox@gitbox.apache.org> Date: Thu, 16 Aug 2018 15:53:41 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit keith-turner commented on a change in pull request #604: Greatly simplify FileOperations URL: https://github.com/apache/accumulo/pull/604#discussion_r210632005 ########## File path: core/src/main/java/org/apache/accumulo/core/file/FileOperations.java ########## @@ -234,283 +207,314 @@ public FileSystem getFileSystem() { return fs; } - protected void setConfiguration(Configuration fsConf) { - this.fsConf = fsConf; - } - public Configuration getConfiguration() { return fsConf; } - public AccumuloConfiguration getTableConfiguration() { - return tableConfiguration; + public RateLimiter getRateLimiter() { + return rateLimiter; } - /** Check for null parameters. */ - protected void validate() { - Objects.requireNonNull(getFilename()); - Objects.requireNonNull(getFileSystem()); - Objects.requireNonNull(getConfiguration()); - Objects.requireNonNull(getTableConfiguration()); + public String getCompression() { + return compression; } - } - /** Builder interface parallel to {@link FileAccessOperation}. */ - protected interface FileAccessOperationBuilder extends NeedsFile, - NeedsFileSystem, NeedsTableConfiguration { - // no optional/generic methods. - } + public FSDataOutputStream getOutputStream() { + return outputStream; + } - /** - * Operation object for performing {@code getFileSize()} operations. - */ - protected class GetFileSizeOperation extends FileAccessOperation - implements GetFileSizeOperationBuilder { - /** Return the size of the file. */ - @Override - public long execute() throws IOException { - validate(); - return getFileSize(this); + public boolean isAccumuloStartEnabled() { + return enableAccumuloStart; } - } - /** - * Builder interface for {@link GetFileSizeOperation}, allowing execution of {@code getFileSize()} - * operations. - */ - public interface GetFileSizeOperationBuilder - extends FileAccessOperationBuilder { - /** Return the size of the file. */ - long execute() throws IOException; + public BlockCache getDataCache() { + return dataCache; + } + + public BlockCache getIndexCache() { + return indexCache; + } + + public Cache getFileLenCache() { + return fileLenCache; + } + + public boolean isSeekToBeginning() { + return seekToBeginning; + } + + public CryptoService getCryptoService() { + return cryptoService; + } + + public Range getRange() { + return range; + } + + public Set getColumnFamilies() { + return columnFamilies; + } + + public boolean isRangeInclusive() { + return inclusive; + } } /** - * Options common to all {@code FileOperation}s which perform reading or writing. + * Helper class extended by both writers and readers. */ - protected static class FileIOOperation> - extends FileAccessOperation { - private RateLimiter rateLimiter; + public class FileHelper { + protected AccumuloConfiguration tableConfiguration; + protected String filename; + protected FileSystem fs; + protected Configuration fsConf; + protected RateLimiter rateLimiter; + + protected FileHelper fs(FileSystem fs) { + Objects.requireNonNull(fs); + this.fs = fs; + return this; + } + + protected FileHelper fsConf(Configuration fsConf) { + Objects.requireNonNull(fsConf); + this.fsConf = fsConf; Review comment: These two lines could be written as one line ` this.fsConf = Objects.requireNonNull(fsConf)` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services