Пример #1
0
        /// <summary>
        /// Returns the approximate file system space used by keys in "[start .. limit)".
        ///
        /// Note that the returned sizes measure file system space usage, so
        /// if the user data compresses by a factor of ten, the returned
        /// sizes will be one-tenth the size of the corresponding user data size.
        ///
        /// The results may not include the sizes of recently written data.
        /// </summary>
        /// <param name="startKey"></param>
        /// <param name="limitKey"></param>
        /// <returns></returns>
        public unsafe long GetApproximateSize(byte[] startKey, byte[] limitKey)
        {
            IntPtr l1 = (IntPtr)startKey.Length;
            IntPtr l2 = (IntPtr)limitKey.Length;

            long[] sizes = new long[1];

            LevelDBInterop.leveldb_approximate_sizes(Handle, 1, new byte[][] { startKey }, new IntPtr[] { l1 }, new byte[][] { limitKey }, new IntPtr[] { l2 }, sizes);
            GC.KeepAlive(this);

            return(sizes[0]);
        }