|
| 1 | +// Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 |
| 2 | + |
| 3 | +namespace Valkey.Glide.Commands; |
| 4 | + |
| 5 | +/// <summary> |
| 6 | +/// Supports commands for the "HyperLogLog" group for a standalone client. |
| 7 | +/// <br /> |
| 8 | +/// See <see href="https://valkey.io/commands#hyperloglog">HyperLogLog Commands</see>. |
| 9 | +/// </summary> |
| 10 | +public interface IHyperLogLogCommands |
| 11 | +{ |
| 12 | + /// <summary> |
| 13 | + /// Adds one element to the HyperLogLog data structure stored at the specified key. |
| 14 | + /// </summary> |
| 15 | + /// <seealso href="https://valkey.io/commands/pfadd/"/> |
| 16 | + /// <param name="key">The key of the HyperLogLog.</param> |
| 17 | + /// <param name="element">The element to add to the HyperLogLog.</param> |
| 18 | + /// <param name="flags">The command flags. Currently flags are ignored.</param> |
| 19 | + /// <returns> |
| 20 | + /// <see langword="true"/> if at least one HyperLogLog internal register was altered, |
| 21 | + /// <see langword="false"/> otherwise. |
| 22 | + /// </returns> |
| 23 | + /// <remarks> |
| 24 | + /// <example> |
| 25 | + /// <code> |
| 26 | + /// bool result = await client.HyperLogLogAddAsync("my_hll", "element1"); |
| 27 | + /// Console.WriteLine(result); // Output: True (if this is a new element) |
| 28 | + /// </code> |
| 29 | + /// </example> |
| 30 | + /// </remarks> |
| 31 | + Task<bool> HyperLogLogAddAsync(ValkeyKey key, ValkeyValue element, CommandFlags flags = CommandFlags.None); |
| 32 | + |
| 33 | + /// <summary> |
| 34 | + /// Adds multiple elements to the HyperLogLog data structure stored at the specified key. |
| 35 | + /// </summary> |
| 36 | + /// <seealso href="https://valkey.io/commands/pfadd/"/> |
| 37 | + /// <param name="key">The key of the HyperLogLog.</param> |
| 38 | + /// <param name="elements">The elements to add to the HyperLogLog.</param> |
| 39 | + /// <param name="flags">The command flags. Currently flags are ignored.</param> |
| 40 | + /// <returns> |
| 41 | + /// <see langword="true"/> if at least one HyperLogLog internal register was altered, |
| 42 | + /// <see langword="false"/> otherwise. |
| 43 | + /// </returns> |
| 44 | + /// <remarks> |
| 45 | + /// <example> |
| 46 | + /// <code> |
| 47 | + /// bool result = await client.HyperLogLogAddAsync("my_hll", ["element1", "element2", "element3"]); |
| 48 | + /// Console.WriteLine(result); // Output: True (if at least one element is new) |
| 49 | + /// </code> |
| 50 | + /// </example> |
| 51 | + /// </remarks> |
| 52 | + Task<bool> HyperLogLogAddAsync(ValkeyKey key, ValkeyValue[] elements, CommandFlags flags = CommandFlags.None); |
| 53 | + |
| 54 | + /// <summary> |
| 55 | + /// Returns the approximated cardinality computed by the HyperLogLog data structure stored at the specified key. |
| 56 | + /// </summary> |
| 57 | + /// <seealso href="https://valkey.io/commands/pfcount/"/> |
| 58 | + /// <param name="key">The key of the HyperLogLog.</param> |
| 59 | + /// <param name="flags">The command flags. Currently flags are ignored.</param> |
| 60 | + /// <returns> |
| 61 | + /// The approximated number of unique elements observed by the HyperLogLog at key. |
| 62 | + /// </returns> |
| 63 | + /// <remarks> |
| 64 | + /// <example> |
| 65 | + /// <code> |
| 66 | + /// long count = await client.HyperLogLogLengthAsync("my_hll"); |
| 67 | + /// Console.WriteLine(count); // Output: approximated cardinality |
| 68 | + /// </code> |
| 69 | + /// </example> |
| 70 | + /// </remarks> |
| 71 | + Task<long> HyperLogLogLengthAsync(ValkeyKey key, CommandFlags flags = CommandFlags.None); |
| 72 | + |
| 73 | + /// <summary> |
| 74 | + /// Returns the approximated cardinality of the union of the HyperLogLogs stored at the specified keys. |
| 75 | + /// </summary> |
| 76 | + /// <seealso href="https://valkey.io/commands/pfcount/"/> |
| 77 | + /// <param name="keys">The keys of the HyperLogLogs.</param> |
| 78 | + /// <param name="flags">The command flags. Currently flags are ignored.</param> |
| 79 | + /// <returns> |
| 80 | + /// The approximated number of unique elements observed by the union of the HyperLogLogs. |
| 81 | + /// </returns> |
| 82 | + /// <remarks> |
| 83 | + /// <example> |
| 84 | + /// <code> |
| 85 | + /// long count = await client.HyperLogLogLengthAsync(["hll1", "hll2", "hll3"]); |
| 86 | + /// Console.WriteLine(count); // Output: approximated cardinality of union |
| 87 | + /// </code> |
| 88 | + /// </example> |
| 89 | + /// </remarks> |
| 90 | + Task<long> HyperLogLogLengthAsync(ValkeyKey[] keys, CommandFlags flags = CommandFlags.None); |
| 91 | + |
| 92 | + /// <summary> |
| 93 | + /// Merges multiple HyperLogLog values into a unique value that will approximate the cardinality of the union of the observed Sets of the source HyperLogLog structures. |
| 94 | + /// </summary> |
| 95 | + /// <seealso href="https://valkey.io/commands/pfmerge/"/> |
| 96 | + /// <param name="destination">The key of the destination HyperLogLog.</param> |
| 97 | + /// <param name="first">The key of the first source HyperLogLog.</param> |
| 98 | + /// <param name="second">The key of the second source HyperLogLog.</param> |
| 99 | + /// <param name="flags">The command flags. Currently flags are ignored.</param> |
| 100 | + /// <returns>A task that represents the asynchronous operation.</returns> |
| 101 | + /// <remarks> |
| 102 | + /// <example> |
| 103 | + /// <code> |
| 104 | + /// await client.HyperLogLogMergeAsync("dest_hll", "hll1", "hll2"); |
| 105 | + /// </code> |
| 106 | + /// </example> |
| 107 | + /// </remarks> |
| 108 | + Task HyperLogLogMergeAsync(ValkeyKey destination, ValkeyKey first, ValkeyKey second, CommandFlags flags = CommandFlags.None); |
| 109 | + |
| 110 | + /// <summary> |
| 111 | + /// Merges multiple HyperLogLog values into a unique value that will approximate the cardinality of the union of the observed Sets of the source HyperLogLog structures. |
| 112 | + /// </summary> |
| 113 | + /// <seealso href="https://valkey.io/commands/pfmerge/"/> |
| 114 | + /// <param name="destination">The key of the destination HyperLogLog.</param> |
| 115 | + /// <param name="sourceKeys">The keys of the source HyperLogLogs.</param> |
| 116 | + /// <param name="flags">The command flags. Currently flags are ignored.</param> |
| 117 | + /// <returns>A task that represents the asynchronous operation.</returns> |
| 118 | + /// <remarks> |
| 119 | + /// <example> |
| 120 | + /// <code> |
| 121 | + /// await client.HyperLogLogMergeAsync("dest_hll", ["hll1", "hll2", "hll3"]); |
| 122 | + /// </code> |
| 123 | + /// </example> |
| 124 | + /// </remarks> |
| 125 | + Task HyperLogLogMergeAsync(ValkeyKey destination, ValkeyKey[] sourceKeys, CommandFlags flags = CommandFlags.None); |
| 126 | +} |
0 commit comments