glide_shared.commands.bitmap
BitmapIndexType
Bases: Enum
Enumeration specifying if index arguments are BYTE indexes or BIT indexes. Can be specified in OffsetOptions,
which is an optional argument to the BITCOUNT command.
Since: Valkey version 7.0.0.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
BYTE = 'BYTE'
class-attribute
instance-attribute
Specifies that indexes provided to OffsetOptions are byte indexes.
BIT = 'BIT'
class-attribute
instance-attribute
Specifies that indexes provided to OffsetOptions are bit indexes.
OffsetOptions
Represents offsets specifying a string interval to analyze in the BITCOUNT command. The offsets are
zero-based indexes, with 0 being the first index of the string, 1 being the next index and so on.
The offsets can also be negative numbers indicating offsets starting at the end of the string, with -1 being
the last index of the string, -2 being the penultimate, and so on.
Attributes:
| Name | Type | Description |
|---|---|---|
start |
int
|
The starting offset index. |
end |
Optional[int]
|
The ending offset index. Optional since Valkey version 8.0.0 and above for the BITCOUNT command. If not provided, it will default to the end of the string. |
index_type |
Optional[BitmapIndexType]
|
The index offset type. This option can only be specified if you are
using Valkey version 7.0.0 or above. Could be either |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
BitwiseOperation
Bases: Enum
Enumeration defining the bitwise operation to use in the BITOP command. Specifies the bitwise operation to
perform between the passed in keys.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
61 62 63 64 65 66 67 68 69 70 | |
BitEncoding
Bases: ABC
Abstract Base Class used to specify a signed or unsigned argument encoding for the BITFIELD or BITFIELD_RO
commands.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
73 74 75 76 77 78 79 80 81 82 83 84 85 | |
to_arg()
abstractmethod
Returns the encoding as a string argument to be used in the BITFIELD or BITFIELD_RO
commands.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
79 80 81 82 83 84 85 | |
SignedEncoding
Bases: BitEncoding
Represents a signed argument encoding. Must be less than 65 bits long.
Attributes:
| Name | Type | Description |
|---|---|---|
encoding_length |
int
|
The bit size of the encoding. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
UnsignedEncoding
Bases: BitEncoding
Represents an unsigned argument encoding. Must be less than 64 bits long.
Attributes:
| Name | Type | Description |
|---|---|---|
encoding_length |
int
|
The bit size of the encoding. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
BitFieldOffset
Bases: ABC
Abstract Base Class representing an offset for an array of bits for the BITFIELD or BITFIELD_RO commands.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
124 125 126 127 128 129 130 131 132 133 | |
to_arg()
abstractmethod
Returns the offset as a string argument to be used in the BITFIELD or BITFIELD_RO
commands.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
127 128 129 130 131 132 133 | |
BitOffset
Bases: BitFieldOffset
Represents an offset in an array of bits for the BITFIELD or BITFIELD_RO commands. Must be greater than or
equal to 0.
For example, if we have the binary 01101001 with offset of 1 for an unsigned encoding of size 4, then the value
is 13 from 0(1101)001.
Attributes:
| Name | Type | Description |
|---|---|---|
offset |
int
|
The bit index offset in the array of bits. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
BitOffsetMultiplier
Bases: BitFieldOffset
Represents an offset in an array of bits for the BITFIELD or BITFIELD_RO commands. The bit offset index is
calculated as the numerical value of the offset multiplied by the encoding value. Must be greater than or equal
to 0.
For example, if we have the binary 01101001 with offset multiplier of 1 for an unsigned encoding of size 4, then
the value is 9 from 0110(1001).
Attributes:
| Name | Type | Description |
|---|---|---|
offset |
int
|
The offset in the array of bits, which will be multiplied by the encoding value to get the final bit index offset. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |
BitFieldSubCommands
Bases: ABC
Abstract Base Class representing subcommands for the BITFIELD or BITFIELD_RO commands.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
179 180 181 182 183 184 185 186 187 | |
to_args()
abstractmethod
Returns the subcommand as a list of string arguments to be used in the BITFIELD or BITFIELD_RO commands.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
182 183 184 185 186 187 | |
BitFieldGet
Bases: BitFieldSubCommands
Represents the "GET" subcommand for getting a value in the binary representation of the string stored in key.
Attributes:
| Name | Type | Description |
|---|---|---|
encoding |
BitEncoding
|
The bit encoding for the subcommand. |
offset |
BitFieldOffset
|
The offset in the array of bits from which to get the value. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
BitFieldSet
Bases: BitFieldSubCommands
Represents the "SET" subcommand for setting bits in the binary representation of the string stored in key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
encoding
|
BitEncoding
|
The bit encoding for the subcommand. |
required |
offset
|
BitOffset
|
The offset in the array of bits where the value will be set. |
required |
value
|
int
|
The value to set the bits in the binary value to. |
required |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
BitFieldIncrBy
Bases: BitFieldSubCommands
Represents the "INCRBY" subcommand for increasing or decreasing bits in the binary representation of the
string stored in key.
Attributes:
| Name | Type | Description |
|---|---|---|
encoding |
BitEncoding
|
The bit encoding for the subcommand. |
offset |
BitOffset
|
The offset in the array of bits where the value will be incremented. |
increment |
int
|
The value to increment the bits in the binary value by. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | |
BitOverflowControl
Bases: Enum
Enumeration specifying bit overflow controls for the BITFIELD command.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
WRAP = 'WRAP'
class-attribute
instance-attribute
Performs modulo when overflows occur with unsigned encoding. When overflows occur with signed encoding, the value restarts at the most negative value. When underflows occur with signed encoding, the value restarts at the most positive value.
SAT = 'SAT'
class-attribute
instance-attribute
Underflows remain set to the minimum value, and overflows remain set to the maximum value.
FAIL = 'FAIL'
class-attribute
instance-attribute
Returns None when overflows occur.
BitFieldOverflow
Bases: BitFieldSubCommands
Represents the "OVERFLOW" subcommand that determines the result of the "SET" or "INCRBY" BITFIELD subcommands
when an underflow or overflow occurs.
Attributes:
| Name | Type | Description |
|---|---|---|
overflow_control |
BitOverflowControl
|
The desired overflow behavior. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/bitmap.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | |