Serve you Tips and tricks to fluidify your (public) transit !
Reads a ntfs dataset and then process protobuf journey requests (the format is specified by the navitia-proto repo) send to a zmq socket, call the loki
engine, and returns the protobuf response on the zmq socket.
Install libzmq (needed for the zmq
crate, cf https://crates.io/crates/zmq/):
apt install libzmq3-dev
Be sure to fetch the navitia-proto
git submodule.
git submodule init # a first time, to fetch the navitia-proto repo
git submodule update # each time the navitia-proto repo is updated
cargo build --release
Loki-server can be used to answer the "public transit" part of distributed journey request. The setup is as follow :
- a jormun server will receive the distributed journey request, and create several subrequest to be handled by backends, before serving the response
- a loki-server backend will answer all "pt_journey" subrequests
- a kraken backend will answer all other subrequests
You should have a ntfs dataset in /path/to/ntfs
which has been binarized to /path/to/data.nav.lz4
(you can use eitry for generating a data.nav.lz4
from a ntfs dataset).
You need to setup :
- a jormun server from this branch which should be configured with
{"key": "mycoverage", "zmq_socket": "ipc:///tmp/kraken", "pt_zmq_socket" : "ipc:///tmp/loki"}
- a kraken configured with
[GENERAL]
instance_name = "mycoverage"
database = /path/to/data.nav.lz4
zmq_socket = ipc:///tmp/kraken
- a loki server launched with
cargo run --release -- launch --input_data_path /path/to/ntfs --input_data_type ntfs --basic_requests_socket ipc:///tmp/loki
Then you can send http requests to the jormun server !
This crate uses prost to handle (de)serialization of protobuf. The protobuf schema is specified in navitia-proto.
This means that Rust code is generated from .proto
files at compile time, by prost-build in the build script build.rs.
To see where the rust code is generated, run
cargo build --release -vv
And you should see a line like the following in the output :
[server 0.1.0] Writing protobuf code in /home/pascal/loki/target/release/build/server-52f917f3d3486970/out/pbnavitia.rs
See this page for more information on build scripts.