Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
942b15f4
Commit
942b15f4
authored
Nov 30, 2018
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pass RawResult as ref-readonly (it's quite a biggie!)
parent
743d3ca8
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
85 additions
and
85 deletions
+85
-85
ClientInfo.cs
src/StackExchange.Redis/ClientInfo.cs
+2
-2
CommandTrace.cs
src/StackExchange.Redis/CommandTrace.cs
+1
-1
Condition.cs
src/StackExchange.Redis/Condition.cs
+6
-6
PhysicalConnection.cs
src/StackExchange.Redis/PhysicalConnection.cs
+1
-1
RedisDatabase.cs
src/StackExchange.Redis/RedisDatabase.cs
+6
-6
RedisResult.cs
src/StackExchange.Redis/RedisResult.cs
+1
-1
RedisServer.cs
src/StackExchange.Redis/RedisServer.cs
+1
-1
RedisTransaction.cs
src/StackExchange.Redis/RedisTransaction.cs
+3
-3
ResultProcessor.cs
src/StackExchange.Redis/ResultProcessor.cs
+62
-62
RedisRequest.cs
toys/StackExchange.Redis.Server/RedisRequest.cs
+1
-1
RespServer.cs
toys/StackExchange.Redis.Server/RespServer.cs
+1
-1
No files found.
src/StackExchange.Redis/ClientInfo.cs
View file @
942b15f4
...
...
@@ -183,7 +183,7 @@ private static void AddFlag(ref ClientFlags value, string raw, ClientFlags toAdd
private
class
ClientInfoProcessor
:
ResultProcessor
<
ClientInfo
[
]>
{
protected
override
bool
SetResultCore
(
PhysicalConnection
connection
,
Message
message
,
RawResult
result
)
protected
override
bool
SetResultCore
(
PhysicalConnection
connection
,
Message
message
,
in
RawResult
result
)
{
switch
(
result
.
Type
)
{
...
...
@@ -198,4 +198,4 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
}
}
}
}
\ No newline at end of file
}
src/StackExchange.Redis/CommandTrace.cs
View file @
942b15f4
...
...
@@ -71,7 +71,7 @@ public string GetHelpUrl()
private
class
CommandTraceProcessor
:
ResultProcessor
<
CommandTrace
[
]>
{
protected
override
bool
SetResultCore
(
PhysicalConnection
connection
,
Message
message
,
RawResult
result
)
protected
override
bool
SetResultCore
(
PhysicalConnection
connection
,
Message
message
,
in
RawResult
result
)
{
switch
(
result
.
Type
)
{
...
...
src/StackExchange.Redis/Condition.cs
View file @
942b15f4
...
...
@@ -262,7 +262,7 @@ public static Condition StringNotEqual(RedisKey key, RedisValue value)
internal
abstract
IEnumerable
<
Message
>
CreateMessages
(
int
db
,
ResultBox
resultBox
);
internal
abstract
int
GetHashSlot
(
ServerSelectionStrategy
serverSelectionStrategy
);
internal
abstract
bool
TryValidate
(
RawResult
result
,
out
bool
value
);
internal
abstract
bool
TryValidate
(
in
RawResult
result
,
out
bool
value
);
internal
sealed
class
ConditionProcessor
:
ResultProcessor
<
bool
>
{
...
...
@@ -273,7 +273,7 @@ public static Message CreateMessage(Condition condition, int db, CommandFlags fl
return
new
ConditionMessage
(
condition
,
db
,
flags
,
command
,
key
,
value
);
}
protected
override
bool
SetResultCore
(
PhysicalConnection
connection
,
Message
message
,
RawResult
result
)
protected
override
bool
SetResultCore
(
PhysicalConnection
connection
,
Message
message
,
in
RawResult
result
)
{
connection
?.
BridgeCouldBeNull
?.
Multiplexer
?.
OnTransactionLog
(
$"condition '
{
message
.
CommandAndKey
}
' got '
{
result
.
ToString
()}
'"
);
var
msg
=
message
as
ConditionMessage
;
...
...
@@ -382,7 +382,7 @@ internal override IEnumerable<Message> CreateMessages(int db, ResultBox resultBo
internal
override
int
GetHashSlot
(
ServerSelectionStrategy
serverSelectionStrategy
)
=>
serverSelectionStrategy
.
HashSlot
(
key
);
internal
override
bool
TryValidate
(
RawResult
result
,
out
bool
value
)
internal
override
bool
TryValidate
(
in
RawResult
result
,
out
bool
value
)
{
switch
(
type
)
{
...
...
@@ -452,7 +452,7 @@ internal override int GetHashSlot(ServerSelectionStrategy serverSelectionStrateg
return
serverSelectionStrategy
.
HashSlot
(
key
);
}
internal
override
bool
TryValidate
(
RawResult
result
,
out
bool
value
)
internal
override
bool
TryValidate
(
in
RawResult
result
,
out
bool
value
)
{
switch
(
result
.
Type
)
{
...
...
@@ -512,7 +512,7 @@ internal sealed override IEnumerable<Message> CreateMessages(int db, ResultBox r
internal
override
int
GetHashSlot
(
ServerSelectionStrategy
serverSelectionStrategy
)
=>
serverSelectionStrategy
.
HashSlot
(
key
);
internal
override
bool
TryValidate
(
RawResult
result
,
out
bool
value
)
internal
override
bool
TryValidate
(
in
RawResult
result
,
out
bool
value
)
{
switch
(
result
.
Type
)
{
...
...
@@ -614,7 +614,7 @@ internal override int GetHashSlot(ServerSelectionStrategy serverSelectionStrateg
return
serverSelectionStrategy
.
HashSlot
(
key
);
}
internal
override
bool
TryValidate
(
RawResult
result
,
out
bool
value
)
internal
override
bool
TryValidate
(
in
RawResult
result
,
out
bool
value
)
{
switch
(
result
.
Type
)
{
...
...
src/StackExchange.Redis/PhysicalConnection.cs
View file @
942b15f4
...
...
@@ -1549,7 +1549,7 @@ private static RawResult ReadLineTerminatedString(ResultType type, ref BufferRea
}
}
private
static
RawResult
ParseInlineProtocol
(
RawResult
line
)
private
static
RawResult
ParseInlineProtocol
(
in
RawResult
line
)
{
if
(!
line
.
HasValue
)
return
RawResult
.
Nil
;
// incomplete line
...
...
src/StackExchange.Redis/RedisDatabase.cs
View file @
942b15f4
...
...
@@ -3447,7 +3447,7 @@ private sealed class HashScanResultProcessor : ScanResultProcessor<HashEntry>
{
public
static
readonly
ResultProcessor
<
ScanIterator
<
HashEntry
>.
ScanResult
>
Default
=
new
HashScanResultProcessor
();
private
HashScanResultProcessor
()
{
}
protected
override
HashEntry
[]
Parse
(
RawResult
result
)
protected
override
HashEntry
[]
Parse
(
in
RawResult
result
)
{
if
(!
HashEntryArray
.
TryParse
(
result
,
out
HashEntry
[]
pairs
))
pairs
=
null
;
return
pairs
;
...
...
@@ -3456,9 +3456,9 @@ protected override HashEntry[] Parse(RawResult result)
private
abstract
class
ScanResultProcessor
<
T
>
:
ResultProcessor
<
ScanIterator
<
T
>.
ScanResult
>
{
protected
abstract
T
[]
Parse
(
RawResult
result
);
protected
abstract
T
[]
Parse
(
in
RawResult
result
);
protected
override
bool
SetResultCore
(
PhysicalConnection
connection
,
Message
message
,
RawResult
result
)
protected
override
bool
SetResultCore
(
PhysicalConnection
connection
,
Message
message
,
in
RawResult
result
)
{
switch
(
result
.
Type
)
{
...
...
@@ -3628,7 +3628,7 @@ private sealed class SetScanResultProcessor : ScanResultProcessor<RedisValue>
{
public
static
readonly
ResultProcessor
<
ScanIterator
<
RedisValue
>.
ScanResult
>
Default
=
new
SetScanResultProcessor
();
private
SetScanResultProcessor
()
{
}
protected
override
RedisValue
[]
Parse
(
RawResult
result
)
protected
override
RedisValue
[]
Parse
(
in
RawResult
result
)
{
return
result
.
GetItemsAsValues
();
}
...
...
@@ -3674,7 +3674,7 @@ private sealed class SortedSetScanResultProcessor : ScanResultProcessor<SortedSe
{
public
static
readonly
ResultProcessor
<
ScanIterator
<
SortedSetEntry
>.
ScanResult
>
Default
=
new
SortedSetScanResultProcessor
();
private
SortedSetScanResultProcessor
()
{
}
protected
override
SortedSetEntry
[]
Parse
(
RawResult
result
)
protected
override
SortedSetEntry
[]
Parse
(
in
RawResult
result
)
{
if
(!
SortedSetWithScores
.
TryParse
(
result
,
out
SortedSetEntry
[]
pairs
))
pairs
=
null
;
return
pairs
;
...
...
@@ -3729,7 +3729,7 @@ private class StringGetWithExpiryProcessor : ResultProcessor<RedisValueWithExpir
{
public
static
readonly
ResultProcessor
<
RedisValueWithExpiry
>
Default
=
new
StringGetWithExpiryProcessor
();
private
StringGetWithExpiryProcessor
()
{
}
protected
override
bool
SetResultCore
(
PhysicalConnection
connection
,
Message
message
,
RawResult
result
)
protected
override
bool
SetResultCore
(
PhysicalConnection
connection
,
Message
message
,
in
RawResult
result
)
{
switch
(
result
.
Type
)
{
...
...
src/StackExchange.Redis/RedisResult.cs
View file @
942b15f4
...
...
@@ -45,7 +45,7 @@ public static RedisResult Create(RedisResult[] values)
// internally, this is very similar to RawResult, except it is designed to be usable
// outside of the IO-processing pipeline: the buffers are standalone, etc
internal
static
RedisResult
TryCreate
(
PhysicalConnection
connection
,
RawResult
result
)
internal
static
RedisResult
TryCreate
(
PhysicalConnection
connection
,
in
RawResult
result
)
{
try
{
...
...
src/StackExchange.Redis/RedisServer.cs
View file @
942b15f4
...
...
@@ -742,7 +742,7 @@ protected override Message CreateMessage(long cursor)
public
static
readonly
ResultProcessor
<
ScanResult
>
processor
=
new
KeysResultProcessor
();
private
class
KeysResultProcessor
:
ResultProcessor
<
ScanResult
>
{
protected
override
bool
SetResultCore
(
PhysicalConnection
connection
,
Message
message
,
RawResult
result
)
protected
override
bool
SetResultCore
(
PhysicalConnection
connection
,
Message
message
,
in
RawResult
result
)
{
switch
(
result
.
Type
)
{
...
...
src/StackExchange.Redis/RedisTransaction.cs
View file @
942b15f4
...
...
@@ -171,7 +171,7 @@ private class QueuedProcessor : ResultProcessor<bool>
{
public
static
readonly
ResultProcessor
<
bool
>
Default
=
new
QueuedProcessor
();
protected
override
bool
SetResultCore
(
PhysicalConnection
connection
,
Message
message
,
RawResult
result
)
protected
override
bool
SetResultCore
(
PhysicalConnection
connection
,
Message
message
,
in
RawResult
result
)
{
if
(
result
.
Type
==
ResultType
.
SimpleString
&&
result
.
IsEqual
(
CommonReplies
.
QUEUED
))
{
...
...
@@ -432,7 +432,7 @@ private class TransactionProcessor : ResultProcessor<bool>
{
public
static
readonly
TransactionProcessor
Default
=
new
TransactionProcessor
();
public
override
bool
SetResult
(
PhysicalConnection
connection
,
Message
message
,
RawResult
result
)
public
override
bool
SetResult
(
PhysicalConnection
connection
,
Message
message
,
in
RawResult
result
)
{
if
(
result
.
IsError
&&
message
is
TransactionMessage
tran
)
{
...
...
@@ -447,7 +447,7 @@ public override bool SetResult(PhysicalConnection connection, Message message, R
return
base
.
SetResult
(
connection
,
message
,
result
);
}
protected
override
bool
SetResultCore
(
PhysicalConnection
connection
,
Message
message
,
RawResult
result
)
protected
override
bool
SetResultCore
(
PhysicalConnection
connection
,
Message
message
,
in
RawResult
result
)
{
connection
?.
BridgeCouldBeNull
?.
Multiplexer
?.
OnTransactionLog
(
$"got
{
result
}
for
{
message
.
CommandAndKey
}
"
);
if
(
message
is
TransactionMessage
tran
)
...
...
src/StackExchange.Redis/ResultProcessor.cs
View file @
942b15f4
This diff is collapsed.
Click to expand it.
toys/StackExchange.Redis.Server/RedisRequest.cs
View file @
942b15f4
...
...
@@ -28,7 +28,7 @@ public string GetString(int index)
=>
string
.
Equals
(
value
,
_inner
[
index
].
GetString
(),
StringComparison
.
OrdinalIgnoreCase
);
public
override
int
GetHashCode
()
=>
throw
new
NotSupportedException
();
internal
RedisRequest
(
RawResult
result
)
internal
RedisRequest
(
in
RawResult
result
)
{
_inner
=
result
;
Count
=
result
.
ItemsCount
;
...
...
toys/StackExchange.Redis.Server/RespServer.cs
View file @
942b15f4
...
...
@@ -468,7 +468,7 @@ public TypedRedisValue Execute(RedisClient client, RedisRequest request)
}
}
internal
static
string
ToLower
(
RawResult
value
)
internal
static
string
ToLower
(
in
RawResult
value
)
{
var
val
=
value
.
GetString
();
if
(
string
.
IsNullOrWhiteSpace
(
val
))
return
val
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment