Esempio n. 1
0
        public Table(IContentReader contentReader, ICache cache, InternalKeyComparer comparer,
                     ISnappyDecompressor decompressor)
        {
            _contentReader = contentReader;
            _comparer      = comparer;
            _decompressor  = decompressor;

            _cache   = cache;
            _cacheId = IdGenerator.NewId();

            var size = contentReader.ContentLength;

            if (size < Footer.EncodedLength)
            {
                throw new InvalidDataException("file is too short to be an sstable");
            }

            // TODO replace with read
            var footers = contentReader.ReadContent(size - Footer.EncodedLength, Footer.EncodedLength);

            var footer = new Footer(footers);

            _indexBlock = new Block(ReadBlock(footer.IndexHandle), comparer);
        }
 public static byte[] Decompress(this ISnappyDecompressor decompressor, byte[] src)
 {
     return(decompressor.Decompress(src, 0, src.Length));
 }