Skip to content

Commit

Permalink
Improved bitmap javadocs (valkey-io#1530)
Browse files Browse the repository at this point in the history
Improved bitmap docs (#344)

* Improved bitmap docs

* Addressed PR comments

* Update java/client/src/main/java/glide/api/commands/BitmapBaseCommands.java



* Update java/client/src/main/java/glide/api/models/BaseTransaction.java



---------

Co-authored-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
GumpacG and Yury-Fridlyand authored Jun 10, 2024
1 parent ddc1425 commit 9caf33d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import glide.api.models.commands.bitmap.BitFieldOptions.OffsetMultiplier;
import glide.api.models.commands.bitmap.BitmapIndexType;
import glide.api.models.commands.bitmap.BitwiseOperation;
import glide.api.models.configuration.ReadFrom;
import java.util.concurrent.CompletableFuture;

/**
Expand All @@ -24,7 +25,7 @@ public interface BitmapBaseCommands {
/**
* Counts the number of set bits (population counting) in a string stored at <code>key</code>.
*
* @see <a href="https://redis.io/commands/bitcount/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/bitcount/">valkey.io</a> for details.
* @param key The key for the string to count the set bits of.
* @return The number of set bits in the string. Returns zero if the key is missing as it is
* treated as an empty string.
Expand All @@ -44,7 +45,7 @@ public interface BitmapBaseCommands {
* <code>-1</code> being the last element of the list, <code>-2</code> being the penultimate, and
* so on.
*
* @see <a href="https://redis.io/commands/bitcount/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/bitcount/">valkey.io</a> for details.
* @param key The key for the string to count the set bits of.
* @param start The starting offset byte index.
* @param end The ending offset byte index.
Expand All @@ -67,7 +68,7 @@ public interface BitmapBaseCommands {
* so on.
*
* @since Redis 7.0 and above
* @see <a href="https://redis.io/commands/bitcount/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/bitcount/">valkey.io</a> for details.
* @param key The key for the string to count the set bits of.
* @param start The starting offset.
* @param end The ending offset.
Expand All @@ -92,7 +93,7 @@ public interface BitmapBaseCommands {
* non-existent then the bit at <code>offset</code> is set to <code>value</code> and the preceding
* bits are set to <code>0</code>.
*
* @see <a href="https://redis.io/commands/setbit/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/setbit/">valkey.io</a> for details.
* @param key The key of the string.
* @param offset The index of the bit to be set.
* @param value The bit value to set at <code>offset</code>. The value must be <code>0</code> or
Expand All @@ -110,7 +111,7 @@ public interface BitmapBaseCommands {
* Returns the bit value at <code>offset</code> in the string value stored at <code>key</code>.
* <code>offset</code> should be greater than or equal to zero.
*
* @see <a href="https://redis.io/commands/getbit/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/getbit/">valkey.io</a> for details.
* @param key The key of the string.
* @param offset The index of the bit to return.
* @return The bit at offset of the string. Returns zero if the key is empty or if the positive
Expand All @@ -127,7 +128,7 @@ public interface BitmapBaseCommands {
/**
* Returns the position of the first bit matching the given <code>bit</code> value.
*
* @see <a href="https://redis.io/commands/bitpos/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/bitpos/">valkey.io</a> for details.
* @param key The key of the string.
* @param bit The bit value to match. The value must be <code>0</code> or <code>1</code>.
* @return The position of the first occurrence matching <code>bit</code> in the binary value of
Expand All @@ -150,7 +151,7 @@ public interface BitmapBaseCommands {
* indicating offsets starting at the end of the list, with <code>-1</code> being the last byte of
* the list, <code>-2</code> being the penultimate, and so on.
*
* @see <a href="https://redis.io/commands/bitpos/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/bitpos/">valkey.io</a> for details.
* @param key The key of the string.
* @param bit The bit value to match. The value must be <code>0</code> or <code>1</code>.
* @param start The starting offset.
Expand All @@ -174,7 +175,7 @@ public interface BitmapBaseCommands {
* negative numbers indicating offsets starting at the end of the list, with <code>-1</code> being
* the last byte of the list, <code>-2</code> being the penultimate, and so on.
*
* @see <a href="https://redis.io/commands/bitpos/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/bitpos/">valkey.io</a> for details.
* @param key The key of the string.
* @param bit The bit value to match. The value must be <code>0</code> or <code>1</code>.
* @param start The starting offset.
Expand Down Expand Up @@ -203,7 +204,7 @@ public interface BitmapBaseCommands {
* list, <code>-2</code> being the penultimate, and so on.
*
* @since Redis 7.0 and above.
* @see <a href="https://redis.io/commands/bitpos/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/bitpos/">valkey.io</a> for details.
* @param key The key of the string.
* @param bit The bit value to match. The value must be <code>0</code> or <code>1</code>.
* @param start The starting offset.
Expand All @@ -230,7 +231,7 @@ CompletableFuture<Long> bitpos(
*
* @apiNote When in cluster mode, <code>destination</code> and all <code>keys</code> must map to
* the same hash slot.
* @see <a href="https://redis.io/commands/bitop/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/bitop/">valkey.io</a> for details.
* @param bitwiseOperation The bitwise operation to perform.
* @param destination The key that will store the resulting string.
* @param keys The list of keys to perform the bitwise operation on.
Expand All @@ -251,7 +252,7 @@ CompletableFuture<Long> bitop(
* Reads or modifies the array of bits representing the string that is held at <code>key</code>
* based on the specified <code>subCommands</code>.
*
* @see <a href="https://redis.io/commands/bitfield/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/bitfield/">valkey.io</a> for details.
* @param key The key of the string.
* @param subCommands The subCommands to be performed on the binary value of the string at <code>
* key</code>, which could be any of the following:
Expand Down Expand Up @@ -289,10 +290,11 @@ CompletableFuture<Long> bitop(

/**
* Reads the array of bits representing the string that is held at <code>key</code> based on the
* specified <code>subCommands</code>.
* specified <code>subCommands</code>.<br>
* This command is routed depending on the client's {@link ReadFrom} strategy.
*
* @since Redis 6.0 and above
* @see <a href="https://redis.io/docs/latest/commands/bitfield_ro/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/bitfield_ro/">valkey.io</a> for details.
* @param key The key of the string.
* @param subCommands The <code>GET</code> subCommands to be performed.
* @return An array of results from the <code>GET</code> subcommands.
Expand Down
28 changes: 15 additions & 13 deletions java/client/src/main/java/glide/api/models/BaseTransaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@
import glide.api.models.commands.stream.StreamAddOptions.StreamAddOptionsBuilder;
import glide.api.models.commands.stream.StreamRange;
import glide.api.models.commands.stream.StreamTrimOptions;
import glide.api.models.configuration.ReadFrom;
import java.util.Arrays;
import java.util.Map;
import lombok.Getter;
Expand Down Expand Up @@ -3500,7 +3501,7 @@ public T copy(@NonNull String source, @NonNull String destination) {
/**
* Counts the number of set bits (population counting) in a string stored at <code>key</code>.
*
* @see <a href="https://redis.io/commands/bitcount/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/bitcount/">valkey.io</a> for details.
* @param key The key for the string to count the set bits of.
* @return Command Response - The number of set bits in the string. Returns zero if the key is
* missing as it is treated as an empty string.
Expand All @@ -3519,7 +3520,7 @@ public T bitcount(@NonNull String key) {
* <code>-1</code> being the last element of the list, <code>-2</code> being the penultimate, and
* so on.
*
* @see <a href="https://redis.io/commands/bitcount/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/bitcount/">valkey.io</a> for details.
* @param key The key for the string to count the set bits of.
* @param start The starting byte offset.
* @param end The ending byte offset.
Expand All @@ -3543,7 +3544,7 @@ public T bitcount(@NonNull String key, long start, long end) {
* so on.
*
* @since Redis 7.0 and above
* @see <a href="https://redis.io/commands/bitcount/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/bitcount/">valkey.io</a> for details.
* @param key The key for the string to count the set bits of.
* @param start The starting offset.
* @param end The ending offset.
Expand Down Expand Up @@ -3738,7 +3739,7 @@ public T functionList(@NonNull String libNamePattern, boolean withCode) {
* non-existent then the bit at <code>offset</code> is set to <code>value</code> and the preceding
* bits are set to <code>0</code>.
*
* @see <a href="https://redis.io/commands/setbit/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/setbit/">valkey.io</a> for details.
* @param key The key of the string.
* @param offset The index of the bit to be set.
* @param value The bit value to set at <code>offset</code>. The value must be <code>0</code> or
Expand All @@ -3755,7 +3756,7 @@ public T setbit(@NonNull String key, long offset, long value) {
* Returns the bit value at <code>offset</code> in the string value stored at <code>key</code>.
* <code>offset</code> should be greater than or equal to zero.
*
* @see <a href="https://redis.io/commands/getbit/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/getbit/">valkey.io</a> for details.
* @param key The key of the string.
* @param offset The index of the bit to return.
* @return Command Response - The bit at offset of the string. Returns zero if the key is empty or
Expand Down Expand Up @@ -3837,7 +3838,7 @@ public T blmpop(@NonNull String[] keys, @NonNull ListDirection direction, double
/**
* Returns the position of the first bit matching the given <code>bit</code> value.
*
* @see <a href="https://redis.io/commands/bitpos/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/bitpos/">valkey.io</a> for details.
* @param key The key of the string.
* @param bit The bit value to match. The value must be <code>0</code> or <code>1</code>.
* @return Command Response - The position of the first occurrence matching <code>bit</code> in
Expand All @@ -3857,7 +3858,7 @@ public T bitpos(@NonNull String key, long bit) {
* indicating offsets starting at the end of the list, with <code>-1</code> being the last byte of
* the list, <code>-2</code> being the penultimate, and so on.
*
* @see <a href="https://redis.io/commands/bitpos/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/bitpos/">valkey.io</a> for details.
* @param key The key of the string.
* @param bit The bit value to match. The value must be <code>0</code> or <code>1</code>.
* @param start The starting offset.
Expand All @@ -3878,7 +3879,7 @@ public T bitpos(@NonNull String key, long bit, long start) {
* negative numbers indicating offsets starting at the end of the list, with <code>-1</code> being
* the last byte of the list, <code>-2</code> being the penultimate, and so on.
*
* @see <a href="https://redis.io/commands/bitpos/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/bitpos/">valkey.io</a> for details.
* @param key The key of the string.
* @param bit The bit value to match. The value must be <code>0</code> or <code>1</code>.
* @param start The starting offset.
Expand All @@ -3905,7 +3906,7 @@ public T bitpos(@NonNull String key, long bit, long start, long end) {
* list, <code>-2</code> being the penultimate, and so on.
*
* @since Redis 7.0 and above.
* @see <a href="https://redis.io/commands/bitpos/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/bitpos/">valkey.io</a> for details.
* @param key The key of the string.
* @param bit The bit value to match. The value must be <code>0</code> or <code>1</code>.
* @param start The starting offset.
Expand Down Expand Up @@ -3934,7 +3935,7 @@ public T bitpos(
* Perform a bitwise operation between multiple keys (containing string values) and store the
* result in the <code>destination</code>.
*
* @see <a href="https://redis.io/commands/bitop/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/bitop/">valkey.io</a> for details.
* @param bitwiseOperation The bitwise operation to perform.
* @param destination The key that will store the resulting string.
* @param keys The list of keys to perform the bitwise operation on.
Expand Down Expand Up @@ -4147,7 +4148,7 @@ public T spopCount(@NonNull String key, long count) {
* Reads or modifies the array of bits representing the string that is held at <code>key</code>
* based on the specified <code>subCommands</code>.
*
* @see <a href="https://redis.io/commands/bitfield/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/bitfield/">valkey.io</a> for details.
* @param key The key of the string.
* @param subCommands The subCommands to be performed on the binary value of the string at <code>
* key</code>, which could be any of the following:
Expand Down Expand Up @@ -4178,10 +4179,11 @@ public T bitfield(@NonNull String key, @NonNull BitFieldSubCommands[] subCommand

/**
* Reads the array of bits representing the string that is held at <code>key</code> based on the
* specified <code>subCommands</code>.
* specified <code>subCommands</code>.<br>
* This command is routed depending on the client's {@link ReadFrom} strategy.
*
* @since Redis 6.0 and above
* @see <a href="https://redis.io/docs/latest/commands/bitfield_ro/">redis.io</a> for details.
* @see <a href="https://valkey.io/commands/bitfield_ro/">valkey.io</a> for details.
* @param key The key of the string.
* @param subCommands The <code>GET</code> subCommands to be performed.
* @return Command Response - An array of results from the <code>GET</code> subcommands.
Expand Down

0 comments on commit 9caf33d

Please sign in to comment.