Commit d8e8eb0c authored by Marc Gravell's avatar Marc Gravell

readonly all the things

parent b91987d3
......@@ -10,7 +10,7 @@ namespace StackExchange.Redis
/// <summary>
/// Indicates a range of slots served by a cluster node
/// </summary>
public struct SlotRange : IEquatable<SlotRange>, IComparable<SlotRange>, IComparable
public readonly struct SlotRange : IEquatable<SlotRange>, IComparable<SlotRange>, IComparable
{
private readonly short from, to;
......
......@@ -12,7 +12,7 @@ namespace StackExchange.Redis
/// </para>
/// <para>This type is not threadsafe.</para>
/// </summary>
public struct ProfiledCommandEnumerable : IEnumerable<IProfiledCommand>
public readonly struct ProfiledCommandEnumerable : IEnumerable<IProfiledCommand>
{
/// <summary>
/// <para>
......
using System;
using System;
namespace StackExchange.Redis
{
......@@ -33,7 +33,7 @@ public enum GeoRadiusOptions
/// <summary>
/// The result of a GeoRadius command.
/// </summary>
public struct GeoRadiusResult
public readonly struct GeoRadiusResult
{
/// <summary>
/// Indicate the member being represented
......@@ -80,7 +80,7 @@ internal GeoRadiusResult(RedisValue member, double? distance, long? hash, GeoPos
/// <summary>
/// Describes the longitude and latitude of a GeoEntry
/// </summary>
public struct GeoPosition : IEquatable<GeoPosition>
public readonly struct GeoPosition : IEquatable<GeoPosition>
{
internal static string GetRedisUnit(GeoUnit unit)
{
......@@ -161,7 +161,7 @@ public GeoPosition(double longitude, double latitude)
/// Describes a GeoEntry element with the corresponding value
/// GeoEntries are stored in redis as SortedSetEntries
/// </summary>
public struct GeoEntry : IEquatable<GeoEntry>
public readonly struct GeoEntry : IEquatable<GeoEntry>
{
/// <summary>
/// The name of the geo entry
......
......@@ -7,7 +7,7 @@ namespace StackExchange.Redis
/// <summary>
/// Describes a hash-field (a name/value pair)
/// </summary>
public struct HashEntry : IEquatable<HashEntry>
public readonly struct HashEntry : IEquatable<HashEntry>
{
internal readonly RedisValue name, value;
......
......@@ -6,7 +6,7 @@ namespace StackExchange.Redis
/// <summary>
/// Describes a value contained in a stream (a name/value pair).
/// </summary>
public struct NameValueEntry : IEquatable<NameValueEntry>
public readonly struct NameValueEntry : IEquatable<NameValueEntry>
{
internal readonly RedisValue name, value;
......
......@@ -19,7 +19,7 @@ internal sealed class ProfileContextTracker
/// </para>
/// <para>* Somebody starts profiling, but for whatever reason never *stops* with a context object</para>
/// </summary>
private struct ProfileContextCell : IEquatable<ProfileContextCell>
private readonly struct ProfileContextCell : IEquatable<ProfileContextCell>
{
// This is a union of (object|WeakReference); if it's a WeakReference
// then we're actually interested in it's Target, otherwise
......
......@@ -163,7 +163,7 @@ protected CursorEnumerable(RedisBase redis, ServerEndPoint server, int db, int p
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
internal struct ScanResult
internal readonly struct ScanResult
{
public readonly long Cursor;
public readonly T[] Values;
......
......@@ -6,7 +6,7 @@ namespace StackExchange.Redis
/// <summary>
/// Represents a pub/sub channel name
/// </summary>
public struct RedisChannel : IEquatable<RedisChannel>
public readonly struct RedisChannel : IEquatable<RedisChannel>
{
internal readonly byte[] Value;
internal readonly bool IsPatternBased;
......
......@@ -6,7 +6,7 @@ namespace StackExchange.Redis
/// <summary>
/// Provides basic information about the features available on a particular version of Redis
/// </summary>
public struct RedisFeatures
public readonly struct RedisFeatures
{
internal static readonly Version v2_0_0 = new Version(2, 0, 0),
v2_1_0 = new Version(2, 1, 0),
......
......@@ -6,7 +6,7 @@ namespace StackExchange.Redis
/// <summary>
/// Represents a key that can be stored in redis
/// </summary>
public struct RedisKey : IEquatable<RedisKey>
public readonly struct RedisKey : IEquatable<RedisKey>
{
private readonly byte[] keyPrefix;
private readonly object keyValue; // always either a string or a byte[]
......
......@@ -3,7 +3,7 @@
/// <summary>
/// Describes a Redis Stream with an associated array of entries.
/// </summary>
public struct RedisStream
public readonly struct RedisStream
{
internal RedisStream(RedisKey key, RedisStreamEntry[] entries)
{
......
......@@ -3,7 +3,7 @@
/// <summary>
/// Describes an entry contained in a Redis Stream.
/// </summary>
public struct RedisStreamEntry
public readonly struct RedisStreamEntry
{
internal RedisStreamEntry(RedisValue id, NameValueEntry[] values)
{
......
......@@ -8,7 +8,7 @@ namespace StackExchange.Redis
/// <summary>
/// Represents values that can be stored in redis
/// </summary>
public struct RedisValue : IEquatable<RedisValue>, IComparable<RedisValue>, IComparable, IConvertible
public readonly struct RedisValue : IEquatable<RedisValue>, IComparable<RedisValue>, IComparable, IConvertible
{
internal static readonly RedisValue[] EmptyArray = Array.Empty<RedisValue>();
......
......@@ -5,7 +5,7 @@ namespace StackExchange.Redis
/// <summary>
/// Describes a value/expiry pair
/// </summary>
public struct RedisValueWithExpiry
public readonly struct RedisValueWithExpiry
{
internal RedisValueWithExpiry(RedisValue value, TimeSpan? expiry)
{
......
......@@ -10,10 +10,10 @@ namespace StackExchange.Redis
{
internal static class ScriptParameterMapper
{
public struct ScriptParameters
public readonly struct ScriptParameters
{
public RedisKey[] Keys;
public RedisValue[] Arguments;
public readonly RedisKey[] Keys;
public readonly RedisValue[] Arguments;
public static readonly ConstructorInfo Cons = typeof(ScriptParameters).GetConstructor(new[] { typeof(RedisKey[]), typeof(RedisValue[]) });
public ScriptParameters(RedisKey[] keys, RedisValue[] args)
......
......@@ -51,7 +51,7 @@ internal partial interface ISocketCallback
bool IsDataAvailable { get; }
}
internal struct SocketToken
internal readonly struct SocketToken
{
internal readonly Socket Socket;
......
......@@ -7,7 +7,7 @@ namespace StackExchange.Redis
/// <summary>
/// Describes a sorted-set element with the corresponding value
/// </summary>
public struct SortedSetEntry : IEquatable<SortedSetEntry>, IComparable, IComparable<SortedSetEntry>
public readonly struct SortedSetEntry : IEquatable<SortedSetEntry>, IComparable, IComparable<SortedSetEntry>
{
internal readonly RedisValue element;
internal readonly double score;
......
......@@ -4,7 +4,7 @@ namespace StackExchange.Redis
/// <summary>
/// Describes a consumer off a Redis Stream.
/// </summary>
public struct StreamConsumer
public readonly struct StreamConsumer
{
internal StreamConsumer(RedisValue name, int pendingMessageCount)
{
......
......@@ -4,7 +4,7 @@ namespace StackExchange.Redis
/// <summary>
/// Describes a consumer within a consumer group, retrieved using the XINFO CONSUMERS command. <see cref="IDatabase.StreamConsumerInfo"/>
/// </summary>
public struct StreamConsumerInfo
public readonly struct StreamConsumerInfo
{
internal StreamConsumerInfo(string name, int pendingMessageCount, long idleTimeInMilliseconds)
{
......
......@@ -4,7 +4,7 @@ namespace StackExchange.Redis
/// <summary>
/// Describes a consumer group retrieved using the XINFO GROUPS command. <see cref="IDatabase.StreamGroupInfo"/>
/// </summary>
public struct StreamGroupInfo
public readonly struct StreamGroupInfo
{
internal StreamGroupInfo(string name, int consumerCount, int pendingMessageCount)
{
......
......@@ -5,7 +5,7 @@ namespace StackExchange.Redis
/// Describes a pair consisting of the Stream Key and the ID from which to read.
/// </summary>
/// <remarks><see cref="IDatabase.StreamRead(StreamIdPair[], int?, CommandFlags)"/></remarks>
public struct StreamIdPair
public readonly struct StreamIdPair
{
/// <summary>
/// Initializes a <see cref="StreamIdPair"/> value.
......
......@@ -4,7 +4,7 @@ namespace StackExchange.Redis
/// <summary>
/// Describes stream information retrieved using the XINFO STREAM command. <see cref="IDatabase.StreamInfo"/>
/// </summary>
public struct StreamInfo
public readonly struct StreamInfo
{
internal StreamInfo(int length,
int radixTreeKeys,
......
......@@ -4,7 +4,7 @@ namespace StackExchange.Redis
/// <summary>
/// Describes basic information about pending messages for a consumer group.
/// </summary>
public struct StreamPendingInfo
public readonly struct StreamPendingInfo
{
internal StreamPendingInfo(int pendingMessageCount,
RedisValue lowestId,
......
......@@ -5,7 +5,7 @@ namespace StackExchange.Redis
/// Describes properties of a pending message. A pending message is one that has
/// been received by a consumer but has not yet been acknowledged.
/// </summary>
public struct StreamPendingMessageInfo
public readonly struct StreamPendingMessageInfo
{
internal StreamPendingMessageInfo(RedisValue messageId,
RedisValue consumerName,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment