Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

Make the MessageHandler list injected type safe and Singleton. #427

Closed
aboimpinto opened this issue Sep 20, 2018 · 1 comment
Closed

Make the MessageHandler list injected type safe and Singleton. #427

aboimpinto opened this issue Sep 20, 2018 · 1 comment

Comments

@aboimpinto
Copy link
Contributor

aboimpinto commented Sep 20, 2018

The current implementation of the Strategy pattern do not consider type safe, this mean the interface IMessageHandler will receive a message to handle and this need to be cast to the message type the handler handle.

According with Simple Injector documentation it's possible to have a collection of safe types strategies

https://simpleinjector.readthedocs.io/en/latest/advanced.html?highlight=Collection

@aboimpinto aboimpinto changed the title Make the MessageHandler list injected type safe. Make the MessageHandler list injected type safe and Singleton. Sep 22, 2018
aboimpinto added a commit to aboimpinto/neo-sharp that referenced this issue Sep 23, 2018
osmirnov pushed a commit that referenced this issue Sep 25, 2018
* RocksDbRepository reach 42% cover

* Rename abstract class ICrypto to Crypto. I'm sure this was once an interface but it's not anymore, threfore should not carry the prefix "I" that identify the interfaces.

* fix some merge problems

* Increase Server tests coverage to 94%.
Black listed peers try to connect test

* fix merge issues

* * Remove protected fields from TestBase and replace with overload usage of the method RandomInt.
* Small clean up on the UtCrypto

* Create UtBlockchain and create first tests.
more tests will be added soon!

* fix issues from the merge

* Adding testing information to the team Contributing page.

* Small CleanUp the test class with properties that aren't been used anymore.

* UtBlockChain: InitializeBlockchain_IsGenesisBlock_InitializeComplete

* Firsts UtBlockProcessor tests

* AddBlock tests added

* * UtBlockProcessor: Run test
* Fix an inverted if logic. The code only enter in the While loop if the cancellation was requested and should be the other way around.

* Cleanup
* Replace BlockProcessor dependency from Prompt and replace with IBlockPool
* Remove unused properties from BlockProcessor
*  ContainsBlock method in BlockProcessor signature changed to Private because is not used anywhere else but internally

* UtBlockProcessor - Loop test: When the received block is not the expected next.

* Remove comment

* Remove async modifier from methods that aren't implemented

* .

* Merge branch 'development' of https://github.com/aboimpinto/neo-sharp into development

* Add test class, #301

* Write tests for Add method.
#301

* Refactor the Block / BlockHeader in Signed and Unsigned objects (mutable and immutable).
The intenstion of this refactor is to bring better readability of the code and remove logic code from the DTO.

* Implement the UpdateHash methods in the creation of the Signed<object>

* Signed and Unsigned strucuture return GenenisBlock

* Draft of the BinaryCustomSeralization of TransactionBase

* Revert "Remove stack logs (#321)"

This reverts commit 34c676a.

* Add BlockOperationsManager and WitnessOperationManager that will be resposable to Sign and Verify the block and the witness

* Initial work, removing logic from the model objects and add it into Witness. Transaction, BlockHeader and Block OperationManager classes.
In this classes the verify method will be implemented.

#306, #307

* Cleanup and remove code that was not merged.

* regreassion test for the case where the current block is null. This happen when the node start without genesis block.

* Remove dependencies from BlockProcessor and remove BlockHeader references. BlockProcessor use only Block object.
#350, #351

* now the Persist consider the genesis block for the case of start a node in a clean environment

* * Remove IContainer from the MessageHandlerProxy. All handlers are now injected in the contructor
* Strategy pattern used to find what MessageHandler should process the message.

* Adding more debug messages and minor validations.
remove comment code from MessageHandlerProxy

* Remove comment code and clean up the usings

* Replace Blockchain class dependencies with BlockchainContext.

#426

* NeoSharp.SyncMVP removed

* Remove NetworkStream.Dispose because it's already called called during the dispose.

* refactor the Handle method to remove the foreach and nested if statement

* add appsetting.neo-privnet.json

* Missing cleanup when <object>OperationManager classes were introduced.

* Cleanup the registration of the message handlers and MessageHandlerProxy has his own interface now.

* Registration of MessageHandler is now singleton as requested by @osmirnov
#427

* NeedPeerSync and IsSync properties added to BlockchainContext

* MessageHandlers are type safe. The solution was to use an interface and an abstract class.

#427

* remove example commented code

* merge with development

* merge with development
@aboimpinto
Copy link
Contributor Author

it's fine so far could need refactor later

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant