ridelab

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package ridelab is RideLab, an on-demand rides and food delivery service: riders see nearby cars, ask for an ETA and request a ride or order from a restaurant; a dispatcher matches each trip to a driver; the rider follows the driver live over a WebSocket until the trip is complete; drivers' apps stream their locations over a WebSocket. It is the reference app for the delivery pack.

The fleet is 10,000 simulated drivers circling their neighbourhoods in a 15 km square city; positions are computed from the clock, so nothing runs in the background. Trips run thirty times faster than real time: a driver ten minutes away arrives in twenty seconds.

Planted bottlenecks (see README.md), each switched off by a fix flag:

  • geo: finding nearby drivers (for the map and for matching) checks the distance to all 10,000 (fix "geo" looks only in the grid cells around the point).
  • dispatch: matching asks the routing service for the closest candidates' ETAs to the pickup while holding the fleet lock, so trips are matched one at a time and location updates wait (fix "dispatch" asks first, then locks only to claim the chosen driver).
  • eta: every ETA is a call to the routing service, which takes 5ms and searches the city's 22,500 road blocks: every price check, every match, and every tracking update to every rider, every second (fix "eta" derives tracking ETAs from the route planned at matching and caches travel times between blocks for 30 seconds).

Index

Constants

View Source
const (
	// Drivers is the size of the simulated fleet (d00001 ... d10000).
	Drivers = 10000
	// Riders is how many rider accounts exist (r0001 ... r5000).
	Riders = 5000
	// Password is every account's password.
	Password = "ridelab-pass"
)

Variables

This section is empty.

Functions

func New

func New(cfg labkit.Config) http.Handler

New returns RideLab's handler.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL