-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement dictionary increment (#153)
Implement DictionaryIncrementAsync and add integration tests. Handles error case where one tries to increment a field that doesn't store a number.
- Loading branch information
Showing
8 changed files
with
138 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace Momento.Sdk.Exceptions; | ||
|
||
/// <summary> | ||
/// The server did not meet the precondition to run a command. | ||
/// | ||
/// For example, calling <c>Increment</c> on a key that doesn't store | ||
/// a number. | ||
/// </summary> | ||
public class FailedPreconditionException : MomentoServiceException | ||
{ | ||
public FailedPreconditionException(string message) : base(message) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 4 additions & 10 deletions
14
src/Momento.Sdk/Incubating/Responses/CacheDictionaryIncrementResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,13 @@ | ||
namespace Momento.Sdk.Incubating.Responses; | ||
using Momento.Protos.CacheClient; | ||
|
||
public enum CacheDictionaryIncrementStatus | ||
{ | ||
OK, | ||
PARSE_ERROR | ||
} | ||
namespace Momento.Sdk.Incubating.Responses; | ||
|
||
public class CacheDictionaryIncrementResponse | ||
{ | ||
public CacheDictionaryIncrementStatus Status { get; private set; } | ||
public long? Value { get; private set; } | ||
|
||
public CacheDictionaryIncrementResponse() | ||
public CacheDictionaryIncrementResponse(_DictionaryIncrementResponse response) | ||
{ | ||
Status = CacheDictionaryIncrementStatus.OK; | ||
Value = 42; | ||
Value = response.Value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters