Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions in session #270

Merged
merged 17 commits into from
Jul 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
ea01b56
Moving function callbacks to sessions (microsoft/FASTER#230)
marius-klimantavicius May 11, 2020
8bf13d5
Use special interface to interact with state machine(s).
marius-klimantavicius May 27, 2020
ef51d17
Mark synchronization listener to be struct for jit to be able to inli…
marius-klimantavicius May 27, 2020
99e0b15
Introduced IFasterSession instead of ISynchronizationListener. It com…
marius-klimantavicius May 28, 2020
a0c11c3
Merged from master
marius-klimantavicius May 29, 2020
786677d
Move out Input, Output, Context from FasterKV into methods.
marius-klimantavicius Jun 2, 2020
08124d4
Added simple test for multiple sessions
marius-klimantavicius Jun 3, 2020
bb0d99c
Merge branch 'master' into functions_in_session
badrishc Jun 5, 2020
bbdd47f
Added `custom compaction functions (#272).
marius-klimantavicius Jun 6, 2020
21298c7
Merge branch 'functions_in_session' of https://github.com/marius-klim…
marius-klimantavicius Jun 6, 2020
d4479fc
Provide `ref Input input` for calculating size of new record when all…
marius-klimantavicius Jun 9, 2020
33a6760
Merge branch 'master' into functions_in_session
marius-klimantavicius Jun 9, 2020
79f7212
Merge branch 'master' into functions_in_session
badrishc Jun 16, 2020
d65a825
Removed sync methods of state machine.
marius-klimantavicius Jun 22, 2020
034bbb8
Merge branch 'master' into functions_in_session
marius-klimantavicius Jul 2, 2020
8427ae0
Merge branch 'master' into functions_in_session
badrishc Jul 9, 2020
39506fb
Update ClientSession.cs
badrishc Jul 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cs/playground/FasterKVDiskReadBenchmark/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static async Task AsyncReadOperator(int id)
Input input = default;
int i = 0;

var tasks = new (long, ValueTask<FasterKV<Key, Value, Input, Output, Empty, MyFuncs>.ReadAsyncResult>)[batchSize];
var tasks = new (long, ValueTask<FasterKV<Key, Value>.ReadAsyncResult<Input, Output, Empty, MyFuncs>>)[batchSize];
while (true)
{
key = new Key(NumKeys * id + rand.Next(0, NumKeys));
Expand Down
5 changes: 5 additions & 0 deletions cs/playground/VarLenStructSample/Types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,10 @@ public int GetLength(ref VarLenType t)
{
return sizeof(int) * t.length;
}

public int GetLength<Input>(ref VarLenType t, ref Input input)
{
return sizeof(int) * t.length;
}
}
}
7 changes: 7 additions & 0 deletions cs/src/core/Allocator/AllocatorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,13 @@ public unsafe abstract partial class AllocatorBase<Key, Value> : IDisposable
/// <returns></returns>
public abstract int GetRecordSize(long physicalAddress);

/// <summary>
/// Get record size
/// </summary>
/// <param name="physicalAddress"></param>
/// <param name="input"></param>
/// <returns></returns>
public abstract int GetRecordSize<Input>(long physicalAddress, ref Input input);

/// <summary>
/// Get number of bytes required
Expand Down
5 changes: 5 additions & 0 deletions cs/src/core/Allocator/BlittableAllocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ public override int GetRecordSize(long physicalAddress)
return recordSize;
}

public override int GetRecordSize<Input>(long physicalAddress, ref Input input)
{
return recordSize;
}

public override int GetAverageRecordSize()
{
return recordSize;
Expand Down
6 changes: 5 additions & 1 deletion cs/src/core/Allocator/GenericAllocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ public override ref RecordInfo GetInfoFromBytePointer(byte* ptr)
return ref Unsafe.AsRef<Record<Key, Value>>(ptr).info;
}


public override ref Key GetKey(long physicalAddress)
{
// Offset within page
Expand Down Expand Up @@ -142,6 +141,11 @@ public override int GetRecordSize(long physicalAddress)
return recordSize;
}

public override int GetRecordSize<Input>(long physicalAddress, ref Input input)
{
return recordSize;
}

public override int GetAverageRecordSize()
{
return recordSize;
Expand Down
16 changes: 16 additions & 0 deletions cs/src/core/Allocator/VarLenBlittableAllocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ private int ValueSize(long physicalAddress)
return ValueLength.GetLength(ref GetValue(physicalAddress));
}

private int ValueSize<Input>(long physicalAddress, ref Input input)
{
return ValueLength.GetLength(ref GetValue(physicalAddress), ref input);
}

public override int GetRecordSize(long physicalAddress)
{
ref var recordInfo = ref GetInfo(physicalAddress);
Expand All @@ -100,6 +105,17 @@ public override int GetRecordSize(long physicalAddress)
return size;
}

public override int GetRecordSize<Input>(long physicalAddress, ref Input input)
{
ref var recordInfo = ref GetInfo(physicalAddress);
if (recordInfo.IsNull())
return RecordInfo.GetLength();

var size = RecordInfo.GetLength() + KeySize(physicalAddress) + ValueSize(physicalAddress, ref input);
size = (size + kRecordAlignment - 1) & (~(kRecordAlignment - 1));
return size;
}

public override int GetRequiredRecordSize(long physicalAddress, int availableBytes)
{
// We need at least [record size] + [average key size] + [average value size]
Expand Down
Loading