module library
The surface a module built on top of rig is entitled to.
rig_postgres is the first module built on rig, and it needed pieces of
engine.dart — the lock, the project name — that library's own doc
comment disclaims as unstable. Depending on engine.dart would have tied
every future module to a library that changes with whatever rig itself
needs next.
This library is different: it is a promise. A module may depend on exactly what is exported here, and it will not move out from under it.
Classes
- AcquiredContainer
- A container that exists, is running, and is ready to use.
- ContainerLease
- A container a test is using.
- DockerEngine
- The slice of the Docker Engine API that rig needs.
- ExecResult
- What a command run inside a container produced.
Constants
- defaultMarkerStaleAfter → const Duration
- How long a suite's marker is trusted before the suite is presumed gone.
- defaultStaleAfter → const Duration
- How long a suite database has to sit unused before it is treated as abandoned.
Functions
-
currentEngine(
{Future< DockerEngine> connect() = connectToDocker}) → Future<DockerEngine> - The Docker client for this isolate, connected on first use.
-
currentProjectName(
{Directory? from}) → String - The pubspec name of the package the tests belong to, for labelling.
-
isReclaimableSuiteDatabase(
{required String database, required DateTime now, required File marker, Duration staleAfter = defaultStaleAfter, Duration markerStaleAfter = defaultMarkerStaleAfter}) → bool -
Whether
databaseis a suite database that can be taken back. -
markerStillClaims(
File marker, {required DateTime now, Duration markerStaleAfter = defaultMarkerStaleAfter}) → bool -
Whether
markerstill says a running suite holds what it claims. -
newSuiteToken(
) → String - A fresh token for a suite database name.
-
overrideEngine(
DockerEngine engine) → void -
Makes
enginethe client this isolate uses. For rig's own tests and for module tests. -
specHash(
ContainerSpec spec, {int maxMountBytes = defaultMaxMountBytes}) → String - The key rig uses to decide whether a container it already runs can serve this spec.
-
suiteDatabaseName(
{required String project, required DateTime now, required String token}) → String - A database name for one suite.
-
suiteMarkerFile(
{required StateDir stateDir, required String kind, required String containerId, required String resource}) → File -
Where the marker recording that
resourceinsidecontainerIdbelongs to a suite that is still running is kept. -
withExclusiveLock<
T> (String lockPath, Future< T> body(), {Duration staleAfter = defaultLockStaleAfter, Duration timeout = _defaultTimeout, Duration retryInterval = _defaultRetryInterval, DateTime now() = DateTime.now, Future<void> sleep(Duration) = _delay}) → Future<T> -
Run
bodywith nothing else holdinglockPath.