FASTER icon indicating copy to clipboard operation
FASTER copied to clipboard

Read uncommitted data

Open sakno opened this issue 1 year ago • 2 comments

Currently, FASTER doesn't allow to read uncommitted data by ReadAsync method. In the same time, iterator allows to do that. Is this possible to extend ReadAsync accordingly?

sakno avatar Jun 28 '24 19:06 sakno

ClientSession can be used like so:

var session = _store.For(new SimpleFunctions<byte[], byte[]>()).NewSession<SimpleFunctions<byte[], byte[]>>()

var (status, output) = session.Read(key);
byte[]? value = null;

if (status.Found)
    value = output;
if (status.IsPending && session.CompletePendingWithOutputs(out var iter, true, true))
{
    using (iter)
    {
        while (iter.Next())
        {
            if (iter.Current.Key.AsSpan().SequenceEqual(key))
            {
                value = iter.Current.Output;
                break;
            }
        }
    }
}

cschuchardt88 avatar Mar 06 '25 23:03 cschuchardt88

👍

tcsaddul avatar Mar 07 '25 02:03 tcsaddul