Commit d8e8eb0c authored by Marc Gravell's avatar Marc Gravell

readonly all the things

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