Skip to content

Commit

Permalink
Merge branch 'async-support-test' of https://github.com/Microsoft/FASTER
Browse files Browse the repository at this point in the history
 into async-support-test
  • Loading branch information
badrishc committed Sep 4, 2019
2 parents b16212f + 75b9cb2 commit b2479ed
Show file tree
Hide file tree
Showing 50 changed files with 1,957 additions and 327 deletions.
6 changes: 4 additions & 2 deletions cs/benchmark/Functions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ public void SingleWriter(ref Key key, ref Value src, ref Value dst)
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ConcurrentWriter(ref Key key, ref Value src, ref Value dst)
public bool ConcurrentWriter(ref Key key, ref Value src, ref Value dst)
{
dst = src;
return true;
}

// RMW functions
Expand All @@ -67,9 +68,10 @@ public void InitialUpdater(ref Key key, ref Input input, ref Value value)
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InPlaceUpdater(ref Key key, ref Input input, ref Value value)
public bool InPlaceUpdater(ref Key key, ref Input input, ref Value value)
{
value.value += input.value;
return true;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down
5 changes: 3 additions & 2 deletions cs/playground/ClassCache/Types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ public void ConcurrentReader(ref CacheKey key, ref CacheInput input, ref CacheVa
dst.value = value;
}

public void ConcurrentWriter(ref CacheKey key, ref CacheValue src, ref CacheValue dst)
public bool ConcurrentWriter(ref CacheKey key, ref CacheValue src, ref CacheValue dst)
{
dst = src;
return true;
}

public void CopyUpdater(ref CacheKey key, ref CacheInput input, ref CacheValue oldValue, ref CacheValue newValue)
Expand All @@ -107,7 +108,7 @@ public void InitialUpdater(ref CacheKey key, ref CacheInput input, ref CacheValu
throw new NotImplementedException();
}

public void InPlaceUpdater(ref CacheKey key, ref CacheInput input, ref CacheValue value)
public bool InPlaceUpdater(ref CacheKey key, ref CacheInput input, ref CacheValue value)
{
throw new NotImplementedException();
}
Expand Down
5 changes: 3 additions & 2 deletions cs/playground/ClassCacheMT/Types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ public void ConcurrentReader(ref CacheKey key, ref CacheInput input, ref CacheVa
dst.value = value;
}

public void ConcurrentWriter(ref CacheKey key, ref CacheValue src, ref CacheValue dst)
public bool ConcurrentWriter(ref CacheKey key, ref CacheValue src, ref CacheValue dst)
{
dst = src;
return true;
}

public void CopyUpdater(ref CacheKey key, ref CacheInput input, ref CacheValue oldValue, ref CacheValue newValue)
Expand All @@ -107,7 +108,7 @@ public void InitialUpdater(ref CacheKey key, ref CacheInput input, ref CacheValu
throw new NotImplementedException();
}

public void InPlaceUpdater(ref CacheKey key, ref CacheInput input, ref CacheValue value)
public bool InPlaceUpdater(ref CacheKey key, ref CacheInput input, ref CacheValue value)
{
throw new NotImplementedException();
}
Expand Down
4 changes: 2 additions & 2 deletions cs/playground/ClassSample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ public class MyFunctions : IFunctions<MyKey, MyValue, MyInput, MyOutput, MyConte
{
public void InitialUpdater(ref MyKey key, ref MyInput input, ref MyValue value) => value.value = input.value;
public void CopyUpdater(ref MyKey key, ref MyInput input, ref MyValue oldValue, ref MyValue newValue) => newValue = oldValue;
public void InPlaceUpdater(ref MyKey key, ref MyInput input, ref MyValue value) => value.value += input.value;
public bool InPlaceUpdater(ref MyKey key, ref MyInput input, ref MyValue value) { value.value += input.value; return true; }


public void SingleReader(ref MyKey key, ref MyInput input, ref MyValue value, ref MyOutput dst) => dst.value = value;
public void SingleWriter(ref MyKey key, ref MyValue src, ref MyValue dst) => dst = src;
public void ConcurrentReader(ref MyKey key, ref MyInput input, ref MyValue value, ref MyOutput dst) => dst.value = value;
public void ConcurrentWriter(ref MyKey key, ref MyValue src, ref MyValue dst) => dst = src;
public bool ConcurrentWriter(ref MyKey key, ref MyValue src, ref MyValue dst) { dst = src; return true; }

public void ReadCompletionCallback(ref MyKey key, ref MyInput input, ref MyOutput output, MyContext ctx, Status status) { }
public void UpsertCompletionCallback(ref MyKey key, ref MyValue value, MyContext ctx) { }
Expand Down
6 changes: 4 additions & 2 deletions cs/playground/FixedLenStructSample/Functions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ public void ConcurrentReader(ref FixedLenKey key, ref string input, ref FixedLen
dst = value.ToString();
}

public void ConcurrentWriter(ref FixedLenKey key, ref FixedLenValue src, ref FixedLenValue dst)
public bool ConcurrentWriter(ref FixedLenKey key, ref FixedLenValue src, ref FixedLenValue dst)
{
src.CopyTo(ref dst);
return true;
}

public void CopyUpdater(ref FixedLenKey key, ref string input, ref FixedLenValue oldValue, ref FixedLenValue newValue)
Expand All @@ -37,8 +38,9 @@ public void InitialUpdater(ref FixedLenKey key, ref string input, ref FixedLenVa
{
}

public void InPlaceUpdater(ref FixedLenKey key, ref string input, ref FixedLenValue value)
public bool InPlaceUpdater(ref FixedLenKey key, ref string input, ref FixedLenValue value)
{
return true;
}

public void ReadCompletionCallback(ref FixedLenKey key, ref string input, ref string output, Empty ctx, Status status)
Expand Down
5 changes: 3 additions & 2 deletions cs/playground/PeriodicCompaction/Types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ public void ConcurrentReader(ref CacheKey key, ref CacheInput input, ref CacheVa
dst.value = value;
}

public void ConcurrentWriter(ref CacheKey key, ref CacheValue src, ref CacheValue dst)
public bool ConcurrentWriter(ref CacheKey key, ref CacheValue src, ref CacheValue dst)
{
dst = src;
return true;
}

public void CopyUpdater(ref CacheKey key, ref CacheInput input, ref CacheValue oldValue, ref CacheValue newValue)
Expand All @@ -107,7 +108,7 @@ public void InitialUpdater(ref CacheKey key, ref CacheInput input, ref CacheValu
throw new NotImplementedException();
}

public void InPlaceUpdater(ref CacheKey key, ref CacheInput input, ref CacheValue value)
public bool InPlaceUpdater(ref CacheKey key, ref CacheInput input, ref CacheValue value)
{
throw new NotImplementedException();
}
Expand Down
9 changes: 5 additions & 4 deletions cs/playground/StructSample/Functions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ public class Sample1Funcs : IFunctions<long, long, long, long, Empty>

// Write functions
public void SingleWriter(ref long key, ref long src, ref long dst) => dst = src;
public void ConcurrentWriter(ref long key, ref long src, ref long dst) => dst = src;
public bool ConcurrentWriter(ref long key, ref long src, ref long dst) { dst = src; return true; }

// RMW functions
public void InitialUpdater(ref long key, ref long input, ref long value) => value = input;
public void CopyUpdater(ref long key, ref long input, ref long oldv, ref long newv) => newv = oldv + input;
public void InPlaceUpdater(ref long key, ref long input, ref long value) => value += input;
public bool InPlaceUpdater(ref long key, ref long input, ref long value) { value += input; return true; }

// Completion callbacks
public void ReadCompletionCallback(ref long key, ref long input, ref long output, Empty ctx, Status s) { }
Expand All @@ -46,7 +46,7 @@ public class Sample2Funcs : IFunctions<Key, Value, Input, Output, Empty>

// Write functions
public void SingleWriter(ref Key key, ref Value src, ref Value dst) => dst = src;
public void ConcurrentWriter(ref Key key, ref Value src, ref Value dst) => dst = src;
public bool ConcurrentWriter(ref Key key, ref Value src, ref Value dst) { dst = src; return true; }

// RMW functions
public void InitialUpdater(ref Key key, ref Input input, ref Value value)
Expand All @@ -59,10 +59,11 @@ public void CopyUpdater(ref Key key, ref Input input, ref Value oldValue, ref Va
newValue.vfield1 = oldValue.vfield1 + input.ifield1;
newValue.vfield2 = oldValue.vfield2 + input.ifield2;
}
public void InPlaceUpdater(ref Key key, ref Input input, ref Value value)
public bool InPlaceUpdater(ref Key key, ref Input input, ref Value value)
{
value.vfield1 += input.ifield1;
value.vfield2 += input.ifield2;
return true;
}

// Completion callbacks
Expand Down
9 changes: 5 additions & 4 deletions cs/playground/StructSampleCore/Functions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ public class Sample1Funcs : IFunctions<long, long, long, long, Empty>

// Write functions
public void SingleWriter(ref long key, ref long src, ref long dst) => dst = src;
public void ConcurrentWriter(ref long key, ref long src, ref long dst) => dst = src;
public bool ConcurrentWriter(ref long key, ref long src, ref long dst) { dst = src; return true; }

// RMW functions
public void InitialUpdater(ref long key, ref long input, ref long value) => value = input;
public void CopyUpdater(ref long key, ref long input, ref long oldv, ref long newv) => newv = oldv + input;
public void InPlaceUpdater(ref long key, ref long input, ref long value) => value += input;
public bool InPlaceUpdater(ref long key, ref long input, ref long value) { value += input; return true; }

// Completion callbacks
public void ReadCompletionCallback(ref long key, ref long input, ref long output, Empty ctx, Status s) { }
Expand All @@ -46,7 +46,7 @@ public class Sample2Funcs : IFunctions<Key, Value, Input, Output, Empty>

// Write functions
public void SingleWriter(ref Key key, ref Value src, ref Value dst) => dst = src;
public void ConcurrentWriter(ref Key key, ref Value src, ref Value dst) => dst = src;
public bool ConcurrentWriter(ref Key key, ref Value src, ref Value dst) { dst = src; return true; }

// RMW functions
public void InitialUpdater(ref Key key, ref Input input, ref Value value)
Expand All @@ -59,10 +59,11 @@ public void CopyUpdater(ref Key key, ref Input input, ref Value oldValue, ref Va
newValue.vfield1 = oldValue.vfield1 + input.ifield1;
newValue.vfield2 = oldValue.vfield2 + input.ifield2;
}
public void InPlaceUpdater(ref Key key, ref Input input, ref Value value)
public bool InPlaceUpdater(ref Key key, ref Input input, ref Value value)
{
value.vfield1 += input.ifield1;
value.vfield2 += input.ifield2;
return true;
}

// Completion callbacks
Expand Down
6 changes: 4 additions & 2 deletions cs/playground/SumStore/SumStoreTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ public void SingleWriter(ref AdId key, ref NumClicks src, ref NumClicks dst)
dst = src;
}

public void ConcurrentWriter(ref AdId key, ref NumClicks src, ref NumClicks dst)
public bool ConcurrentWriter(ref AdId key, ref NumClicks src, ref NumClicks dst)
{
dst = src;
return true;
}

// RMW functions
Expand All @@ -95,9 +96,10 @@ public void InitialUpdater(ref AdId key, ref Input input, ref NumClicks value)
value = input.numClicks;
}

public void InPlaceUpdater(ref AdId key, ref Input input, ref NumClicks value)
public bool InPlaceUpdater(ref AdId key, ref Input input, ref NumClicks value)
{
Interlocked.Add(ref value.numClicks, input.numClicks.numClicks);
return true;
}

public void CopyUpdater(ref AdId key, ref Input input, ref NumClicks oldValue, ref NumClicks newValue)
Expand Down
6 changes: 4 additions & 2 deletions cs/playground/VarLenStructSample/Functions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,20 @@ public void SingleWriter(ref VarLenType key, ref VarLenType src, ref VarLenType
src.CopyTo(ref dst);
}

public void ConcurrentWriter(ref VarLenType key, ref VarLenType src, ref VarLenType dst)
public bool ConcurrentWriter(ref VarLenType key, ref VarLenType src, ref VarLenType dst)
{
src.CopyTo(ref dst);
return true;
}

// RMW functions
public void InitialUpdater(ref VarLenType key, ref int[] input, ref VarLenType value)
{
}

public void InPlaceUpdater(ref VarLenType key, ref int[] input, ref VarLenType value)
public bool InPlaceUpdater(ref VarLenType key, ref int[] input, ref VarLenType value)
{
return true;
}

public void CopyUpdater(ref VarLenType key, ref int[] input, ref VarLenType oldValue, ref VarLenType newValue)
Expand Down
Loading

0 comments on commit b2479ed

Please sign in to comment.