]> git.mikk.net Git - mtbl-rs/log
mtbl-rs
15 months agoRefactor block code for clean-up, tests, seek() fixes
Chris Mikkelson [Thu, 8 Aug 2024 05:39:45 +0000 (23:39 -0600)]
Refactor block code for clean-up, tests, seek() fixes

15 months agoincrease size of rwtest data
Chris Mikkelson [Thu, 8 Aug 2024 02:28:58 +0000 (20:28 -0600)]
increase size of rwtest data

15 months agoUpdate API layout to use prelude
Chris Mikkelson [Thu, 8 Aug 2024 00:12:38 +0000 (18:12 -0600)]
Update API layout to use prelude

Add test for range iter, add missing linear search step to
BlockIter seek

15 months agoreader: remove debug print and unused CRC decoding
Chris Mikkelson [Wed, 7 Aug 2024 22:49:41 +0000 (16:49 -0600)]
reader: remove debug print and unused CRC decoding

15 months agocargo-clippy lints
Chris Mikkelson [Wed, 7 Aug 2024 22:48:45 +0000 (16:48 -0600)]
cargo-clippy lints

15 months agoGive ReaderIter a Reader Clone for flexibility
Chris Mikkelson [Wed, 7 Aug 2024 22:13:17 +0000 (16:13 -0600)]
Give ReaderIter a Reader Clone for flexibility

15 months agoWIP: working reader, with test
Chris Mikkelson [Wed, 7 Aug 2024 06:53:10 +0000 (00:53 -0600)]
WIP: working reader, with test

Squashed several bugs, will have to squash `.expect()`s next.

15 months agoiter.rs: cargo fmt
Chris Mikkelson [Wed, 7 Aug 2024 04:54:08 +0000 (22:54 -0600)]
iter.rs: cargo fmt

15 months agowriter: Move index update to data block write
Chris Mikkelson [Wed, 7 Aug 2024 04:53:00 +0000 (22:53 -0600)]
writer: Move index update to data block write

Fixes missing index write on last block.

15 months agoRefactor reader code around Arc<impl AsRef<[u8]>>
Chris Mikkelson [Wed, 7 Aug 2024 04:50:22 +0000 (22:50 -0600)]
Refactor reader code around Arc<impl AsRef<[u8]>>

API currently named 'DataSlice' provides convenient views of
ranges / slices of the underlying buffer, avoiding lifetime
entaglements.

16 months agoexperimental first cut at reader -- not working
Chris Mikkelson [Tue, 6 Aug 2024 01:38:49 +0000 (19:38 -0600)]
experimental first cut at reader -- not working

16 months agowriter: write in-progress block
Chris Mikkelson [Mon, 5 Aug 2024 06:02:28 +0000 (00:02 -0600)]
writer: write in-progress block

16 months agometadata: read from file-like object instaed of buf
Chris Mikkelson [Mon, 5 Aug 2024 06:01:41 +0000 (00:01 -0600)]
metadata: read from file-like object instaed of buf

16 months agoFlesh out writer, block builder, requirements
Chris Mikkelson [Mon, 5 Aug 2024 05:14:49 +0000 (23:14 -0600)]
Flesh out writer, block builder, requirements

16 months agomove block result, error to main lib
Chris Mikkelson [Mon, 5 Aug 2024 05:14:17 +0000 (23:14 -0600)]
move block result, error to main lib

16 months agoadd metadata, compression
Chris Mikkelson [Mon, 5 Aug 2024 05:12:22 +0000 (23:12 -0600)]
add metadata, compression

16 months agoRefactor block, block_builder for readability, magic numbers
Chris Mikkelson [Fri, 2 Aug 2024 23:42:45 +0000 (18:42 -0500)]
Refactor block, block_builder for readability, magic numbers

Fix "off by 4" bug caused by double call to block builder finish.

16 months agoBreak iter and source into separate modules.
chris mikkelson [Mon, 29 Jul 2024 19:00:38 +0000 (14:00 -0500)]
Break iter and source into separate modules.

16 months agosource.rs: Remove unneeded GenSource trait
chris mikkelson [Mon, 29 Jul 2024 18:45:20 +0000 (13:45 -0500)]
source.rs: Remove unneeded GenSource trait

Rename GenWrap to BoxWrap for clarity.

16 months agoRename GenericSource -> BoxedSource
Chris Mikkelson [Sun, 28 Jul 2024 18:23:12 +0000 (13:23 -0500)]
Rename GenericSource -> BoxedSource

16 months agoFlesh out 'generic merger' test
Chris Mikkelson [Wed, 24 Jul 2024 18:22:46 +0000 (13:22 -0500)]
Flesh out 'generic merger' test

16 months agoGeneric sources working after big refactor.
Chris Mikkelson [Tue, 23 Jul 2024 20:15:21 +0000 (15:15 -0500)]
Generic sources working after big refactor.

Root cause was Box<dyn Trait> defaults to Box<dyn Trait + 'static>,
leading to the 'static lifetime "infecting" the generated iterators,
causing the borrow to last beyond the end of the function which dropped
the box or its containing structure.

The quick fix was to inject and add an explicit lifetime to the Box.

While tuning that fix, opted to inject lifetimes by implementing
Source methods on references. This tracks more with the C mtbl API,
where:

m = mtbl_merger_init(mopt);
/* populate m */
mtbl_merger_source(m);

is roughly mirrored by:

let m = mtbl::Merger::from(...);
let source = &m;

16 months agogeneric sources working, sort of, in test
Chris Mikkelson [Mon, 22 Jul 2024 13:58:21 +0000 (08:58 -0500)]
generic sources working, sort of, in test

16 months agoWIP experiment dyn source
Chris Mikkelson [Mon, 22 Jul 2024 02:12:51 +0000 (21:12 -0500)]
WIP experiment dyn source

Lifetime making it hard to test, possibly implement at all

16 months agoRefactor Source trait hierarchy
Chris Mikkelson [Sun, 21 Jul 2024 00:40:23 +0000 (19:40 -0500)]
Refactor Source trait hierarchy

Source implements get/prefix/range, and is a subtrait of
IterSource which implements only iter(). The Default
implementation is now another subtrait of IterSource.

This avoids several of the previouas `Source<'a> + Ranges<'a>`
and 'Source<'a> + DefaultRanges' type constraints, and
simplifies type paths.

16 months agoGeneral cleanup, cargo-clippy fixes
Chris Mikkelson [Sat, 20 Jul 2024 02:02:01 +0000 (21:02 -0500)]
General cleanup, cargo-clippy fixes

16 months agopull out the non-working generic source bits
Chris Mikkelson [Sat, 20 Jul 2024 02:01:43 +0000 (21:01 -0500)]
pull out the non-working generic source bits

16 months agoWIP of attempt to make a generic source
Chris Mikkelson [Sat, 20 Jul 2024 01:56:22 +0000 (20:56 -0500)]
WIP of attempt to make a generic source

16 months agoAdd generic source wrapper for mixed mergers
Chris Mikkelson [Fri, 19 Jul 2024 20:02:20 +0000 (15:02 -0500)]
Add generic source wrapper for mixed mergers

16 months agofixed lifetime issue! ?
Chris Mikkelson [Fri, 19 Jul 2024 18:41:45 +0000 (13:41 -0500)]
fixed lifetime issue! ?

16 months agoWIP commit: attempt to make Source object safe
Chris Mikkelson [Fri, 19 Jul 2024 17:10:19 +0000 (12:10 -0500)]
WIP commit: attempt to make Source object safe

Use associated iterator types instead of `impl Iter`. Move
get, get_prefix, get_range to separate "Ranges" trait, with
a generic default implementation based on iter() enabled by
"DefaultRanges" trait.

WIP due to one pesky lifetime issue.

16 months agomerger: Remove all internal use of Box<dyn Iter>
Chris Mikkelson [Fri, 19 Jul 2024 03:28:00 +0000 (22:28 -0500)]
merger: Remove all internal use of Box<dyn Iter>

Adding Iter implementation for Box<dyn Iter> allows it
to be used as a concrete type in case of a mixed merger.

16 months agoAdd support for Boxed dyn Iter objects
Chris Mikkelson [Fri, 19 Jul 2024 03:27:11 +0000 (22:27 -0500)]
Add support for Boxed dyn Iter objects

16 months agomerger: remove Source paramater from Iter template.
Chris Mikkelson [Fri, 19 Jul 2024 01:02:20 +0000 (20:02 -0500)]
merger: remove Source paramater from Iter template.

16 months agoBeginnings of reader and writer
Chris Mikkelson [Tue, 16 Jul 2024 06:14:44 +0000 (01:14 -0500)]
Beginnings of reader and writer

16 months agoAnother refactor: back to mtbl C idioms
Chris Mikkelson [Sun, 14 Jul 2024 20:31:15 +0000 (15:31 -0500)]
Another refactor: back to mtbl C idioms

Iter (includes seek + iterator), static entry type, Source,
merger, etc.

17 months agomap values only; generic keys too complex
Chris Mikkelson [Mon, 17 Jun 2024 02:08:38 +0000 (21:08 -0500)]
map values only; generic keys too complex

19 months agoSeekable: relax Ord requirement on keys
Chris Mikkelson [Fri, 3 May 2024 05:54:15 +0000 (00:54 -0500)]
Seekable: relax Ord requirement on keys

This allows implementations to return Result<> types to propagate
errors. Those errors will need to be handled prior to merging
or coalescing.

19 months agoSeekableVec: relax Copy requirement to Clone
Chris Mikkelson [Mon, 29 Apr 2024 01:48:59 +0000 (20:48 -0500)]
SeekableVec: relax Copy requirement to Clone

19 months agoModify filter_map to only map values
Chris Mikkelson [Mon, 29 Apr 2024 01:44:00 +0000 (20:44 -0500)]
Modify filter_map to only map values

Mapping keys requires a conversion on seek from the
mapped key to the inner key. Since the keys are passed
to seek by reference to avoid moves, this complicates
consuming the key for a full conversion to the inner
key.

For now, restrict mapping to values only. This required
changing the filter function signature to take a reference
to the key so its caller could retain the key for returning.

19 months agocargo-clippy fixes
Chris Mikkelson [Sun, 28 Apr 2024 20:57:27 +0000 (15:57 -0500)]
cargo-clippy fixes

Remove redudant Some(foo()?).

Make PartialOrd more canonical.

19 months agoAdd coalesce (merge function) support
Chris Mikkelson [Sun, 28 Apr 2024 20:54:28 +0000 (15:54 -0500)]
Add coalesce (merge function) support

19 months agoSeekableVec: add value type.
Chris Mikkelson [Sun, 28 Apr 2024 20:46:14 +0000 (15:46 -0500)]
SeekableVec: add value type.

19 months agoRefactor imports for visibility.
Chris Mikkelson [Sun, 28 Apr 2024 19:18:23 +0000 (14:18 -0500)]
Refactor imports for visibility.

19 months agoMove SeekableVec to module for test support
Chris Mikkelson [Sun, 28 Apr 2024 18:52:14 +0000 (13:52 -0500)]
Move SeekableVec to module for test support

19 months agoRefactor to generic Seekable IntoIterator
Chris Mikkelson [Sun, 28 Apr 2024 18:43:04 +0000 (13:43 -0500)]
Refactor to generic Seekable IntoIterator

19 months agoRemove lender dependency
Chris Mikkelson [Sun, 28 Apr 2024 18:18:18 +0000 (13:18 -0500)]
Remove lender dependency

19 months agoformat iter.rs
Chris Mikkelson [Thu, 18 Apr 2024 01:16:10 +0000 (20:16 -0500)]
format iter.rs

19 months agoConvert AsRef template functions to use impl AsRef
Chris Mikkelson [Thu, 18 Apr 2024 01:15:48 +0000 (20:15 -0500)]
Convert AsRef template functions to use impl AsRef

19 months agoiter: Genericize repeated IntoIterator implementations
Chris Mikkelson [Fri, 12 Apr 2024 19:15:10 +0000 (14:15 -0500)]
iter: Genericize repeated IntoIterator implementations

Introduce 'Seekable<T: Entries>' wrapper to bring common
'return Iter<T>' logic to one place.

19 months agoEntries::filter_seek -> Entries::filter
Chris Mikkelson [Sun, 7 Apr 2024 20:04:53 +0000 (15:04 -0500)]
Entries::filter_seek -> Entries::filter

No longer need separate name due to Iterator co-implementation

19 months agoRename Iter to "entries" to avoid confusion with iterator.
Chris Mikkelson [Sun, 7 Apr 2024 20:01:41 +0000 (15:01 -0500)]
Rename Iter to "entries" to avoid confusion with iterator.

Entries implements IntoIterator.

19 months agoIter -> Entries, prep for Iter: IntoIterator
Chris Mikkelson [Sun, 7 Apr 2024 19:09:25 +0000 (14:09 -0500)]
Iter -> Entries, prep for Iter: IntoIterator

19 months agoiter: IterBox -> IterCell, private struct
Chris Mikkelson [Sun, 7 Apr 2024 18:37:03 +0000 (13:37 -0500)]
iter: IterBox -> IterCell, private struct

19 months agomake test output more readable
Chris Mikkelson [Sun, 7 Apr 2024 18:08:22 +0000 (13:08 -0500)]
make test output more readable

19 months agoIter::filter_seek: consume source iterator
Chris Mikkelson [Sun, 7 Apr 2024 18:08:03 +0000 (13:08 -0500)]
Iter::filter_seek: consume source iterator

19 months agorustfmt
Chris Mikkelson [Sun, 7 Apr 2024 18:05:57 +0000 (13:05 -0500)]
rustfmt

19 months agoInitial commit
Chris Mikkelson [Sun, 7 Apr 2024 16:56:05 +0000 (11:56 -0500)]
Initial commit