ProcessGitUploadPackService constructor
ProcessGitUploadPackService({
- required FutureOr<
GitFileBareRepository?> resolveRepository(), - GitProcessLauncher? launcher,
- String executable = 'git',
- Map<
String, String> ? globalEnvironment, - required Duration inactivityTimeout,
- required int bufferBytes,
Creates the service resolving served identifiers with
resolveRepository, launching git through launcher, releasing idle
exchanges after inactivityTimeout and holding at most bufferBytes
bytes per exchange.
When no launcher is given, the service builds one on a
ProcessGitRunner launching executable with globalEnvironment
layered over the inherited environment, so a caller needs no runner of
its own. Giving executable or globalEnvironment together with a
launcher raises an ArgumentError naming the extra parameter, since
the launcher already carries its runner.
inactivityTimeout and bufferBytes must be positive.
Implementation
ProcessGitUploadPackService({
required FutureOr<GitFileBareRepository?> Function(GitServedRepositoryId)
resolveRepository,
GitProcessLauncher? launcher,
String executable = 'git',
Map<String, String>? globalEnvironment,
required Duration inactivityTimeout,
required int bufferBytes,
}) : _resolveRepository = resolveRepository,
_launcher = launcher ??
ProcessGitProcessLauncher(
runner: ProcessGitRunner(
executable: executable,
globalEnvironment: globalEnvironment,
),
),
_inactivityTimeout = inactivityTimeout,
_bufferBytes = bufferBytes {
if (launcher != null && executable != 'git') {
throw ArgumentError.value(
executable,
'executable',
'cannot be given with a launcher, which carries its own runner',
);
}
if (launcher != null && globalEnvironment != null) {
throw ArgumentError.value(
globalEnvironment,
'globalEnvironment',
'cannot be given with a launcher, which carries its own runner',
);
}
if (inactivityTimeout <= Duration.zero) {
throw ArgumentError.value(
inactivityTimeout,
'inactivityTimeout',
'must be positive',
);
}
if (bufferBytes <= 0) {
throw ArgumentError.value(bufferBytes, 'bufferBytes', 'must be positive');
}
}