Skip to content

remove the LastOffset() #380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions RabbitMQ.Stream.Client/StreamStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// 2.0, and the Mozilla Public License, version 2.0.
// Copyright (c) 2017-2023 Broadcom. All Rights Reserved. The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.

using System;
using System.Collections.Generic;

namespace RabbitMQ.Stream.Client;
Expand Down Expand Up @@ -29,12 +30,7 @@ public ulong FirstOffset()
return (ulong)r;
}

/// <summary>
/// The last offset in the stream.
///
/// return last offset in the stream
/// throws NoOffsetException if there is no first offset yet
/// </summary>
[Obsolete("LastOffset() is deprecated, please use CommittedChunkId instead.")]
public ulong LastOffset()
{
var r = _statistics.TryGetValue("last_chunk_id", out var value) ? value : -1;
Expand Down
4 changes: 0 additions & 4 deletions Tests/SystemTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,13 @@ public async void StreamStatus()
Assert.Throws<OffsetNotFoundException>(() => { stats.FirstOffset(); }
);

Assert.Throws<OffsetNotFoundException>(() => { stats.LastOffset(); }
);

Assert.Throws<OffsetNotFoundException>(() => { stats.CommittedChunkId(); }
);

await SystemUtils.PublishMessages(system, stream, 500, _testOutputHelper);
SystemUtils.Wait();
var statAfter = await system.StreamStats(stream);
Assert.Equal((ulong)0, statAfter.FirstOffset());
Assert.True(statAfter.LastOffset() > 0);
Assert.True(statAfter.CommittedChunkId() > 0);
await SystemUtils.CleanUpStreamSystem(system, stream);
}
Expand Down
84 changes: 42 additions & 42 deletions Tests/Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<IsPackable>false</IsPackable>
<MinVerSkip>true</MinVerSkip>
<Copyright>Copyright (c) 2017-2023 Broadcom. All Rights Reserved. The term Broadcom refers to Broadcom Inc. and/or its subsidiaries.</Copyright>
<Authors>Broadcom</Authors>
<Company>Broadcom Inc. and/or its subsidiaries.</Company>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AltCover" />
<PackageReference Include="AmqpNetLite" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="RabbitMQ.Client" />
<PackageReference Include="System.IO.Hashing" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Xunit.SkippableFact" />
<PackageReference Include="coverlet.collector">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RabbitMQ.Stream.Client\RabbitMQ.Stream.Client.csproj" />
</ItemGroup>
<ItemGroup>
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\**" CopyToOutputDirectory="PreserveNewest" LinkBase="TestFiles\" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<IsPackable>false</IsPackable>
<MinVerSkip>true</MinVerSkip>
<Copyright>Copyright (c) 2017-2023 Broadcom. All Rights Reserved. The term Broadcom refers to Broadcom Inc. and/or its subsidiaries.</Copyright>
<Authors>Broadcom</Authors>
<Company>Broadcom Inc. and/or its subsidiaries.</Company>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AltCover" />
<PackageReference Include="AmqpNetLite" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="RabbitMQ.Client" />
<PackageReference Include="System.IO.Hashing" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Xunit.SkippableFact" />
<PackageReference Include="coverlet.collector">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\RabbitMQ.Stream.Client\RabbitMQ.Stream.Client.csproj" />
</ItemGroup>

<ItemGroup>
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<ItemGroup>
<None Include="Resources\**" CopyToOutputDirectory="PreserveNewest" LinkBase="TestFiles\" />
</ItemGroup>

</Project>
2 changes: 0 additions & 2 deletions docs/asciidoc/query-stream.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ The following methods are available:

- `FirstOffset()`: first offset in the stream
- `LastOffset()`: last offset in the stream
- `CommittedChunkId()`: the ID (offset) of the committed chunk (block of messages) in the stream.
It is the offset of the first message in the last chunk confirmed by a quorum of the stream cluster members (leader and replicas).
Expand Down