Class: Legion::Extensions::MicrosoftTeams::LocalCache::SSTableReader
- Inherits:
-
Object
- Object
- Legion::Extensions::MicrosoftTeams::LocalCache::SSTableReader
- Defined in:
- lib/legion/extensions/microsoft_teams/local_cache/sstable_reader.rb
Overview
Pure Ruby LevelDB SSTable (.ldb) reader with Snappy decompression. Reads Chromium’s IndexedDB LevelDB files without native LevelDB bindings.
Constant Summary collapse
- FOOTER_SIZE =
48- BLOCK_TRAILER_SIZE =
5- FOOTER_MAGIC =
[0x57, 0xfb, 0x80, 0x8b, 0x24, 0x75, 0x47, 0xdb].pack('C*').freeze
Instance Method Summary collapse
- #each_entry ⇒ Object
-
#initialize(path) ⇒ SSTableReader
constructor
A new instance of SSTableReader.
Constructor Details
#initialize(path) ⇒ SSTableReader
Returns a new instance of SSTableReader.
16 17 18 |
# File 'lib/legion/extensions/microsoft_teams/local_cache/sstable_reader.rb', line 16 def initialize(path) @data = File.binread(path) end |
Instance Method Details
#each_entry ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/legion/extensions/microsoft_teams/local_cache/sstable_reader.rb', line 20 def each_entry(&) return enum_for(:each_entry) unless block_given? = return unless index_block = read_block([:index_offset], [:index_size]) return unless index_block parse_block_entries(index_block) do |_key, handle_data| offset, size, = decode_block_handle_at(handle_data, 0) next unless offset && size data_block = read_block(offset, size) next unless data_block parse_block_entries(data_block, &) end end |