protected Checksum initialValue() throws Exception { return newInstance(); } };
public void validate(byte[] bytes, int start, int end) throws IOException { int current = (int) checksumType.of(bytes, start, end); int actual = reader.readInt(); if (current != actual) throw new IOException("Corrupted File : " + dataFilename); }
public long of(ByteBuffer buf) { Checksum checksum = instances.get(); checksum.reset(); update(checksum, buf); return checksum.getValue(); }
public long of(ByteBuffer buf) { Checksum checksum = instances.get(); checksum.reset(); update(checksum, buf); return checksum.getValue(); }
public void validate(byte[] bytes, int start, int end) throws IOException { int current = (int) checksumType.of(bytes, start, end); int actual = reader.readInt(); if (current != actual) throw new IOException("Corrupted File : " + dataFilename); }
protected Checksum initialValue() throws Exception { return newInstance(); } };
public long of(ByteBuffer buf) { Checksum checksum = instances.get(); checksum.reset(); update(checksum, buf); return checksum.getValue(); }
public void validate(byte[] bytes, int start, int end) throws IOException { int current = (int) checksumType.of(bytes, start, end); int actual = reader.readInt(); if (current != actual) throw new IOException("Corrupted File : " + dataFilename); }
protected Checksum initialValue() throws Exception { return newInstance(); } };
public long of(ByteBuffer buf) { Checksum checksum = instances.get(); checksum.reset(); update(checksum, buf); return checksum.getValue(); }
private void decompress(byte[] compressed) throws IOException { // uncompress validBufferBytes = info.parameters.getSstableCompressor().uncompress(compressed, 0, compressed.length - checksumBytes.length, buffer, 0); totalCompressedBytesRead += compressed.length; // validate crc randomly if (this.crcCheckChanceSupplier.get() >= 1d || this.crcCheckChanceSupplier.get() > ThreadLocalRandom.current().nextDouble()) { int checksum = (int) checksumType.of(compressed, 0, compressed.length - checksumBytes.length); System.arraycopy(compressed, compressed.length - checksumBytes.length, checksumBytes, 0, checksumBytes.length); if (Ints.fromByteArray(checksumBytes) != checksum) throw new IOException("CRC unmatched"); } // buffer offset is always aligned bufferOffset = current & ~(buffer.length - 1); }
protected Checksum initialValue() throws Exception { return newInstance(); } };
private void decompress(byte[] compressed) throws IOException { // uncompress validBufferBytes = info.parameters.getSstableCompressor().uncompress(compressed, 0, compressed.length - checksumBytes.length, buffer, 0); totalCompressedBytesRead += compressed.length; // validate crc randomly if (this.crcCheckChanceSupplier.get() >= 1d || this.crcCheckChanceSupplier.get() > ThreadLocalRandom.current().nextDouble()) { int checksum = (int) checksumType.of(compressed, 0, compressed.length - checksumBytes.length); System.arraycopy(compressed, compressed.length - checksumBytes.length, checksumBytes, 0, checksumBytes.length); if (Ints.fromByteArray(checksumBytes) != checksum) throw new IOException("CRC unmatched"); } // buffer offset is always aligned bufferOffset = current & ~(buffer.length - 1); }
public FileDigestValidator(Descriptor descriptor) throws IOException { this.descriptor = descriptor; checksum = descriptor.version.uncompressedChecksumType().newInstance(); digestReader = RandomAccessReader.open(new File(descriptor.filenameFor(descriptor.digestComponent))); dataReader = RandomAccessReader.open(new File(descriptor.filenameFor(Component.DATA))); try { storedDigestValue = Long.parseLong(digestReader.readLine()); } catch (Exception e) { close(); // Attempting to create a FileDigestValidator without a DIGEST file will fail throw new IOException("Corrupted SSTable : " + descriptor.filenameFor(Component.DATA)); } }
private void decompress(byte[] compressed) throws IOException { // uncompress validBufferBytes = info.parameters.getSstableCompressor().uncompress(compressed, 0, compressed.length - checksumBytes.length, buffer, 0); totalCompressedBytesRead += compressed.length; // validate crc randomly if (this.crcCheckChanceSupplier.get() >= 1d || this.crcCheckChanceSupplier.get() > ThreadLocalRandom.current().nextDouble()) { int checksum = (int) checksumType.of(compressed, 0, compressed.length - checksumBytes.length); System.arraycopy(compressed, compressed.length - checksumBytes.length, checksumBytes, 0, checksumBytes.length); if (Ints.fromByteArray(checksumBytes) != checksum) throw new IOException("CRC unmatched"); } // buffer offset is always aligned bufferOffset = current & ~(buffer.length - 1); }
public FileDigestValidator(Descriptor descriptor) throws IOException { this.descriptor = descriptor; checksum = descriptor.version.uncompressedChecksumType().newInstance(); digestReader = RandomAccessReader.open(new File(descriptor.filenameFor(descriptor.digestComponent))); dataReader = RandomAccessReader.open(new File(descriptor.filenameFor(Component.DATA))); try { storedDigestValue = Long.parseLong(digestReader.readLine()); } catch (Exception e) { close(); // Attempting to create a FileDigestValidator without a DIGEST file will fail throw new IOException("Corrupted SSTable : " + descriptor.filenameFor(Component.DATA)); } }
int checksum = (int) metadata.checksumType.of(compressed);
public FileDigestValidator(Descriptor descriptor) throws IOException { this.descriptor = descriptor; checksum = descriptor.version.uncompressedChecksumType().newInstance(); digestReader = RandomAccessReader.open(new File(descriptor.filenameFor(descriptor.digestComponent))); dataReader = RandomAccessReader.open(new File(descriptor.filenameFor(Component.DATA))); try { storedDigestValue = Long.parseLong(digestReader.readLine()); } catch (Exception e) { close(); // Attempting to create a FileDigestValidator without a DIGEST file will fail throw new IOException("Corrupted SSTable : " + descriptor.filenameFor(Component.DATA)); } }
int checksum = (int) metadata.checksumType.of(compressed);
int checksum = (int) metadata.checksumType.of(compressedChunk);