totalShards top-level property

int totalShards

The total number of shards spawned across all processes. Only for use in spawned processes.

Invoking this getter in a process that was not spawned by nyxx_sharding will throw a ShardingError.

Implementation

int get totalShards {
  if (Platform.environment.containsKey('NYXX_SHARDING_TOTAL_SHARDS')) {
    return int.parse(Platform.environment['NYXX_SHARDING_TOTAL_SHARDS']!);
  }
  throw ShardingError('Missing NYXX_SHARDING_TOTAL_SHARDS variable');
}