Skip to content

Commit

Permalink
Merge pull request #29 from archi-Doc/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
archi-Doc authored Aug 21, 2024
2 parents 8da84ef + 0671c2b commit a32cbb6
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
30 changes: 30 additions & 0 deletions CrossChannel/Channel/Channel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,51 @@

namespace CrossChannel;

/// <summary>
/// Represents an abstract channel.
/// </summary>
public abstract class Channel
{
/// <summary>
/// The threshold value for trimming the channel list.
/// </summary>
public const int TrimThreshold = 32;

/// <summary>
/// The threshold value for checking weak references in the channel list.
/// </summary>
public const int CheckReferenceThreshold = 32;

/// <summary>
/// Gets the maximum number of links allowed in the channel.
/// </summary>
public int MaxLinks { get; internal set; }

/// <summary>
/// Gets or sets the index of the node in the channel.
/// </summary>
internal int NodeIndex { get; set; }

/// <summary>
/// Gets the broker object associated with the channel.
/// </summary>
/// <returns>The broker object.</returns>
internal abstract object GetBroker();
}

/// <summary>
/// Represents a channel interface for a specific service.
/// </summary>
/// <typeparam name="TService">The type of the service.</typeparam>
public interface IChannel<TService>
where TService : class, IRadioService
{
/// <summary>
/// Opens a channel for the specified service instance.
/// </summary>
/// <param name="instance">The service instance.</param>
/// <param name="weakReference">Specifies whether to use a weak reference for the service instance.</param>
/// <returns>The channel link if the channel is successfully opened; otherwise, null.</returns>
Channel<TService>.Link? Open(TService instance, bool weakReference = false);
}

Expand Down
3 changes: 2 additions & 1 deletion CrossChannel/GeneratorShared/IRadioService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ namespace CrossChannel;

/// <summary>
/// Represents a base interface used as a Radio service.<br/>
/// The requirements are to add the <see cref="RadioServiceInterfaceAttribute" /> and to derive from the <see cref="IRadioService" />.
/// The requirements are to add the <see cref="RadioServiceInterfaceAttribute" /> and to derive from the <see cref="IRadioService" />.<br/>
/// The return type of the interface function must be either <see cref="void"/>, <see cref="Task"/>, <see cref="RadioResult{T}"/>, <see cref="Task{T}"/>(where TResult is <see cref="RadioResult{T}"/>).
/// </summary>
public interface IRadioService
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ namespace CrossChannel;

/// <summary>
/// Represents an attribute added to the interface used as a Radio service.<br/>
/// The requirements are to add the <see cref="RadioServiceInterfaceAttribute" /> and to derive from the <see cref="IRadioService" />.
/// The requirements are to add the <see cref="RadioServiceInterfaceAttribute" /> and to derive from the <see cref="IRadioService" />.<br/>
/// The return type of the interface function must be either <see cref="void"/>, <see cref="Task"/>, <see cref="RadioResult{T}"/>, <see cref="Task{T}"/>(where TResult is <see cref="RadioResult{T}"/>).
/// </summary>
[AttributeUsage(AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
public sealed class RadioServiceInterfaceAttribute : Attribute
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Version>2.0.2</Version>
<Version>2.0.3</Version>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<Deterministic>true</Deterministic>
Expand Down

0 comments on commit a32cbb6

Please sign in to comment.