-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathProgram.fs
40 lines (28 loc) · 1.12 KB
/
Program.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Learn more about F# at http://fsharp.org
open System
open Proto.FSharp
open Proto.Mailbox
open Proto.FSharp.Core
open Proto.Remote
open ProtoActorDemo.Messages
let testLocal() =
let masterPid = Master.createMaster 100
Worker.createWorkerMonitor 5 (Worker.requestWork masterPid) |> ignore
[<EntryPoint>]
let main argv =
printfn "Registrating protos"
Serialization.RegisterFileDescriptor(ProtoActorDemo.Messages.MessagesReflection.Descriptor)
let argList = argv |> Array.toList
match argList with
| [] | "hello"::_ -> HelloProtoActor.hello()
| "supervision"::_ | "s"::_ -> Supervision.run()
| "local"::_ | "l" :: _ -> testLocal()
| "m"::count::_ -> Master.startMaster (Int32.Parse count) |> ignore
| "w"::count::_ -> Worker.startWorker (Int32.Parse count) |> ignore
| _ -> printfn "Unkown argument: %A" argList
// let masterPid = Master.createMaster 30
// let workerPids = [1 .. 10] |> List.map (fun i -> Worker.createWorker masterPid i)
// printfn "Hello World from F#!"
System.Threading.Thread.Sleep Int32.MaxValue
0 // return an integer exit code
// Parent node....