Rate Policy

This commit is contained in:
2026-07-13 17:15:00 +03:00
parent 31bda58460
commit 4f6d2d0801
46 changed files with 3142 additions and 468 deletions
@@ -38,6 +38,8 @@ namespace Esiur.Resource;
AttributeTargets.Field,
AllowMultiple = false,
Inherited = true)]
public sealed class AutoDeliveredAttribute : Attribute
public class AutoDeliveryAttribute : Attribute
{
}
}
@@ -0,0 +1,163 @@
using Esiur.Data.Types;
using System;
namespace Esiur.Resource;
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface |
AttributeTargets.Enum | AttributeTargets.Method | AttributeTargets.Property |
AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter,
AllowMultiple = false, Inherited = true)]
public sealed class DescriptionAttribute : Attribute
{
public string Value { get; }
public DescriptionAttribute(string value) => Value = value;
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface |
AttributeTargets.Enum | AttributeTargets.Method | AttributeTargets.Property |
AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter,
AllowMultiple = true, Inherited = true)]
public sealed class ExampleAttribute : Attribute
{
public object Value { get; }
public ExampleAttribute(object value) => Value = value;
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
AttributeTargets.Interface | AttributeTargets.Enum,
AllowMultiple = false, Inherited = true)]
public sealed class CategoryAttribute : Attribute
{
public string Value { get; }
public CategoryAttribute(string value) => Value = value;
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
AttributeTargets.Interface | AttributeTargets.Enum,
AllowMultiple = false, Inherited = true)]
public sealed class SinceAttribute : Attribute
{
public string Value { get; }
public SinceAttribute(string value) => Value = value;
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property |
AttributeTargets.Field | AttributeTargets.Event,
AllowMultiple = false, Inherited = true)]
public sealed class TagsAttribute : Attribute
{
public string[] Values { get; }
public TagsAttribute(params string[] values) => Values = values;
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |
AttributeTargets.Method | AttributeTargets.Event,
AllowMultiple = false, Inherited = true)]
public sealed class UnitAttribute : Attribute
{
public string Value { get; }
public UnitAttribute(string value) => Value = value;
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |
AttributeTargets.Parameter,
AllowMultiple = false, Inherited = true)]
public sealed class MinimumAttribute : Attribute
{
public object Value { get; }
public MinimumAttribute(object value) => Value = value;
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |
AttributeTargets.Parameter,
AllowMultiple = false, Inherited = true)]
public sealed class MaximumAttribute : Attribute
{
public object Value { get; }
public MaximumAttribute(object value) => Value = value;
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |
AttributeTargets.Parameter,
AllowMultiple = true, Inherited = true)]
public sealed class AllowedValueAttribute : Attribute
{
public object Value { get; }
public AllowedValueAttribute(object value) => Value = value;
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |
AttributeTargets.Parameter,
AllowMultiple = false, Inherited = true)]
public sealed class PatternAttribute : Attribute
{
public string Value { get; }
public PatternAttribute(string value) => Value = value;
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field |
AttributeTargets.Method | AttributeTargets.Event | AttributeTargets.Parameter,
AllowMultiple = false, Inherited = true)]
public sealed class FormatAttribute : Attribute
{
public string Value { get; }
public FormatAttribute(string value) => Value = value;
}
[AttributeUsage(AttributeTargets.Method,
AllowMultiple = true, Inherited = true)]
public sealed class PreconditionAttribute : Attribute
{
public string Value { get; }
public PreconditionAttribute(string value) => Value = value;
}
[AttributeUsage(AttributeTargets.Method,
AllowMultiple = true, Inherited = true)]
public sealed class PostconditionAttribute : Attribute
{
public string Value { get; }
public PostconditionAttribute(string value) => Value = value;
}
[AttributeUsage(AttributeTargets.Method,
AllowMultiple = false, Inherited = true)]
public sealed class EffectsAttribute : Attribute
{
public OperationEffects Value { get; }
public EffectsAttribute(OperationEffects value) => Value = value;
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property |
AttributeTargets.Field | AttributeTargets.Event,
AllowMultiple = true, Inherited = true)]
public sealed class WarningAttribute : Attribute
{
public string Value { get; }
public WarningAttribute(string value) => Value = value;
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property |
AttributeTargets.Field | AttributeTargets.Event,
AllowMultiple = false, Inherited = true)]
public sealed class RelatedMembersAttribute : Attribute
{
public byte[] Indexes { get; }
public RelatedMembersAttribute(params byte[] indexes) => Indexes = indexes;
}
@@ -5,12 +5,13 @@ using System.Text;
namespace Esiur.Resource
{
/// <summary>
/// Indicates that previous values of an exported property are retained
/// Indicates that previous property values or event occurrences are retained
/// and may be fetched remotely.
/// </summary>
[AttributeUsage(
AttributeTargets.Property |
AttributeTargets.Field,
AttributeTargets.Field |
AttributeTargets.Event,
AllowMultiple = false,
Inherited = true)]
public sealed class HistoricalAttribute : Attribute
@@ -0,0 +1,26 @@
using System;
namespace Esiur.Resource;
/// <summary>
/// Applies a named Warehouse rate policy to an exported function or property setter.
/// </summary>
[AttributeUsage(
AttributeTargets.Method | AttributeTargets.Property,
AllowMultiple = false,
Inherited = true)]
public sealed class RateControlAttribute : Attribute
{
/// <summary>
/// Gets the name used to resolve the policy from the owning Warehouse.
/// </summary>
public string PolicyName { get; }
public RateControlAttribute(string policyName)
{
if (string.IsNullOrWhiteSpace(policyName))
throw new ArgumentException("A rate policy name is required.", nameof(policyName));
PolicyName = policyName;
}
}
@@ -6,7 +6,9 @@ using System.Text;
namespace Esiur.Resource
{
/// <summary>
/// Marks an exported function as streaming and specifies its delivery mode.
/// Marks an AsyncReply-returning exported function as streaming and specifies
/// its delivery mode. IEnumerable and IAsyncEnumerable return types infer push
/// and pull mode respectively and do not require this attribute.
/// </summary>
[AttributeUsage(
AttributeTargets.Method,
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;
namespace Esiur.Resource.Attributes
namespace Esiur.Resource
{
[AttributeUsage(
AttributeTargets.Class |
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;
namespace Esiur.Resource.Attributes
namespace Esiur.Resource
{
/// <summary>
/// Indicates that an exported property has volatile synchronization