Skip to content
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

INDY-1338: Design interfaces for ViewChangeService + PoC simulation tests #1242

Merged
merged 23 commits into from
Jun 20, 2019

Conversation

skhoroshavin
Copy link
Member

No description provided.

Sergey Khoroshavin added 7 commits June 18, 2019 12:55
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
Sergey Khoroshavin added 10 commits June 18, 2019 18:44
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
def subscribe(self, message_type: Type, handler: Callable):
self._handlers[message_type].append(handler)

def send(self, *args):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make the first parameter (message) explicit here?

def __init__(self):
self._handlers = defaultdict(list) # type: Dict[Type, List[Callable]]

def subscribe(self, message_type: Type, handler: Callable):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we define the interface for subscribers (observers)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. In this generic case interface is as simple as callable accepting arbitrary parameters. The only limitation is that these parameters should match those passed to send

Sergey Khoroshavin added 5 commits June 19, 2019 20:27
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
@skhoroshavin skhoroshavin changed the title [WIP] INDY-1338: Design interfaces for ViewChangeService INDY-1338: Design interfaces for ViewChangeService Jun 20, 2019
@skhoroshavin skhoroshavin changed the title INDY-1338: Design interfaces for ViewChangeService INDY-1338: Design interfaces for ViewChangeService + PoC simulation tests Jun 20, 2019
return []

@property
def prepared(self) -> List[PrePrepare]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add comments describing what these properties mean.

Signed-off-by: Sergey Khoroshavin <sergey.khoroshavin@dsr-corporation.com>
prepared = []
preprepared = []

self._data.view_no += 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we will need to store the view we are changing from to use it for 3PC messages from the previous view we are going to re-order.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having NewView with PrePrepares from previous view would be enough. Furthermore, having a previous view_no won't do us any good since we might need to reorder batches from different previous views.

from plenum.test.simulation.sim_random import SimRandom, DefaultSimRandom


class ReplicaService:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it in test module? Should it be a production code?

@ashcherbakov ashcherbakov merged commit b95ae3a into hyperledger:master Jun 20, 2019
@skhoroshavin skhoroshavin deleted the indy-1338 branch June 20, 2019 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants