Skip to content

Commit

Permalink
Merge branch 'main' into users/padgupta/add_flag_to_control_tlscheck
Browse files Browse the repository at this point in the history
  • Loading branch information
badrishc authored May 29, 2024
2 parents d4e164e + ade2991 commit 0d1e397
Show file tree
Hide file tree
Showing 33 changed files with 593 additions and 1,629 deletions.
5 changes: 3 additions & 2 deletions Garnet.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
<dependency id="Microsoft.Extensions.Logging.Console" version="8.0.0" />
<dependency id="Newtonsoft.Json" version="13.0.3" />
<dependency id="CommandLineParser" version="2.9.1" />
<dependency id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="6.28.1" />
<dependency id="System.IdentityModel.Tokens.Jwt" version="6.34.0" />
<dependency id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="7.5.1" />
<dependency id="System.IdentityModel.Tokens.Jwt" version="7.5.1" />
<dependency id="Microsoft.IdentityModel.Validators" version="7.5.1" />
<dependency id="Azure.Storage.Blobs" version="12.14.1" />
</dependencies>
<readme>README.md</readme>
Expand Down
124 changes: 124 additions & 0 deletions libs/client/GarnetClientAPI/GarnetClientListCommands.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Garnet.client
{
public sealed partial class GarnetClient
{
private static readonly Memory<byte> LPUSH = "$5\r\nLPUSH\r\n"u8.ToArray();
private static readonly Memory<byte> RPUSH = "$5\r\nRPUSH\r\n"u8.ToArray();

/// <summary>
/// Add the specified element to the head of the list stored at key
/// </summary>
/// <param name="key">The key of the list</param>
/// <param name="element">The element to be added</param>
/// <param name="callback">The callback function when operation completes</param>
/// <param name="context">An optional context to correlate request to callback</param>
public void ListLeftPush(string key, string element, Action<long, long, string> callback, long context = 0)
{
ListLeftPush(key, new[] { element }, callback, context);
}

/// <summary>
/// Add the specified elements to the head of the list stored at key
/// </summary>
/// <param name="key">The key of the list</param>
/// <param name="elements">The elements to be added</param>
/// <param name="callback">The callback function when operation completes</param>
/// <param name="context">An optional context to correlate request to callback</param>
public void ListLeftPush(string key, IEnumerable<string> elements, Action<long, long, string> callback, long context = 0)
{
ArgumentNullException.ThrowIfNull(key);
ArgumentNullException.ThrowIfNull(elements);
ArgumentNullException.ThrowIfNull(callback);

var arrElem = new[] { key }.Union(elements).ToArray();

if (arrElem.Length == 1)
{
throw new ArgumentException("Elements collection cannot be empty.", nameof(elements));
}

ExecuteForLongResult(callback, context, nameof(LPUSH), arrElem);
}

/// <summary>
/// Asynchronously add the specified elements to the head of the list stored at key
/// </summary>
/// <param name="key">The key of the list</param>
/// <param name="elements">The elements to be added</param>
/// <returns>The number of list elements after the addition</returns>
public async Task<long> ListLeftPushAsync(string key, params string[] elements)
{
ArgumentNullException.ThrowIfNull(key);
ArgumentNullException.ThrowIfNull(elements);

if (elements.Length == 0)
{
throw new ArgumentException("Elements collection cannot be empty.", nameof(elements));
}

return await ExecuteForLongResultAsync(nameof(LPUSH), [key, .. elements]);
}

/// <summary>
/// Add the specified element to the tail of the list stored at key
/// </summary>
/// <param name="key">The key of the list</param>
/// <param name="element">The element to be added</param>
/// <param name="callback">The callback function when operation completes</param>
/// <param name="context">An optional context to correlate request to callback</param>
public void ListRightPush(string key, string element, Action<long, long, string> callback, long context = 0)
{
ListRightPush(key, new[] { element }, callback, context);
}

/// <summary>
/// Add the specified elements to the tail of the list stored at key
/// </summary>
/// <param name="key">The key of the list</param>
/// <param name="elements">The elements to be added</param>
/// <param name="callback">The callback function when operation completes</param>
/// <param name="context">An optional context to correlate request to callback</param>
public void ListRightPush(string key, IEnumerable<string> elements, Action<long, long, string> callback, long context = 0)
{
ArgumentNullException.ThrowIfNull(key);
ArgumentNullException.ThrowIfNull(elements);
ArgumentNullException.ThrowIfNull(callback);

var arrElem = new[] { key }.Union(elements).ToArray();

if (arrElem.Length == 1)
{
throw new ArgumentException("Elements collection cannot be empty.", nameof(elements));
}

ExecuteForLongResult(callback, context, nameof(RPUSH), arrElem);
}

/// <summary>
/// Asynchronously add the specified elements to the tail of the list stored at key
/// </summary>
/// <param name="key">The key of the list</param>
/// <param name="elements">The elements to be added</param>
/// <returns>The number of list elements after the addition</returns>
public async Task<long> ListRightPushAsync(string key, params string[] elements)
{
ArgumentNullException.ThrowIfNull(key);
ArgumentNullException.ThrowIfNull(elements);

if (elements.Length == 0)
{
throw new ArgumentException("Elements collection cannot be empty.", nameof(elements));
}

return await ExecuteForLongResultAsync(nameof(RPUSH), [key, .. elements]);
}
}
}
5 changes: 2 additions & 3 deletions libs/storage/Tsavorite/cs/benchmark/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ class Options
[Option('z', "locking", Required = false, Default = ConcurrencyControlMode.None,
HelpText = "Locking Implementation:" +
$"\n {nameof(ConcurrencyControlMode.None)} = No Locking (default)" +
$"\n {nameof(ConcurrencyControlMode.LockTable)} = Locking using main HashTable buckets" +
$"\n {nameof(ConcurrencyControlMode.RecordIsolation)} = RecordInfo locking only within concurrent IFunctions callbacks")]
$"\n {nameof(ConcurrencyControlMode.LockTable)} = Locking using main HashTable buckets")]
public ConcurrencyControlMode ConcurrencyControlMode { get; set; }

[Option('i', "iterations", Required = false, Default = 1,
Expand Down Expand Up @@ -118,7 +117,7 @@ class Options
public string GetOptionsString()
{
static string boolStr(bool value) => value ? "y" : "n";
return $"-b: {Benchmark}; d: {DistributionName.ToLower()}; n: {NumaStyle}; rumd: {string.Join(',', RumdPercents)}; reviv: {RevivificationLevel}; revivbinrecs: {RevivBinRecordCount};"
return $"b: {Benchmark}; d: {DistributionName.ToLower()}; n: {NumaStyle}; rumd: {string.Join(',', RumdPercents)}; reviv: {RevivificationLevel}; revivbinrecs: {RevivBinRecordCount};"
+ $" revivfrac {RevivifiableFraction}; t: {ThreadCount}; z: {ConcurrencyControlMode}; i: {IterationCount}; hp: {HashPacking};"
+ $" sd: {boolStr(UseSmallData)}; sm: {boolStr(UseSmallMemoryLog)}; sy: {boolStr(UseSyntheticData)}; safectx: {boolStr(UseSafeContext)};"
+ $" chkptms: {PeriodicCheckpointMilliseconds}; chkpttype: {(PeriodicCheckpointMilliseconds > 0 ? PeriodicCheckpointType.ToString() : "None")};"
Expand Down
Loading

0 comments on commit 0d1e397

Please sign in to comment.