Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
fix(ipfs-core): fix repo gc typing
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahhoward committed Apr 8, 2021
1 parent db4d9d1 commit 1a96c39
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/ipfs-core/src/components/repo/gc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const BLOCK_RM_CONCURRENCY = 256
* @typedef {import('ipfs-core-types/src/refs').API} RefsAPI
* @typedef {import('ipfs-repo')} IPFSRepo
* @typedef {import('interface-datastore').Key} Key
* @typedef {import('ipfs-repo/src/types').Block} Block
*/

/**
Expand Down Expand Up @@ -101,7 +102,7 @@ async function createMarkedSet ({ pin, refs, repo }) {
* @param {object} arg
* @param {IPFSRepo} arg.repo
* @param {Set<string>} markedSet
* @param {AsyncIterable<CID>} blockKeys
* @param {AsyncIterable<CID|Block>} blockKeys
*/
async function * deleteUnmarkedBlocks ({ repo }, markedSet, blockKeys) {
// Iterate through all blocks and find those that are not in the marked set
Expand All @@ -110,12 +111,16 @@ async function * deleteUnmarkedBlocks ({ repo }, markedSet, blockKeys) {
let removedBlocksCount = 0

/**
* @param {CID} cid
* @param {Block|CID} cid
*/
const removeBlock = async (cid) => {
blocksCount++

try {
if (!CID.isCID(cid)) {
return null
}

const b32 = multibase.encode('base32', cid.multihash).toString()

if (markedSet.has(b32)) {
Expand Down

0 comments on commit 1a96c39

Please sign in to comment.