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

Generalize Modules to 2 types: ActiveModule and PassiveModule #98

Merged
merged 34 commits into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
15aca91
Use dynamic reflect.Select in main event loop
matejpavlovic Jun 13, 2022
1305f75
Add dest_module field to event proto definitions
matejpavlovic Jun 13, 2022
8d14376
Add generic (passive) modules
matejpavlovic Jun 13, 2022
4f18010
Rename hash to digest in crypto implementation
matejpavlovic Jun 13, 2022
9235d97
Move default ISS module definitions to ISS package
matejpavlovic Jun 13, 2022
f970b23
Generalize Hasher module
matejpavlovic Jun 13, 2022
31fae4c
Generalize App module
matejpavlovic Jun 13, 2022
8cee9a0
Generalize Crypto module
matejpavlovic Jun 13, 2022
83294f7
Generalize WAL module
matejpavlovic Jun 13, 2022
8932949
Generalize ClientTracker module
matejpavlovic Jun 13, 2022
6cb41cd
Generalize ReqestStore module
matejpavlovic Jun 14, 2022
eba24ed
Generalize ISS protocol module
matejpavlovic Jun 14, 2022
512bd37
Separate event interceptor from modules
matejpavlovic Jun 14, 2022
18fc7ca
Introduce the ActiveModule
matejpavlovic Jun 14, 2022
fcc6907
Generalize Timer module
matejpavlovic Jun 14, 2022
7e8fef0
Generalize Net module
matejpavlovic Jun 14, 2022
2c934b9
Simplify and clean up event and module handling
matejpavlovic Jun 14, 2022
67415d8
Remove unused dummy components
matejpavlovic Jun 14, 2022
3ba5cbc
Remove old module definitions
matejpavlovic Jun 14, 2022
f4dcd0a
Abstract foreign module names in ISS
matejpavlovic Jun 14, 2022
908acf9
Fix tests hanging on error
matejpavlovic Jun 14, 2022
7001729
Add Null module and use it as default ISS WAL
matejpavlovic Jun 14, 2022
0237ef4
Update chat demo app to use new modules
matejpavlovic Jun 14, 2022
9ac48c3
Remove obsolete NullNet and make linter happy
matejpavlovic Jun 14, 2022
416dfee
Sequential and concurrent event processing
matejpavlovic Jun 15, 2022
64f5e8b
Make Module implementations explicit
matejpavlovic Jun 15, 2022
706c296
Safely apply events also to ActiveModules
matejpavlovic Jun 15, 2022
bd30747
Fix documentation of processModuleEvents
matejpavlovic Jun 15, 2022
1819a8b
Move Status() function modules to Module
matejpavlovic Jun 15, 2022
edb1c99
Remove node status and ImplementsModule() panics
matejpavlovic Jun 15, 2022
a2f5b0d
Do not export foreign module names in ISS
matejpavlovic Jun 15, 2022
f434280
Fix and simplify some select statements
matejpavlovic Jun 15, 2022
23ba462
Fix bug in stripping events, making debugging work
matejpavlovic Jun 16, 2022
c2f001f
Simplify crypto implementation interface
matejpavlovic Jun 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions cmd/mircat/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ func debuggerNode(id t.NodeID, membership []t.NodeID) (*mir.Node, error) {
reqStore := reqstore.NewVolatileRequestStore()

// Instantiate and return a minimal Mir Node.
node, err := mir.NewNode(id, &mir.NodeConfig{Logger: logger}, &modules.Modules{
Net: &nullNet{},
Crypto: &mirCrypto.DummyCrypto{DummySig: []byte{0}},
App: &deploytest.FakeApp{ReqStore: reqStore},
RequestStore: reqStore,
Protocol: protocol,
})
node, err := mir.NewNode(id, &mir.NodeConfig{Logger: logger}, map[t.ModuleID]modules.Module{
"net": modules.NullActive{},
"crypto": mirCrypto.New(&mirCrypto.DummyCrypto{DummySig: []byte{0}}),
"app": &deploytest.FakeApp{ReqStore: reqStore},
"reqStore": reqStore,
"iss": protocol,
}, nil)
if err != nil {
return nil, fmt.Errorf("could not instantiate mir node: %w", err)
}
Expand Down
21 changes: 0 additions & 21 deletions cmd/mircat/nullnet.go

This file was deleted.

40 changes: 14 additions & 26 deletions mir_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ var _ = Describe("Basic test", func() {
// The deployment used by the test.
deployment *deploytest.Deployment

// When the deployment stops, the final node statuses will be written here.
finalStatuses []deploytest.NodeStatus
// When the deployment stops, the errors returned by the nodes will be written here.
nodeErrors []error

heapObjects int64
heapAlloc int64
Expand All @@ -58,7 +58,7 @@ var _ = Describe("Basic test", func() {

// Before each run, clear the test state variables.
BeforeEach(func() {
finalStatuses = nil
nodeErrors = nil
ctx = context.Background()
})

Expand Down Expand Up @@ -90,17 +90,16 @@ var _ = Describe("Basic test", func() {
}()
}

// Run deployment until it stops and returns final node statuses.
finalStatuses, heapObjects, heapAlloc = deployment.Run(ctx)
// Run deployment until it stops and returns final node errors.
nodeErrors, heapObjects, heapAlloc = deployment.Run(ctx)
fmt.Printf("Deployment run returned.")

// Check whether all the test replicas exited correctly.
Expect(finalStatuses).NotTo(BeNil())
for _, status := range finalStatuses {
if status.ExitErr != mir.ErrStopped {
Expect(status.ExitErr).NotTo(HaveOccurred())
Expect(nodeErrors).NotTo(BeNil())
for _, err := range nodeErrors {
if err != mir.ErrStopped {
Expect(err).NotTo(HaveOccurred())
}
Expect(status.StatusErr).NotTo(HaveOccurred())
}

// Check if all requests were delivered.
Expand All @@ -127,28 +126,17 @@ var _ = Describe("Basic test", func() {
}

// Print final status of the system.
fmt.Printf("\n\nPrinting status because of failed test in %s\n",
CurrentGinkgoTestDescription().TestText)
fmt.Printf("\n\nPrinting errors because of failed test in %s\n", CurrentSpecReport().FullText())

for nodeIndex, nodeStatus := range finalStatuses {
for nodeIndex, err := range nodeErrors {
fmt.Printf("\nStatus for node %d\n", nodeIndex)

// ErrStopped indicates normal termination.
// If another error is detected, print it.
if nodeStatus.ExitErr == mir.ErrStopped {
if err == mir.ErrStopped {
fmt.Printf("\nStopped normally\n")
} else {
fmt.Printf("\nStopped with error: %+v\n", nodeStatus.ExitErr)
}

// Print node status if available.
if nodeStatus.StatusErr != nil {
// If node status could not be obtained, print the associated error.
fmt.Printf("Could not obtain final status of node %d: %v", nodeIndex, nodeStatus.StatusErr)
} else {
// Otherwise, print the status.
// TODO: print the status in a readable form.
fmt.Printf("%v\n", nodeStatus.Status)
fmt.Printf("\nStopped with error: %+v\n", err)
}
}
}
Expand Down Expand Up @@ -198,7 +186,7 @@ var _ = Describe("Basic test", func() {
Transport: "fake",
NumFakeRequests: 100,
Directory: "",
Duration: 8 * time.Second,
Duration: 10 * time.Second,
FirstReplicaISSConfig: slowProposeConfig,
}),
Entry("Submits 10 fake requests with 4 nodes and actual networking", &deploytest.TestConfig{
Expand Down
Loading