Skip to content

Commit

Permalink
Initial int to long conversion work
Browse files Browse the repository at this point in the history
ServiceStack library and methods have been updated to use longs where
appropriate.  Also added one failing test that should work with successful
long conversion.

Test code still needs to be updated.
  • Loading branch information
dcartoon committed May 25, 2013
1 parent 6cdbf5f commit dc09f6b
Show file tree
Hide file tree
Showing 29 changed files with 179 additions and 182 deletions.
Binary file modified lib/ServiceStack.Common.dll
Binary file not shown.
Binary file modified lib/ServiceStack.Interfaces.dll
Binary file not shown.
Binary file modified lib/ServiceStack.Text.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion src/ServiceStack.Redis/BasicRedisClientManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public partial class BasicRedisClientManager

public IRedisClientFactory RedisClientFactory { get; set; }

public int Db { get; private set; }
public long Db { get; private set; }

public Action<IRedisNativeClient> ConnectionFilter { get; set; }

Expand Down
4 changes: 2 additions & 2 deletions src/ServiceStack.Redis/Generic/ManagedListGeneric.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private List<T> GetRedisList()
return client.Lists[key].ToList();
}
}
public int IndexOf(T item)
public int IndexOf(T item)
{
return GetRedisList().IndexOf(item);
}
Expand Down Expand Up @@ -93,7 +93,7 @@ public void CopyTo(T[] array, int arrayIndex)
GetRedisList().CopyTo(array, arrayIndex);
}

public int Count
public int Count
{
get { return GetRedisList().Count(); }
}
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceStack.Redis/Generic/RedisClientHash.Generic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public bool Remove(KeyValuePair<TKey, T> item)

public int Count
{
get { return client.GetHashCount(this); }
get { return (int)client.GetHashCount(this); }
}

public bool IsReadOnly
Expand Down
6 changes: 3 additions & 3 deletions src/ServiceStack.Redis/Generic/RedisClientList.Generic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public int Count
{
get
{
return client.GetListCount(this);
return (int)client.GetListCount(this);
}
}

Expand Down Expand Up @@ -167,12 +167,12 @@ public void Trim(int keepStartingFrom, int keepEndingAt)
client.TrimList(this, keepStartingFrom, keepEndingAt);
}

public int RemoveValue(T value)
public long RemoveValue(T value)
{
return client.RemoveItemFromList(this, value);
}

public int RemoveValue(T value, int noOfMatches)
public long RemoveValue(T value, int noOfMatches)
{
return client.RemoveItemFromList(this, value, noOfMatches);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceStack.Redis/Generic/RedisClientSet.Generic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public int Count
{
get
{
var setCount = client.GetSetCount(this);
var setCount = (int)client.GetSetCount(this);
return setCount;
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/ServiceStack.Redis/Generic/RedisClientSortedSet.Generic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public int Count
{
get
{
var setCount = client.GetSortedSetCount(this);
var setCount = (int)client.GetSortedSetCount(this);
return setCount;
}
}
Expand All @@ -124,10 +124,10 @@ public double IncrementItem(T item, double incrementBy)

public int IndexOf(T item)
{
return client.GetItemIndexInSortedSet(this, item);
return (int)client.GetItemIndexInSortedSet(this, item);
}

public int IndexOfDescending(T item)
public long IndexOfDescending(T item)
{
return client.GetItemIndexInSortedSetDesc(this, item);
}
Expand Down Expand Up @@ -167,12 +167,12 @@ public List<T> GetRangeByHighestScore(double fromScore, double toScore, int? ski
return client.GetRangeFromSortedSetByHighestScore(this, fromScore, toScore, skip, take);
}

public int RemoveRange(int minRank, int maxRank)
public long RemoveRange(int minRank, int maxRank)
{
return client.RemoveRangeFromSortedSet(this, minRank, maxRank);
}

public int RemoveRangeByScore(double fromScore, double toScore)
public long RemoveRangeByScore(double fromScore, double toScore)
{
return client.RemoveRangeFromSortedSetByScore(this, fromScore, toScore);
}
Expand All @@ -182,12 +182,12 @@ public double GetItemScore(T item)
return client.GetItemScoreInSortedSet(this, item);
}

public int PopulateWithIntersectOf(params IRedisSortedSet<T>[] setIds)
public long PopulateWithIntersectOf(params IRedisSortedSet<T>[] setIds)
{
return client.StoreIntersectFromSortedSets(this, setIds);
}

public int PopulateWithUnionOf(params IRedisSortedSet<T>[] setIds)
public long PopulateWithUnionOf(params IRedisSortedSet<T>[] setIds)
{
return client.StoreUnionFromSortedSets(this, setIds);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceStack.Redis/Generic/RedisTypedClient_App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public List<TChild> GetRelatedEntities<TChild>(object parentId)
}
}

public int GetRelatedEntitiesCount<TChild>(object parentId)
public long GetRelatedEntitiesCount<TChild>(object parentId)
{
var childRefKey = GetChildReferenceSetKey<TChild>(parentId);
return client.GetSetCount(childRefKey);
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceStack.Redis/Generic/RedisTypedClient_Hash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public bool RemoveEntryFromHash<TKey>(IRedisHash<TKey, T> hash, TKey key)
return client.RemoveEntryFromHash(hash.Id, key.SerializeToString());
}

public int GetHashCount<TKey>(IRedisHash<TKey, T> hash)
public long GetHashCount<TKey>(IRedisHash<TKey, T> hash)
{
return client.GetHashCount(hash.Id);
}
Expand Down
6 changes: 3 additions & 3 deletions src/ServiceStack.Redis/Generic/RedisTypedClient_List.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,18 @@ public void TrimList(IRedisList<T> fromList, int keepStartingFrom, int keepEndin
client.LTrim(fromList.Id, keepStartingFrom, keepEndingAt);
}

public int RemoveItemFromList(IRedisList<T> fromList, T value)
public long RemoveItemFromList(IRedisList<T> fromList, T value)
{
const int removeAll = 0;
return client.LRem(fromList.Id, removeAll, SerializeValue(value));
}

public int RemoveItemFromList(IRedisList<T> fromList, T value, int noOfMatches)
public long RemoveItemFromList(IRedisList<T> fromList, T value, int noOfMatches)
{
return client.LRem(fromList.Id, noOfMatches, SerializeValue(value));
}

public int GetListCount(IRedisList<T> fromList)
public long GetListCount(IRedisList<T> fromList)
{
return client.LLen(fromList.Id);
}
Expand Down
4 changes: 2 additions & 2 deletions src/ServiceStack.Redis/Generic/RedisTypedClient_Set.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public partial class RedisTypedClient<T>
{
public IHasNamed<IRedisSet<T>> Sets { get; set; }

public int Db
public long Db
{
get { return client.Db; }
set { client.Db = value; }
Expand Down Expand Up @@ -95,7 +95,7 @@ public void MoveBetweenSets(IRedisSet<T> fromSet, IRedisSet<T> toSet, T item)
client.SMove(fromSet.Id, toSet.Id, SerializeValue(item));
}

public int GetSetCount(IRedisSet<T> set)
public long GetSetCount(IRedisSet<T> set)
{
return client.SCard(set.Id);
}
Expand Down
16 changes: 8 additions & 8 deletions src/ServiceStack.Redis/Generic/RedisTypedClient_SortedSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ public double IncrementItemInSortedSet(IRedisSortedSet<T> set, T value, double i
return client.IncrementItemInSortedSet(set.Id, value.SerializeToString(), incrementBy);
}

public int GetItemIndexInSortedSet(IRedisSortedSet<T> set, T value)
public long GetItemIndexInSortedSet(IRedisSortedSet<T> set, T value)
{
return client.GetItemIndexInSortedSet(set.Id, value.SerializeToString());
}

public int GetItemIndexInSortedSetDesc(IRedisSortedSet<T> set, T value)
public long GetItemIndexInSortedSetDesc(IRedisSortedSet<T> set, T value)
{
return client.GetItemIndexInSortedSetDesc(set.Id, value.SerializeToString());
}
Expand Down Expand Up @@ -250,17 +250,17 @@ public List<T> GetRangeFromSortedSetByHighestScore(IRedisSortedSet<T> set, doubl
return CreateGenericMap(map);
}

public int RemoveRangeFromSortedSet(IRedisSortedSet<T> set, int minRank, int maxRank)
public long RemoveRangeFromSortedSet(IRedisSortedSet<T> set, int minRank, int maxRank)
{
return client.RemoveRangeFromSortedSet(set.Id, minRank, maxRank);
}

public int RemoveRangeFromSortedSetByScore(IRedisSortedSet<T> set, double fromScore, double toScore)
public long RemoveRangeFromSortedSetByScore(IRedisSortedSet<T> set, double fromScore, double toScore)
{
return client.RemoveRangeFromSortedSetByScore(set.Id, fromScore, toScore);
}
public int GetSortedSetCount(IRedisSortedSet<T> set)

public long GetSortedSetCount(IRedisSortedSet<T> set)
{
return client.GetSortedSetCount(set.Id);
}
Expand All @@ -270,12 +270,12 @@ public double GetItemScoreInSortedSet(IRedisSortedSet<T> set, T value)
return client.GetItemScoreInSortedSet(set.Id, value.SerializeToString());
}

public int StoreIntersectFromSortedSets(IRedisSortedSet<T> intoSetId, params IRedisSortedSet<T>[] setIds)
public long StoreIntersectFromSortedSets(IRedisSortedSet<T> intoSetId, params IRedisSortedSet<T>[] setIds)
{
return client.StoreIntersectFromSortedSets(intoSetId.Id, setIds.ConvertAll(x => x.Id).ToArray());
}

public int StoreUnionFromSortedSets(IRedisSortedSet<T> intoSetId, params IRedisSortedSet<T>[] setIds)
public long StoreUnionFromSortedSets(IRedisSortedSet<T> intoSetId, params IRedisSortedSet<T>[] setIds)
{
return client.StoreUnionFromSortedSets(intoSetId.Id, setIds.ConvertAll(x => x.Id).ToArray());
}
Expand Down
4 changes: 2 additions & 2 deletions src/ServiceStack.Redis/Pipeline/RedisPipelineCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public void WriteCommand(params byte[][] cmdWithBinaryArgs)
cmdCount++;
}

public List<int> ReadAllAsInts()
public List<long> ReadAllAsInts()
{
var results = new List<int>();
var results = new List<long>();
while (cmdCount-- > 0)
{
results.Add(client.ReadInt());
Expand Down
12 changes: 6 additions & 6 deletions src/ServiceStack.Redis/RedisClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public long DecrementValueBy(string key, int count)
return DecrBy(key, count);
}

public int AppendToValue(string key, string value)
public long AppendToValue(string key, string value)
{
return base.Append(key, value.ToUtf8Bytes());
}
Expand Down Expand Up @@ -409,7 +409,7 @@ public IRedisSubscription CreateSubscription()
return new RedisSubscription(this);
}

public int PublishMessage(string toChannel, string message)
public long PublishMessage(string toChannel, string message)
{
return base.Publish(toChannel, message.ToUtf8Bytes());
}
Expand Down Expand Up @@ -708,22 +708,22 @@ internal string UrnKey(Type type, object id)

#region LUA EVAL

public int ExecLuaAsInt(string body, params string[] args)
public long ExecLuaAsInt(string body, params string[] args)
{
return base.EvalInt(body, 0, args.ToMultiByteArray());
}

public int ExecLuaAsInt(string luaBody, string[] keys, string[] args)
public long ExecLuaAsInt(string luaBody, string[] keys, string[] args)
{
return base.EvalInt(luaBody, keys.Length, MergeAndConvertToBytes(keys, args));
}

public int ExecLuaShaAsInt(string sha1, params string[] args)
public long ExecLuaShaAsInt(string sha1, params string[] args)
{
return base.EvalShaInt(sha1, args.Length, args.ToMultiByteArray());
}

public int ExecLuaShaAsInt(string sha1, string[] keys, string[] args)
public long ExecLuaShaAsInt(string sha1, string[] keys, string[] args)
{
return base.EvalShaInt(sha1, keys.Length, MergeAndConvertToBytes(keys, args));
}
Expand Down
4 changes: 2 additions & 2 deletions src/ServiceStack.Redis/RedisClientHash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void AddRange(IEnumerable<KeyValuePair<string, string>> items)
client.SetRangeInHash(hashId, items);
}

public int IncrementValue(string key, int incrementBy)
public long IncrementValue(string key, int incrementBy)
{
return client.IncrementValueInHash(hashId, key, incrementBy);
}
Expand Down Expand Up @@ -97,7 +97,7 @@ public bool Remove(KeyValuePair<string, string> item)

public int Count
{
get { return client.GetHashCount(hashId); }
get { return (int)client.GetHashCount(hashId); }
}

public bool IsReadOnly
Expand Down
6 changes: 3 additions & 3 deletions src/ServiceStack.Redis/RedisClientList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public int Count
{
get
{
return client.GetListCount(listId);
return (int)client.GetListCount(listId);
}
}

Expand Down Expand Up @@ -163,12 +163,12 @@ public void Trim(int keepStartingFrom, int keepEndingAt)
client.TrimList(listId, keepStartingFrom, keepEndingAt);
}

public int RemoveValue(string value)
public long RemoveValue(string value)
{
return client.RemoveItemFromList(listId, value);
}

public int RemoveValue(string value, int noOfMatches)
public long RemoveValue(string value, int noOfMatches)
{
return client.RemoveItemFromList(listId, value, noOfMatches);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceStack.Redis/RedisClientSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public int Count
{
get
{
return client.GetSetCount(setId);
return (int)client.GetSetCount(setId);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/ServiceStack.Redis/RedisClientSortedSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public int Count
{
get
{
return client.GetSortedSetCount(setId);
return (int)client.GetSortedSetCount(setId);
}
}

Expand Down Expand Up @@ -152,7 +152,7 @@ public void StoreFromUnion(params IRedisSortedSet[] ofSets)
client.StoreUnionFromSets(setId, ofSets.GetIds());
}

public int GetItemIndex(string value)
public long GetItemIndex(string value)
{
return client.GetItemIndexInSortedSet(setId, value);
}
Expand Down
6 changes: 3 additions & 3 deletions src/ServiceStack.Redis/RedisClient_Hash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ public void SetRangeInHash(string hashId, IEnumerable<KeyValuePair<string, strin
base.HMSet(hashId, keys, values);
}

public int IncrementValueInHash(string hashId, string key, int incrementBy)
public long IncrementValueInHash(string hashId, string key, int incrementBy)
{
return base.HIncrby(hashId, key.ToUtf8Bytes(), incrementBy);
}

public int IncrementValueInHash(string hashId, string key, long incrementBy)
public long IncrementValueInHash(string hashId, string key, long incrementBy)
{
return base.HIncrby(hashId, key.ToUtf8Bytes(), incrementBy);
}
Expand All @@ -101,7 +101,7 @@ public bool RemoveEntryFromHash(string hashId, string key)
return base.HDel(hashId, key.ToUtf8Bytes()) == Success;
}

public int GetHashCount(string hashId)
public long GetHashCount(string hashId)
{
return base.HLen(hashId);
}
Expand Down

0 comments on commit dc09f6b

Please sign in to comment.