Skip to content

Commit

Permalink
Fix naming
Browse files Browse the repository at this point in the history
  • Loading branch information
ImoutoChan committed May 16, 2024
1 parent 1179130 commit f15758e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Source/Offloader/Abstract/IOffloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

public interface IOffloader<in T>
{
Task OffloadAsync(T vote);
Task OffloadAsync(T item);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
using Offloader.Implementation;

namespace Offloader;

Expand Down
2 changes: 1 addition & 1 deletion Source/Offloader/Implementation/IOffloadReader.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Threading.Channels;

namespace Offloader;
namespace Offloader.Implementation;

internal interface IOffloadReader<T>
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Offloader/Implementation/OffloadHostedService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

namespace Offloader;
namespace Offloader.Implementation;

internal class OffloadHostedService<T> : IHostedService
{
Expand Down
10 changes: 5 additions & 5 deletions Source/Offloader/Implementation/Offloader.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
using System.Threading.Channels;

namespace Offloader;
namespace Offloader.Implementation;

/// <remarks>
/// Should be registered as a singleton.
/// </remarks>>
internal class Offloader<T> : IOffloader<T>, IOffloadReader<T>
{
private Channel<T> VotesToTranslate { get; }
private Channel<T> OffloadedItems { get; }
= Channel.CreateUnbounded<T>(new UnboundedChannelOptions
{
SingleReader = true
});

public async Task OffloadAsync(T vote) => await VotesToTranslate.Writer.WriteAsync(vote);
public async Task OffloadAsync(T item) => await OffloadedItems.Writer.WriteAsync(item);

public ChannelReader<T> Reader => VotesToTranslate.Reader;
public ChannelReader<T> Reader => OffloadedItems.Reader;

public void Complete() => VotesToTranslate.Writer.Complete();
public void Complete() => OffloadedItems.Writer.Complete();
}

0 comments on commit f15758e

Please sign in to comment.