Skip to content

Commit

Permalink
feat: update names to be in line with name proposal (#92)
Browse files Browse the repository at this point in the history
This commit applies the "Batch" and "Fetch" terminology.
  • Loading branch information
malandis authored Aug 2, 2022
1 parent c9aaec5 commit 5ea1ee8
Show file tree
Hide file tree
Showing 12 changed files with 328 additions and 328 deletions.
248 changes: 124 additions & 124 deletions IncubatingIntegrationTest/DictionaryTest.cs

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions Momento/ISimpleCacheClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,47 +95,47 @@ public interface ISimpleCacheClient : IDisposable
/// <param name="cacheName">Name of the cache to perform the lookup in.</param>
/// <param name="keys">The keys to get.</param>
/// <returns>Task object representing the statuses of the get operation and the associated values.</returns>
public Task<CacheGetMultiResponse> GetMultiAsync(string cacheName, IEnumerable<byte[]> keys);
public Task<CacheGetBatchResponse> GetBatchAsync(string cacheName, IEnumerable<byte[]> keys);

/// <summary>
/// Gets multiple values from the cache.
/// </summary>
/// <param name="cacheName">Name of the cache to perform the lookup in.</param>
/// <param name="keys">The keys to get.</param>
/// <returns>Task object representing the statuses of the get operation and the associated values.</returns>
public Task<CacheGetMultiResponse> GetMultiAsync(string cacheName, IEnumerable<string> keys);
public Task<CacheGetBatchResponse> GetBatchAsync(string cacheName, IEnumerable<string> keys);

/// <summary>
/// Gets multiple values from the cache.
/// </summary>
/// <param name="cacheName">Name of the cache to perform the lookup in.</param>
/// <param name="keys">The keys to get.</param>
/// <returns>Task object representing the statuses of the get operation and the associated values.</returns>
public Task<CacheGetMultiResponse> GetMultiAsync(string cacheName, params byte[][] keys);
public Task<CacheGetBatchResponse> GetBatchAsync(string cacheName, params byte[][] keys);

/// <summary>
/// Gets multiple values from the cache.
/// </summary>
/// <param name="cacheName">Name of the cache to perform the lookup in.</param>
/// <param name="keys">The keys to get.</param>
/// <returns>Task object representing the statuses of the get operation and the associated values.</returns>
public Task<CacheGetMultiResponse> GetMultiAsync(string cacheName, params string[] keys);
public Task<CacheGetBatchResponse> GetBatchAsync(string cacheName, params string[] keys);

/// <summary>
/// Sets multiple items in the cache. Overwrites existing items.
/// </summary>
/// <param name="cacheName">Name of the cache to store the items in.</param>
/// <param name="items">The items to set.</param>
/// <returns>Task object representing the result of the set operation.</returns>
public Task<CacheSetMultiResponse> SetMultiAsync(string cacheName, IEnumerable<KeyValuePair<byte[], byte[]>> items, uint? ttlSeconds = null);
public Task<CacheSetBatchResponse> SetBatchAsync(string cacheName, IEnumerable<KeyValuePair<byte[], byte[]>> items, uint? ttlSeconds = null);

/// <summary>
/// Sets multiple items in the cache. Overwrites existing items.
/// </summary>
/// <param name="cacheName">Name of the cache to store the items in.</param>
/// <param name="items">The items to set.</param>
/// <returns>Task object representing the result of the set operation.</returns>
public Task<CacheSetMultiResponse> SetMultiAsync(string cacheName, IEnumerable<KeyValuePair<string, string>> items, uint? ttlSeconds = null);
public Task<CacheSetBatchResponse> SetBatchAsync(string cacheName, IEnumerable<KeyValuePair<string, string>> items, uint? ttlSeconds = null);

/// <summary>
/// Set the value in the cache. If a value for this key is already present it will be replaced by the new value.
Expand Down Expand Up @@ -186,47 +186,47 @@ public interface ISimpleCacheClient : IDisposable
/// <param name="cacheName">Name of the cache to perform the lookup in.</param>
/// <param name="keys">The keys to get.</param>
/// <returns>Object with the statuses of the get operation and the associated values.</returns>
public CacheGetMultiResponse GetMulti(string cacheName, IEnumerable<byte[]> keys);
public CacheGetBatchResponse GetBatch(string cacheName, IEnumerable<byte[]> keys);

/// <summary>
/// Gets multiple values from the cache.
/// </summary>
/// <param name="cacheName">Name of the cache to perform the lookup in.</param>
/// <param name="keys">The keys to get.</param>
/// <returns>Object with the statuses of the get operation and the associated values.</returns>
public CacheGetMultiResponse GetMulti(string cacheName, IEnumerable<string> keys);
public CacheGetBatchResponse GetBatch(string cacheName, IEnumerable<string> keys);

/// <summary>
/// Gets multiple values from the cache.
/// </summary>
/// <param name="cacheName">Name of the cache to perform the lookup in.</param>
/// <param name="keys">The keys to get.</param>
/// <returns>Object with the statuses of the get operation and the associated values.</returns>
public CacheGetMultiResponse GetMulti(string cacheName, params byte[][] keys);
public CacheGetBatchResponse GetBatch(string cacheName, params byte[][] keys);

/// <summary>
/// Gets multiple values from the cache.
/// </summary>
/// <param name="cacheName">Name of the cache to perform the lookup in.</param>
/// <param name="keys">The keys to get.</param>
/// <returns>Object with the statuses of the get operation and the associated values.</returns>
public CacheGetMultiResponse GetMulti(string cacheName, params string[] keys);
public CacheGetBatchResponse GetBatch(string cacheName, params string[] keys);

/// <summary>
/// Sets multiple items in the cache. Overwrites existing items.
/// </summary>
/// <param name="cacheName">Name of the cache to store the items in.</param>
/// <param name="items">The items to set.</param>
/// <returns>Result of the set operation.</returns>
public CacheSetMultiResponse SetMulti(string cacheName, IEnumerable<KeyValuePair<byte[], byte[]>> items, uint? ttlSeconds = null);
public CacheSetBatchResponse SetBatch(string cacheName, IEnumerable<KeyValuePair<byte[], byte[]>> items, uint? ttlSeconds = null);

/// <summary>
/// Sets multiple items in the cache. Overwrites existing items.
/// </summary>
/// <param name="cacheName">Name of the cache to store the items in.</param>
/// <param name="items">The items to set.</param>
/// <returns>Result of the set operation.</returns>
public CacheSetMultiResponse SetMulti(string cacheName, IEnumerable<KeyValuePair<string, string>> items, uint? ttlSeconds = null);
public CacheSetBatchResponse SetBatch(string cacheName, IEnumerable<KeyValuePair<string, string>> items, uint? ttlSeconds = null);

/// <summary>
/// Remove the key from the cache.
Expand Down
72 changes: 36 additions & 36 deletions Momento/Incubating/Internal/ScsDataClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,19 +137,19 @@ private async Task<CacheDictionaryGetResponse> SendDictionaryGetAsync(string cac
}
}

public CacheDictionarySetMultiResponse DictionarySetMulti(string cacheName, string dictionaryName, IEnumerable<KeyValuePair<byte[], byte[]>> items, bool refreshTtl, uint? ttlSeconds = null)
public CacheDictionarySetBatchResponse DictionarySetBatch(string cacheName, string dictionaryName, IEnumerable<KeyValuePair<byte[], byte[]>> items, bool refreshTtl, uint? ttlSeconds = null)
{
var protoItems = items.Select(kv => new _DictionaryKeyValuePair() { Key = kv.Key.ToByteString(), Value = kv.Value.ToByteString() });
return SendDictionarySetMulti(cacheName, dictionaryName, protoItems, refreshTtl, ttlSeconds);
return SendDictionarySetBatch(cacheName, dictionaryName, protoItems, refreshTtl, ttlSeconds);
}

public CacheDictionarySetMultiResponse DictionarySetMulti(string cacheName, string dictionaryName, IEnumerable<KeyValuePair<string, string>> items, bool refreshTtl, uint? ttlSeconds = null)
public CacheDictionarySetBatchResponse DictionarySetBatch(string cacheName, string dictionaryName, IEnumerable<KeyValuePair<string, string>> items, bool refreshTtl, uint? ttlSeconds = null)
{
var protoItems = items.Select(kv => new _DictionaryKeyValuePair() { Key = kv.Key.ToByteString(), Value = kv.Value.ToByteString() });
return SendDictionarySetMulti(cacheName, dictionaryName, protoItems, refreshTtl, ttlSeconds);
return SendDictionarySetBatch(cacheName, dictionaryName, protoItems, refreshTtl, ttlSeconds);
}

public CacheDictionarySetMultiResponse SendDictionarySetMulti(string cacheName, string dictionaryName, IEnumerable<_DictionaryKeyValuePair> items, bool refreshTtl, uint? ttlSeconds = null)
public CacheDictionarySetBatchResponse SendDictionarySetBatch(string cacheName, string dictionaryName, IEnumerable<_DictionaryKeyValuePair> items, bool refreshTtl, uint? ttlSeconds = null)
{
_DictionarySetRequest request = new()
{
Expand All @@ -167,22 +167,22 @@ public CacheDictionarySetMultiResponse SendDictionarySetMulti(string cacheName,
{
throw CacheExceptionMapper.Convert(e);
}
return new CacheDictionarySetMultiResponse();
return new CacheDictionarySetBatchResponse();
}

public async Task<CacheDictionarySetMultiResponse> DictionarySetMultiAsync(string cacheName, string dictionaryName, IEnumerable<KeyValuePair<byte[], byte[]>> items, bool refreshTtl, uint? ttlSeconds = null)
public async Task<CacheDictionarySetBatchResponse> DictionarySetBatchAsync(string cacheName, string dictionaryName, IEnumerable<KeyValuePair<byte[], byte[]>> items, bool refreshTtl, uint? ttlSeconds = null)
{
var protoItems = items.Select(kv => new _DictionaryKeyValuePair() { Key = kv.Key.ToByteString(), Value = kv.Value.ToByteString() });
return await SendDictionarySetMultiAsync(cacheName, dictionaryName, protoItems, refreshTtl, ttlSeconds);
return await SendDictionarySetBatchAsync(cacheName, dictionaryName, protoItems, refreshTtl, ttlSeconds);
}

public async Task<CacheDictionarySetMultiResponse> DictionarySetMultiAsync(string cacheName, string dictionaryName, IEnumerable<KeyValuePair<string, string>> items, bool refreshTtl, uint? ttlSeconds = null)
public async Task<CacheDictionarySetBatchResponse> DictionarySetBatchAsync(string cacheName, string dictionaryName, IEnumerable<KeyValuePair<string, string>> items, bool refreshTtl, uint? ttlSeconds = null)
{
var protoItems = items.Select(kv => new _DictionaryKeyValuePair() { Key = kv.Key.ToByteString(), Value = kv.Value.ToByteString() });
return await SendDictionarySetMultiAsync(cacheName, dictionaryName, protoItems, refreshTtl, ttlSeconds);
return await SendDictionarySetBatchAsync(cacheName, dictionaryName, protoItems, refreshTtl, ttlSeconds);
}

public async Task<CacheDictionarySetMultiResponse> SendDictionarySetMultiAsync(string cacheName, string dictionaryName, IEnumerable<_DictionaryKeyValuePair> items, bool refreshTtl, uint? ttlSeconds = null)
public async Task<CacheDictionarySetBatchResponse> SendDictionarySetBatchAsync(string cacheName, string dictionaryName, IEnumerable<_DictionaryKeyValuePair> items, bool refreshTtl, uint? ttlSeconds = null)
{
_DictionarySetRequest request = new()
{
Expand All @@ -200,30 +200,30 @@ public async Task<CacheDictionarySetMultiResponse> SendDictionarySetMultiAsync(s
{
throw CacheExceptionMapper.Convert(e);
}
return new CacheDictionarySetMultiResponse();
return new CacheDictionarySetBatchResponse();
}

public CacheDictionaryGetMultiResponse DictionaryGetMulti(string cacheName, string dictionaryName, params byte[][] fields)
public CacheDictionaryGetBatchResponse DictionaryGetBatch(string cacheName, string dictionaryName, params byte[][] fields)
{
return SendDictionaryGetMulti(cacheName, dictionaryName, fields.Select(field => field.ToByteString()));
return SendDictionaryGetBatch(cacheName, dictionaryName, fields.Select(field => field.ToByteString()));
}

public CacheDictionaryGetMultiResponse DictionaryGetMulti(string cacheName, string dictionaryName, params string[] fields)
public CacheDictionaryGetBatchResponse DictionaryGetBatch(string cacheName, string dictionaryName, params string[] fields)
{
return SendDictionaryGetMulti(cacheName, dictionaryName, fields.Select(field => field.ToByteString()));
return SendDictionaryGetBatch(cacheName, dictionaryName, fields.Select(field => field.ToByteString()));
}

public CacheDictionaryGetMultiResponse DictionaryGetMulti(string cacheName, string dictionaryName, IEnumerable<byte[]> fields)
public CacheDictionaryGetBatchResponse DictionaryGetBatch(string cacheName, string dictionaryName, IEnumerable<byte[]> fields)
{
return SendDictionaryGetMulti(cacheName, dictionaryName, fields.Select(field => field.ToByteString()));
return SendDictionaryGetBatch(cacheName, dictionaryName, fields.Select(field => field.ToByteString()));
}

public CacheDictionaryGetMultiResponse DictionaryGetMulti(string cacheName, string dictionaryName, IEnumerable<string> fields)
public CacheDictionaryGetBatchResponse DictionaryGetBatch(string cacheName, string dictionaryName, IEnumerable<string> fields)
{
return SendDictionaryGetMulti(cacheName, dictionaryName, fields.Select(field => field.ToByteString()));
return SendDictionaryGetBatch(cacheName, dictionaryName, fields.Select(field => field.ToByteString()));
}

private CacheDictionaryGetMultiResponse SendDictionaryGetMulti(string cacheName, string dictionaryName, IEnumerable<ByteString> fields)
private CacheDictionaryGetBatchResponse SendDictionaryGetBatch(string cacheName, string dictionaryName, IEnumerable<ByteString> fields)
{
_DictionaryGetRequest request = new() { DictionaryName = dictionaryName.ToByteString() };
request.DictionaryKeys.Add(fields);
Expand All @@ -237,30 +237,30 @@ private CacheDictionaryGetMultiResponse SendDictionaryGetMulti(string cacheName,
{
throw CacheExceptionMapper.Convert(e);
}
return new CacheDictionaryGetMultiResponse(response);
return new CacheDictionaryGetBatchResponse(response);
}

public async Task<CacheDictionaryGetMultiResponse> DictionaryGetMultiAsync(string cacheName, string dictionaryName, params byte[][] fields)
public async Task<CacheDictionaryGetBatchResponse> DictionaryGetBatchAsync(string cacheName, string dictionaryName, params byte[][] fields)
{
return await SendDictionaryGetMultiAsync(cacheName, dictionaryName, fields.Select(field => field.ToByteString()));
return await SendDictionaryGetBatchAsync(cacheName, dictionaryName, fields.Select(field => field.ToByteString()));
}

public async Task<CacheDictionaryGetMultiResponse> DictionaryGetMultiAsync(string cacheName, string dictionaryName, params string[] fields)
public async Task<CacheDictionaryGetBatchResponse> DictionaryGetBatchAsync(string cacheName, string dictionaryName, params string[] fields)
{
return await SendDictionaryGetMultiAsync(cacheName, dictionaryName, fields.Select(field => field.ToByteString()));
return await SendDictionaryGetBatchAsync(cacheName, dictionaryName, fields.Select(field => field.ToByteString()));
}

public async Task<CacheDictionaryGetMultiResponse> DictionaryGetMultiAsync(string cacheName, string dictionaryName, IEnumerable<byte[]> fields)
public async Task<CacheDictionaryGetBatchResponse> DictionaryGetBatchAsync(string cacheName, string dictionaryName, IEnumerable<byte[]> fields)
{
return await SendDictionaryGetMultiAsync(cacheName, dictionaryName, fields.Select(field => field.ToByteString()));
return await SendDictionaryGetBatchAsync(cacheName, dictionaryName, fields.Select(field => field.ToByteString()));
}

public async Task<CacheDictionaryGetMultiResponse> DictionaryGetMultiAsync(string cacheName, string dictionaryName, IEnumerable<string> fields)
public async Task<CacheDictionaryGetBatchResponse> DictionaryGetBatchAsync(string cacheName, string dictionaryName, IEnumerable<string> fields)
{
return await SendDictionaryGetMultiAsync(cacheName, dictionaryName, fields.Select(field => field.ToByteString()));
return await SendDictionaryGetBatchAsync(cacheName, dictionaryName, fields.Select(field => field.ToByteString()));
}

private async Task<CacheDictionaryGetMultiResponse> SendDictionaryGetMultiAsync(string cacheName, string dictionaryName, IEnumerable<ByteString> fields)
private async Task<CacheDictionaryGetBatchResponse> SendDictionaryGetBatchAsync(string cacheName, string dictionaryName, IEnumerable<ByteString> fields)
{
_DictionaryGetRequest request = new() { DictionaryName = dictionaryName.ToByteString() };
request.DictionaryKeys.Add(fields);
Expand All @@ -274,10 +274,10 @@ private async Task<CacheDictionaryGetMultiResponse> SendDictionaryGetMultiAsync(
{
throw CacheExceptionMapper.Convert(e);
}
return new CacheDictionaryGetMultiResponse(response);
return new CacheDictionaryGetBatchResponse(response);
}

public CacheDictionaryGetAllResponse DictionaryGetAll(string cacheName, string dictionaryName)
public CacheDictionaryFetchResponse DictionaryFetch(string cacheName, string dictionaryName)
{
_DictionaryGetAllRequest request = new() { DictionaryName = dictionaryName.ToByteString() };
_DictionaryGetAllResponse response;
Expand All @@ -289,10 +289,10 @@ public CacheDictionaryGetAllResponse DictionaryGetAll(string cacheName, string d
{
throw CacheExceptionMapper.Convert(e);
}
return new CacheDictionaryGetAllResponse(response);
return new CacheDictionaryFetchResponse(response);
}

public async Task<CacheDictionaryGetAllResponse> DictionaryGetAllAsync(string cacheName, string dictionaryName)
public async Task<CacheDictionaryFetchResponse> DictionaryFetchAsync(string cacheName, string dictionaryName)
{
_DictionaryGetAllRequest request = new() { DictionaryName = dictionaryName.ToByteString() };
_DictionaryGetAllResponse response;
Expand All @@ -304,7 +304,7 @@ public async Task<CacheDictionaryGetAllResponse> DictionaryGetAllAsync(string ca
{
throw CacheExceptionMapper.Convert(e);
}
return new CacheDictionaryGetAllResponse(response);
return new CacheDictionaryFetchResponse(response);
}

public CacheDictionaryDeleteResponse DictionaryDelete(string cacheName, string dictionaryName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

namespace MomentoSdk.Incubating.Responses;

public class CacheDictionaryGetAllResponse
public class CacheDictionaryFetchResponse
{
public CacheGetStatus Status { get; private set; }
public Dictionary<byte[], byte[]>? ByteArrayDictionary { get; private set; }

public CacheDictionaryGetAllResponse(_DictionaryGetAllResponse response)
public CacheDictionaryFetchResponse(_DictionaryGetAllResponse response)
{
Status = CacheGetStatusUtil.From(response.Result);
if (Status == CacheGetStatus.MISS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

namespace MomentoSdk.Incubating.Responses;

public class CacheDictionaryGetMultiResponse
public class CacheDictionaryGetBatchResponse
{
public IEnumerable<CacheDictionaryGetResponse> Responses { get; private set; }

public CacheDictionaryGetMultiResponse(_DictionaryGetResponse responses)
public CacheDictionaryGetBatchResponse(_DictionaryGetResponse responses)
{
this.Responses = responses.DictionaryBody.Select(response => new CacheDictionaryGetResponse(response));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

namespace MomentoSdk.Incubating.Responses;

public class CacheDictionarySetMultiResponse
public class CacheDictionarySetBatchResponse
{
}
Loading

0 comments on commit 5ea1ee8

Please sign in to comment.