public static LZ4Compressor create(Map<String, String> args) throws ConfigurationException { String compressorType = validateCompressorType(args.get(LZ4_COMPRESSOR_TYPE)); Integer compressionLevel = validateCompressionLevel(args.get(LZ4_HIGH_COMPRESSION_LEVEL)); Pair<String, Integer> compressorTypeAndLevel = Pair.create(compressorType, compressionLevel); LZ4Compressor instance = instances.get(compressorTypeAndLevel); if (instance == null) { if (compressorType.equals(LZ4_FAST_COMPRESSOR) && args.get(LZ4_HIGH_COMPRESSION_LEVEL) != null) logger.warn("'{}' parameter is ignored when '{}' is '{}'", LZ4_HIGH_COMPRESSION_LEVEL, LZ4_COMPRESSOR_TYPE, LZ4_FAST_COMPRESSOR); instance = new LZ4Compressor(compressorType, compressionLevel); LZ4Compressor instanceFromMap = instances.putIfAbsent(compressorTypeAndLevel, instance); if(instanceFromMap != null) instance = instanceFromMap; } return instance; }
public static CompressionParams lz4(Integer chunkLength) { return new CompressionParams(LZ4Compressor.create(Collections.emptyMap()), chunkLength, Collections.emptyMap()); }
public static LZ4Compressor create(Map<String, String> args) throws ConfigurationException { String compressorType = validateCompressorType(args.get(LZ4_COMPRESSOR_TYPE)); Integer compressionLevel = validateCompressionLevel(args.get(LZ4_HIGH_COMPRESSION_LEVEL)); Pair<String, Integer> compressorTypeAndLevel = Pair.create(compressorType, compressionLevel); LZ4Compressor instance = instances.get(compressorTypeAndLevel); if (instance == null) { if (compressorType.equals(LZ4_FAST_COMPRESSOR) && args.get(LZ4_HIGH_COMPRESSION_LEVEL) != null) logger.warn("'{}' parameter is ignored when '{}' is '{}'", LZ4_HIGH_COMPRESSION_LEVEL, LZ4_COMPRESSOR_TYPE, LZ4_FAST_COMPRESSOR); instance = new LZ4Compressor(compressorType, compressionLevel); LZ4Compressor instanceFromMap = instances.putIfAbsent(compressorTypeAndLevel, instance); if(instanceFromMap != null) instance = instanceFromMap; } return instance; }
public static CompressionParams lz4(Integer chunkLength) { return new CompressionParams(LZ4Compressor.create(Collections.emptyMap()), chunkLength, Collections.emptyMap()); }
public static LZ4Compressor create(Map<String, String> args) throws ConfigurationException { String compressorType = validateCompressorType(args.get(LZ4_COMPRESSOR_TYPE)); Integer compressionLevel = validateCompressionLevel(args.get(LZ4_HIGH_COMPRESSION_LEVEL)); Pair<String, Integer> compressorTypeAndLevel = Pair.create(compressorType, compressionLevel); LZ4Compressor instance = instances.get(compressorTypeAndLevel); if (instance == null) { if (compressorType.equals(LZ4_FAST_COMPRESSOR) && args.get(LZ4_HIGH_COMPRESSION_LEVEL) != null) logger.warn("'{}' parameter is ignored when '{}' is '{}'", LZ4_HIGH_COMPRESSION_LEVEL, LZ4_COMPRESSOR_TYPE, LZ4_FAST_COMPRESSOR); instance = new LZ4Compressor(compressorType, compressionLevel); LZ4Compressor instanceFromMap = instances.putIfAbsent(compressorTypeAndLevel, instance); if(instanceFromMap != null) instance = instanceFromMap; } return instance; }
public static CompressionParams lz4(Integer chunkLength) { return new CompressionParams(LZ4Compressor.create(Collections.emptyMap()), chunkLength, Collections.emptyMap()); }
public static LZ4Compressor create(Map<String, String> args) throws ConfigurationException { String compressorType = validateCompressorType(args.get(LZ4_COMPRESSOR_TYPE)); Integer compressionLevel = validateCompressionLevel(args.get(LZ4_HIGH_COMPRESSION_LEVEL)); Pair<String, Integer> compressorTypeAndLevel = Pair.create(compressorType, compressionLevel); LZ4Compressor instance = instances.get(compressorTypeAndLevel); if (instance == null) { if (compressorType.equals(LZ4_FAST_COMPRESSOR) && args.get(LZ4_HIGH_COMPRESSION_LEVEL) != null) logger.warn("'{}' parameter is ignored when '{}' is '{}'", LZ4_HIGH_COMPRESSION_LEVEL, LZ4_COMPRESSOR_TYPE, LZ4_FAST_COMPRESSOR); instance = new LZ4Compressor(compressorType, compressionLevel); LZ4Compressor instanceFromMap = instances.putIfAbsent(compressorTypeAndLevel, instance); if(instanceFromMap != null) instance = instanceFromMap; } return instance; }
public static CompressionParams lz4(Integer chunkLength) { return new CompressionParams(LZ4Compressor.create(Collections.emptyMap()), chunkLength, Collections.emptyMap()); }
@VisibleForTesting public EncryptionContext(TransparentDataEncryptionOptions tdeOptions, byte[] iv, boolean init) { this.tdeOptions = tdeOptions; compressor = LZ4Compressor.create(Collections.<String, String>emptyMap()); chunkLength = tdeOptions.chunk_length_kb * 1024; this.iv = iv; // always attempt to load the cipher factory, as we could be in the situation where the user has disabled encryption, // but has existing commitlogs and sstables on disk that are still encrypted (and still need to be read) CipherFactory factory = null; if (tdeOptions.enabled && init) { try { factory = new CipherFactory(tdeOptions); } catch (Exception e) { throw new ConfigurationException("failed to load key provider for transparent data encryption", e); } } cipherFactory = factory; }
@VisibleForTesting public EncryptionContext(TransparentDataEncryptionOptions tdeOptions, byte[] iv, boolean init) { this.tdeOptions = tdeOptions; compressor = LZ4Compressor.create(Collections.<String, String>emptyMap()); chunkLength = tdeOptions.chunk_length_kb * 1024; this.iv = iv; // always attempt to load the cipher factory, as we could be in the situation where the user has disabled encryption, // but has existing commitlogs and sstables on disk that are still encrypted (and still need to be read) CipherFactory factory = null; if (tdeOptions.enabled && init) { try { factory = new CipherFactory(tdeOptions); } catch (Exception e) { throw new ConfigurationException("failed to load key provider for transparent data encryption", e); } } cipherFactory = factory; }
@VisibleForTesting public EncryptionContext(TransparentDataEncryptionOptions tdeOptions, byte[] iv, boolean init) { this.tdeOptions = tdeOptions; compressor = LZ4Compressor.create(Collections.<String, String>emptyMap()); chunkLength = tdeOptions.chunk_length_kb * 1024; this.iv = iv; // always attempt to load the cipher factory, as we could be in the situation where the user has disabled encryption, // but has existing commitlogs and sstables on disk that are still encrypted (and still need to be read) CipherFactory factory = null; if (tdeOptions.enabled && init) { try { factory = new CipherFactory(tdeOptions); } catch (Exception e) { throw new ConfigurationException("failed to load key provider for transparent data encryption", e); } } cipherFactory = factory; }