1 /**
2 Copyright: Copyright (c) 2021, Joakim Brännström. All rights reserved.
3 License: MPL-2
4 Author: Joakim Brännström (joakim.brannstrom@gmx.com)
5 
6 This Source Code Form is subject to the terms of the Mozilla Public License,
7 v.2.0. If a copy of the MPL was not distributed with this file, You can obtain
8 one at http://mozilla.org/MPL/2.0/.
9 */
10 module dextool.plugin.mutate.backend.test_mutant.common_actors;
11 
12 import my.actor : typedActor;
13 import my.path : AbsolutePath;
14 
15 import dextool.plugin.mutate.backend.analyze.schema_ml : SchemaQ, SchemaSizeQ;
16 import dextool.plugin.mutate.backend.database : dbOpenTimeout;
17 import dextool.plugin.mutate.backend.test_mutant.common : MutationTestResult;
18 import dextool.plugin.mutate.backend.test_mutant.timeout : TimeoutFsm;
19 
20 // common messages
21 
22 struct Init {
23 }
24 
25 // actors
26 
27 struct IsDone {
28 }
29 
30 // Save test results to the database.
31 // dfmt off
32 alias DbSaveActor = typedActor!(
33         // init the actor by opening the database.
34         void function(Init, AbsolutePath dbPath),
35         // save the result to the database
36         void function(MutationTestResult result, TimeoutFsm timeoutFsm),
37         void function(MutationTestResult result, long timeoutIter),
38         void function(SchemaQ),
39         void function(SchemaSizeQ),
40         // query if it has finished saving to the db.
41         bool function(IsDone));
42 // dfmt on
43 
44 struct GetMutantsLeft {
45 }
46 
47 struct UnknownMutantTested {
48 }
49 
50 struct Tick {
51 }
52 
53 struct ForceUpdate {
54 }
55 
56 // Progress statistics for the mutation testing such as how many that are left to test.
57 // dfmt off
58 alias StatActor = typedActor!(
59         // init the actor by opening the database.
60         void function(Init, AbsolutePath dbPath),
61         long function(GetMutantsLeft),
62         void function(Tick),
63         // force an update of the statistics
64         void function(ForceUpdate),
65         // a mutant has been tested and is done
66         void function(UnknownMutantTested, long));
67 // dfmt on