-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Persistence Refactoring #2634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Persistence Refactoring #2634
Conversation
alexvaluyskiy
commented
Apr 27, 2017
- Fixed racing conditions in the tests
- Removed dead code
- Use C# 6
- Added XML documentation
/// TBD | ||
/// </summary> | ||
/// <param name="payload">TBD</param> | ||
/// <param name="sender">TBD</param> | ||
public NonPersistentMessage(object payload, IActorRef sender) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Internal code should not contains TBD Xml comments
@@ -249,22 +248,6 @@ private void HandleDeleteMessagesTo(DeleteMessagesTo message) | |||
}, _continuationOptions); | |||
} | |||
|
|||
private void HandleReadHighestSequenceNr(ReadHighestSequenceNr message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dead code
/// </summary> | ||
/// <param name="context">TBD</param> | ||
/// <param name="message">TBD</param> | ||
public static void EnqueueMessageFirst(this IActorContext context, object message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dead code
{ | ||
internal static class CollectionsExtensions | ||
{ | ||
public static ImmutableArray<T> AddFirst<T>(this ImmutableArray<T> @this, T item) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Emulated LinkedList
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you checked the performance? AFAIK LinkedList AddFirst operation is O(1). Using ImmutableArray is copying the whole array into new struct: implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this one is slower. But I'm using it only in unit tests
/// TBD | ||
/// </summary> | ||
[Serializable] | ||
public sealed class ReadHighestSequenceNr : IJournalRequest, IEquatable<ReadHighestSequenceNr> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dead code from the pre-2.4 persistence
@@ -121,7 +123,7 @@ public override string ToString() | |||
|
|||
internal abstract class ExamplePersistentActor : NamedPersistentActor | |||
{ | |||
protected LinkedList<object> Events = new LinkedList<object>(); | |||
protected ImmutableArray<object> Events = ImmutableArray<object>.Empty; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protection from the racing conditions
Only one question left in comments. Beside that everything is fine. |
/// <param name="destination">TBD</param> | ||
/// <param name="message">TBD</param> | ||
/// <param name="timestamp">TBD</param> | ||
/// <param name="attempt">TBD</param> | ||
public Delivery(ActorPath destination, object message, DateTime timestamp, int attempt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one will be internal in the next version, no need to have TBD docs