Skip to content

Commit

Permalink
Merge branch 'main' into go/bzmpop
Browse files Browse the repository at this point in the history
  • Loading branch information
edlng authored Jan 30, 2025
2 parents 2e5eba6 + b4e28e2 commit ebfe342
Show file tree
Hide file tree
Showing 32 changed files with 1,497 additions and 240 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/create-ephemeral-self-hosted-runner.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/scale-shr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:

jobs:
hello-world:
runs-on: [self-hosted, linux, ARM64]
runs-on: [self-hosted, linux, ARM64, ephemeral]
steps:
- name: print Hello World
run: echo "Hello World"
10 changes: 10 additions & 0 deletions .github/workflows/try-github-arm-runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Try GitHub ARM runners
on:
workflow_dispatch:

jobs:
hello-world:
runs-on: ubuntu-24.04-arm
steps:
- name: print Hello World
run: echo "Hello World from ARM"
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

* Node: Fix `zrangeWithScores` (disallow `RangeByLex` as it is not supported) ([#2926](https://github.com/valkey-io/valkey-glide/pull/2926))
* Core: improve fix in #2381 ([#2929](https://github.com/valkey-io/valkey-glide/pull/2929))
* Java: Fix `lpopCount` null handling ([#3025](https://github.com/valkey-io/valkey-glide/pull/3025))

#### Operational Enhancements

Expand Down
18 changes: 4 additions & 14 deletions csharp/tests/Integration/GetAndSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

using System.Runtime.InteropServices;

using FluentAssertions;

using Glide;

using static Tests.Integration.IntegrationTestBase;
Expand All @@ -13,12 +11,8 @@ public class GetAndSet : IClassFixture<IntegrationTestBase>
{
private async Task GetAndSetValues(AsyncClient client, string key, string value)
{
_ = (await client.SetAsync(key, value))
.Should()
.Be("OK");
_ = (await client.GetAsync(key))
.Should()
.Be(value);
Assert.Equal("OK", await client.SetAsync(key, value));
Assert.Equal(value, await client.GetAsync(key));
}

private async Task GetAndSetRandomValues(AsyncClient client)
Expand Down Expand Up @@ -48,9 +42,7 @@ public async Task GetAndSetCanHandleNonASCIIUnicode()
public async Task GetReturnsNull()
{
using AsyncClient client = new("localhost", TestConfiguration.STANDALONE_PORTS[0], false);
_ = (await client.GetAsync(Guid.NewGuid().ToString()))
.Should()
.BeNull();
Assert.Null(await client.GetAsync(Guid.NewGuid().ToString()));
}

[Fact]
Expand Down Expand Up @@ -111,9 +103,7 @@ public void ConcurrentOperationsWork()
}
else
{
_ = (await client.GetAsync(Guid.NewGuid().ToString()))
.Should()
.BeNull();
Assert.Null(await client.GetAsync(Guid.NewGuid().ToString()));
}
}
}));
Expand Down
1 change: 0 additions & 1 deletion csharp/tests/tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
</ItemGroup>

<ItemGroup>
Expand Down
201 changes: 126 additions & 75 deletions go/api/base_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ type BaseClient interface {
SetCommands
StreamCommands
SortedSetCommands
ConnectionManagementCommands
HyperLogLogCommands
GenericBaseCommands
BitmapCommands
Expand Down Expand Up @@ -3104,52 +3103,6 @@ func (client *baseClient) BLMove(
return handleStringOrNilResponse(result)
}

// Pings the server.
//
// Return value:
//
// Returns "PONG".
//
// For example:
//
// result, err := client.Ping()
//
// [valkey.io]: https://valkey.io/commands/ping/
func (client *baseClient) Ping() (string, error) {
result, err := client.executeCommand(C.Ping, []string{})
if err != nil {
return defaultStringResponse, err
}

return handleStringResponse(result)
}

// Pings the server with a custom message.
//
// Parameters:
//
// message - A message to include in the `PING` command.
//
// Return value:
//
// Returns the copy of message.
//
// For example:
//
// result, err := client.PingWithMessage("Hello")
//
// [valkey.io]: https://valkey.io/commands/ping/
func (client *baseClient) PingWithMessage(message string) (string, error) {
args := []string{message}

result, err := client.executeCommand(C.Ping, args)
if err != nil {
return defaultStringResponse, err
}

return handleStringResponse(result)
}

// Del removes the specified keys from the database. A key is ignored if it does not exist.
//
// Note:
Expand Down Expand Up @@ -5736,34 +5689,6 @@ func (client *baseClient) ObjectEncoding(key string) (Result[string], error) {
return handleStringOrNilResponse(result)
}

// Echo the provided message back.
// The command will be routed a random node.
//
// Parameters:
//
// message - The provided message.
//
// Return value:
//
// The provided message
//
// For example:
//
// result, err := client.Echo("Hello World")
// if err != nil {
// // handle error
// }
// fmt.Println(result.Value()) // Output: Hello World
//
// [valkey.io]: https://valkey.io/commands/echo/
func (client *baseClient) Echo(message string) (Result[string], error) {
result, err := client.executeCommand(C.Echo, []string{message})
if err != nil {
return CreateNilStringResult(), err
}
return handleStringOrNilResponse(result)
}

// Destroys the consumer group `group` for the stream stored at `key`.
//
// See [valkey.io] for details.
Expand Down Expand Up @@ -6960,3 +6885,129 @@ func (client *baseClient) XRevRangeWithOptions(
}
return handleMapOfArrayOfStringArrayOrNilResponse(result)
}

// Reads or modifies the array of bits representing the string that is held at key
// based on the specified sub commands.
//
// See [valkey.io] for details.
//
// Parameters:
//
// key - The key of the string.
// subCommands - The subCommands to be performed on the binary value of the string at
// key, which could be any of the following:
// - [BitFieldGet].
// - [BitFieldSet].
// - [BitFieldIncrby].
// - [BitFieldOverflow].
// Use `options.NewBitFieldGet()` to specify a BitField GET command.
// Use `options.NewBitFieldSet()` to specify a BitField SET command.
// Use `options.NewBitFieldIncrby()` to specify a BitField INCRYBY command.
// Use `options.BitFieldOverflow()` to specify a BitField OVERFLOW command.
//
// Return value:
//
// Result from the executed subcommands.
// - BitFieldGet returns the value in the binary representation of the string.
// - BitFieldSet returns the previous value before setting the new value in the binary representation.
// - BitFieldIncrBy returns the updated value after increasing or decreasing the bits.
// - BitFieldOverflow controls the behavior of subsequent operations and returns
// a result based on the specified overflow type (WRAP, SAT, FAIL).
//
// Example:
//
// commands := []options.BitFieldSubCommands{
// options.BitFieldGet(options.SignedInt, 8, 16),
// options.BitFieldOverflow(options.SAT),
// options.NewBitFieldSet(options.UnsignedInt, 4, 0, 7),
// options.BitFieldIncrBy(options.SignedInt, 5, 100, 1),
// }
// result, err := client.BitField("mykey", commands)
// result: [{0 false} {7 false} {15 false}]
//
// [valkey.io]: https://valkey.io/commands/bitfield/
func (client *baseClient) BitField(key string, subCommands []options.BitFieldSubCommands) ([]Result[int64], error) {
args := make([]string, 0, 10)
args = append(args, key)

for _, cmd := range subCommands {
cmdArgs, err := cmd.ToArgs()
if err != nil {
return nil, err
}
args = append(args, cmdArgs...)
}

result, err := client.executeCommand(C.BitField, args)
if err != nil {
return nil, err
}
return handleIntOrNilArrayResponse(result)
}

// Reads the array of bits representing the string that is held at key
// based on the specified sub commands.
//
// See [valkey.io] for details.
//
// Parameters:
//
// key - The key of the string.
// subCommands - The read-only subCommands to be performed on the binary value
// of the string at key, which could be:
// - [BitFieldGet].
// Use `options.NewBitFieldGet()` to specify a BitField GET command.
//
// Return value:
//
// Result from the executed GET subcommands.
// - BitFieldGet returns the value in the binary representation of the string.
//
// Example:
//
// commands := []options.BitFieldROCommands{
// options.BitFieldGet(options.SignedInt, 8, 16),
// }
// result, err := client.BitFieldRO("mykey", commands)
// result: [{42 false}]
//
// [valkey.io]: https://valkey.io/commands/bitfield_ro/
func (client *baseClient) BitFieldRO(key string, commands []options.BitFieldROCommands) ([]Result[int64], error) {
args := make([]string, 0, 10)
args = append(args, key)

for _, cmd := range commands {
cmdArgs, err := cmd.ToArgs()
if err != nil {
return nil, err
}
args = append(args, cmdArgs...)
}

result, err := client.executeCommand(C.BitFieldReadOnly, args)
if err != nil {
return nil, err
}
return handleIntOrNilArrayResponse(result)
}

// Returns the server time.
//
// Return value:
// The current server time as a String array with two elements:
// A UNIX TIME and the amount of microseconds already elapsed in the current second.
// The returned array is in a [UNIX TIME, Microseconds already elapsed] format.
//
// For example:
//
// result, err := client.Time()
// result: [{1737051660} {994688}]
//
// [valkey.io]: https://valkey.io/commands/time/
func (client *baseClient) Time() ([]string, error) {
result, err := client.executeCommand(C.Time, []string{})
if err != nil {
return nil, err
}
return handleStringArrayResponse(result)
}
4 changes: 4 additions & 0 deletions go/api/bitmap_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ type BitmapCommands interface {
BitCount(key string) (int64, error)

BitCountWithOptions(key string, options *options.BitCountOptions) (int64, error)

BitField(key string, subCommands []options.BitFieldSubCommands) ([]Result[int64], error)

BitFieldRO(key string, commands []options.BitFieldROCommands) ([]Result[int64], error)
}
Loading

0 comments on commit ebfe342

Please sign in to comment.