This commit is contained in:
2026-07-12 15:22:42 +03:00
parent 91d9c5d959
commit 2f81cd1d30
44 changed files with 785 additions and 242 deletions
@@ -29,12 +29,15 @@ using System.Threading.Tasks;
namespace Esiur.Resource;
[AttributeUsage(AttributeTargets.Event)]
public class SubscribableAttribute : System.Attribute
/// <summary>
/// Indicates that an event is delivered to attached clients without
/// requiring an explicit subscription.
/// </summary>
[AttributeUsage(
AttributeTargets.Event |
AttributeTargets.Field,
AllowMultiple = false,
Inherited = true)]
public sealed class AutoDeliveredAttribute : Attribute
{
public SubscribableAttribute()
{
}
}
}
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Esiur.Resource
{
/// <summary>
/// Indicates that a running remote invocation may be cancelled.
/// </summary>
[AttributeUsage(
AttributeTargets.Method,
AllowMultiple = false,
Inherited = true)]
public sealed class CancellableAttribute : Attribute
{
}
}
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Esiur.Resource
{
/// <summary>
/// Indicates that previous values of an exported property are retained
/// and may be fetched remotely.
/// </summary>
[AttributeUsage(
AttributeTargets.Property |
AttributeTargets.Field,
AllowMultiple = false,
Inherited = true)]
public sealed class HistoricalAttribute : Attribute
{
}
}
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Esiur.Resource
{
/// <summary>
/// Indicates that repeating the same invocation should have the same
/// externally observable effect as invoking it once.
/// </summary>
[AttributeUsage(
AttributeTargets.Method,
AllowMultiple = false,
Inherited = true)]
public sealed class IdempotentAttribute : Attribute
{
}
}
@@ -0,0 +1,28 @@
using Esiur.Data;
using System;
using System.Collections.Generic;
using System.Text;
namespace Esiur.Resource
{
/// <summary>
/// Specifies non-default notification ordering for a property or event.
/// Absence of this attribute means strict ordering.
/// </summary>
[AttributeUsage(
AttributeTargets.Property |
AttributeTargets.Field |
AttributeTargets.Event,
AllowMultiple = false,
Inherited = true)]
public sealed class OrderingAttribute : Attribute
{
public OrderingControl Control { get; }
public OrderingAttribute(OrderingControl control)
{
Control = control;
}
}
}
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Esiur.Resource
{
/// <summary>
/// Indicates that an exported function does not change resource state,
/// or that an exported property cannot be changed remotely.
/// </summary>
[AttributeUsage(
AttributeTargets.Method |
AttributeTargets.Property |
AttributeTargets.Field,
AllowMultiple = false,
Inherited = true)]
public sealed class ReadOnlyAttribute : Attribute
{
}
}
@@ -0,0 +1,34 @@
using Esiur.Data.Types;
using System;
using System.Collections.Generic;
using System.Text;
namespace Esiur.Resource
{
/// <summary>
/// Marks an exported function as streaming and specifies its delivery mode.
/// </summary>
[AttributeUsage(
AttributeTargets.Method,
AllowMultiple = false,
Inherited = true)]
public sealed class StreamAttribute : Attribute
{
/// <summary>
/// Gets the stream delivery mode.
/// </summary>
public StreamMode Mode { get; }
/// <summary>
/// Indicates whether a push stream may be paused and resumed remotely.
/// This should only be true when Mode is Push.
/// </summary>
public bool Pausable { get; set; }
public StreamAttribute(StreamMode mode = StreamMode.Push)
{
Mode = mode;
}
}
}
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Esiur.Resource.Attributes
{
[AttributeUsage(
AttributeTargets.Class |
AttributeTargets.Struct |
AttributeTargets.Interface |
AttributeTargets.Enum |
AttributeTargets.Delegate |
AttributeTargets.Method |
AttributeTargets.Property |
AttributeTargets.Field |
AttributeTargets.Event |
AttributeTargets.Parameter |
AttributeTargets.ReturnValue,
AllowMultiple = false,
Inherited = true)]
public sealed class UsageAttribute : Attribute
{
public string Value { get; }
public UsageAttribute(string value)
{
if (string.IsNullOrWhiteSpace(value))
throw new ArgumentException(
"Usage text cannot be null or empty.",
nameof(value));
Value = value;
}
}
}
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Esiur.Resource.Attributes
{
/// <summary>
/// Indicates that an exported property has volatile synchronization
/// semantics. This is unrelated to the C# volatile memory modifier.
/// </summary>
[AttributeUsage(
AttributeTargets.Property |
AttributeTargets.Field,
AllowMultiple = false,
Inherited = true)]
public sealed class VolatileAttribute : Attribute
{
}
}
@@ -4,10 +4,10 @@ using System.Text;
namespace Esiur.Resource
{
public enum PropertyPermission : byte
{
Read = 1,
Write,
ReadWrite,
}
//public enum PropertyPermission : byte
//{
// ReadOnly = 0,
// Write,
// ReadWrite,
//}
}