drain method

Future<void> drain()

Stops accepting new writes while continuing to serve downloads, and tells the hub.

The safe way to retire a node: the hub stops placing new artifacts here immediately, while every client already downloading from it finishes normally. Replicate its artifacts elsewhere, then stop it.

Implementation

Future<void> drain() async {
  _draining = true;
  await _announce();
  logger.info('Storage node draining', context: {'node': nodeId});
}