Skip to content

Commit

Permalink
docs: added description and diagram to VaultInternal.request()
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
tegefaulkes committed May 15, 2024
1 parent 16c840d commit 6d3b493
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/git/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ async function* advertiseRefGenerator({
// "0000"
yield gitUtils.FLUSH_PACKET_BUFFER;
// Ref_list
yield* referenceList(objectGenerator, capabilityList);
yield* referenceListGenerator(objectGenerator, capabilityList);
// "0000"
yield gitUtils.FLUSH_PACKET_BUFFER;
}
Expand All @@ -161,7 +161,7 @@ async function* advertiseRefGenerator({
* cap-list = capability *(SP capability)
* ```
*/
async function* referenceList(
async function* referenceListGenerator(
objectGenerator: AsyncGenerator<[Reference, ObjectId], void, void>,
capabilities: CapabilityList,
): AsyncGenerator<Buffer, void, void> {
Expand Down
37 changes: 37 additions & 0 deletions src/vaults/VaultInternal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,43 @@ class VaultInternal {
return commitIdLatest;
}

/**
* Creates a request arrow function that implements an api that `isomorphic-git` expects to use when making a http
* request. It makes RPC calls to `vaultsGitInfoGet` for the ref advertisement phase and `vaultsGitPackGet` for the
* git pack phase.
*
* `vaultsGitInfoGet` wraps a call to `gitHttp.advertiseRefGenerator` and `vaultsGitPackGet` to
* `gitHttp.generatePackRequest`.
*
* ```
* ┌─────────┐ ┌───────────────────────────┐
* │ │ │ │
* ┌──────────────────────┐ │ RPC │ │ │
* │ │ │ │ │ *advertiseRefGenerator() │
* │ ├────────┼─────────┼────► │
* │ vault.request() │ │ │ │ │
* │ │ │ │ └────┬──────────────────────┘
* │ ├──┐ │ │ │
* │ │ │ │ │ ┌────▼──────────────────────┐
* └──────────────────────┘ │ │ │ │ │
* │ │ │ │ *referenceListGenerator() │
* │ │ │ │ │
* │ │ │ └───────────────────────────┘
* │ │ │
* │ │ │ ┌───────────────────────────┐
* └─────┼─────────┼────┤ │
* │ │ │ *generatePackRequest() │
* │ │ │ │
* │ │ └────┬──────────────────────┘
* └─────────┘ │
* ┌────▼──────────────────────┐
* │ │
* │ *generatePackData() │
* │ │
* └───────────────────────────┘
*
* ```
*/
protected async request(
client: RPCClient<typeof agentClientManifest>,
vaultNameOrId: VaultId | VaultName,
Expand Down

0 comments on commit 6d3b493

Please sign in to comment.