I know how this works
Quick start for folks that know about distributed systems.
I know how this works
This assumes you have a lot of experience and significant knowlege of computer science.
It is not for beginners.
Setup
- Start with the hello world Makefile
- Use
make tools
from the Makefile to download a copy of program runner
, a copy of
the protobuf plugin protoc-gen-parigot
and the library syscall.so
.
a simple program
- Define the protocols between your services as a .proto file
- Generate code via the
make generate
approach from the Makefile. - Define a
main()
that is your program, like helloworld.- Use
Launch()
to start your program. It’ll return a future. - On
Success()
proceed to your program proper. - Call methods on other services via the generated guest code.
- You must run the loop that checks for events. For clients,
MustRunClient is the usual approach.
- Use the
Exit()
and its returned future to exit.
a simple service
- A simple service should probably start with greenting/main.go
- As above, you need to launch the service and deal with the future on startup.
- If you need references to other services to implement your services, do that
in the ]Ready](https://github.com/iansmith/parigot-example/blob/ddb4801f62167aff79e9d36005b21280f2e378b2/helloworld/greeting/main.go#L87) method that is called just after launch.
- Use
Locate()
to find the other service. Locate is defined by the generated code of
the other service.
- Implement the methods from the .proto. It’s best to do them with the
two parts that different by a capital first letter.
- Methods defined in the .proto will automatically be hooked up to the event loop.
- You can call Run() and
the implementations of your methods will be called when other services or
programs call them.
Notes
- A service or program is single threaded, but different services can and do run in parallel.
- We use futures to deal
with the single-threadedness. Within a service or program you need not lock.
- Methods in a service need to return in <50ms or it should it return an id
that be “polled” later. Services that have methods that take too long may be
killed by parigot.