ProcessGitUploadPackService class final Server

GitUploadPackService of the process backend: every operation launches git upload-pack --stateless-rpc on the git directory the backend's own resolution gives for the served identifier.

The service is built with four things: the backend's resolution, the launcher of its streaming processes, the inactivity delay and the buffer size.

  • The resolution is a FutureOr<GitFileBareRepository?> Function(GitServedRepositoryId), possibly asynchronous — the host may consult a catalog before the repository is opened. Returning null means the identifier is unknown, which surfaces as GitUnknownServedRepositoryException; the smart HTTP processing answers 404 for it.
  • The launcher starts the real git executable with the hardened command line and environment of the backend; hand a ProcessGitProcessLauncher built on the runner the rest of the application uses.
  • The inactivity delay releases an exchange no byte moves in — a response never listened to included — by killing the process.
  • The buffer size bounds the memory held for one exchange, independent of the size of the bodies: chunks written to git are split to it, and the standard error git produces is kept within it, never sent to the client.

The protocol parameters cross to git through the GIT_PROTOCOL variable and nothing else: every entry is validated before the launch, and no other variable and no command-line option ever comes from the request.

Implemented types

Constructors

ProcessGitUploadPackService({required FutureOr<GitFileBareRepository?> resolveRepository(GitServedRepositoryId), 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.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

advertiseRefs(GitServedRepositoryId repository, {required GitProtocolParameters protocol}) → Future<GitServiceResponse>
Produces the first response of the protocol by launching git upload-pack --stateless-rpc --advertise-refs on the resolved git directory.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
uploadPack(GitServedRepositoryId repository, Stream<List<int>> request, {required GitProtocolParameters protocol}) → Future<GitServiceResponse>
Answers one stateless RPC of repository by launching git upload-pack --stateless-rpc on the resolved git directory and writing request into its standard input.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited