startProcess method

  1. @override
Future<Satellite> startProcess({
  1. required DbName dbName,
  2. required DBSchema dbDescription,
  3. required DatabaseAdapter adapter,
  4. required Migrator migrator,
  5. required Notifier notifier,
  6. required SocketFactory socketFactory,
  7. required HydratedConfig config,
  8. SatelliteOverrides? overrides,
})

Implementation

@override
Future<Satellite> startProcess({
  required DbName dbName,
  required DBSchema dbDescription,
  required DatabaseAdapter adapter,
  required Migrator migrator,
  required Notifier notifier,
  required SocketFactory socketFactory,
  required HydratedConfig config,
  SatelliteOverrides? overrides,
}) async {
  // validateConfig should not be necessary, because we are already using a typed class
  // final foundErrors = validateConfig(config);
  // if (foundErrors.length > 0) {
  //   throw Exception("invalid config: ${foundErrors}");
  // }

  final satelliteClientOpts = SatelliteClientOpts(
    host: config.replication.host,
    port: config.replication.port,
    ssl: config.replication.ssl,
    timeout: config.replication.timeout.inMilliseconds,
    dialect: config.replication.dialect,
  );

  final client = SatelliteClient(
    dbDescription: dbDescription,
    socketFactory: socketFactory,
    opts: satelliteClientOpts,
  );

  final SatelliteOpts satelliteOpts =
      satelliteDefaults(config.namespace).copyWith(
    connectionBackoffOptions: config.connectionBackoffOptions,
  );

  final satellite = SatelliteProcess(
    dbName: dbName,
    adapter: adapter,
    migrator: migrator,
    notifier: notifier,
    client: client,
    opts: satelliteOpts,
  );
  await satellite.start(config.auth);

  return satellite;
}