Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: manual check for content on our Frisbii #94

Merged
merged 4 commits into from
Sep 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions manual-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@
//

import Spark, { getRetrievalUrl } from './lib/spark.js'
import { getMinerPeerId as defaultGetMinerPeerId } from './lib/miner-info.js'

// The task to check, replace with your own values
const cid = 'bafybeiepi56qxfcwqgpstg25r6sonig7y3pzd37lwambzmlcmbnujjri4a'
const minerId = 'f010479'
const task = {
cid: 'bafkreih25dih6ug3xtj73vswccw423b56ilrwmnos4cbwhrceudopdp5sq',
minerId: 'f0frisbii'
}

const getMinerPeerId = (minerId) =>
juliangruber marked this conversation as resolved.
Show resolved Hide resolved
minerId === 'f0frisbii'
? '12D3KooWC8gXxg9LoJ9h3hy3jzBkEAxamyHEQJKtRmAuBuvoMzpr'
: defaultGetMinerPeerId(minerId)

// Run the check
const spark = new Spark()
const stats = { cid, minerId, indexerResult: null, statusCode: null, byteLength: 0 }
await spark.executeRetrievalCheck({ cid, minerId }, stats)
const spark = new Spark({ getMinerPeerId })
const stats = { ...task, indexerResult: null, statusCode: null, byteLength: 0 }
await spark.executeRetrievalCheck(task, stats)
console.log('Measurement: %o', stats)

if (stats.providerAddress && stats.statusCode !== 200) {
Expand All @@ -23,13 +31,13 @@ if (stats.providerAddress && stats.statusCode !== 200) {
console.log(
' lassie fetch -o /dev/null -vv --dag-scope block --protocols graphsync --providers %s %s',
JSON.stringify(stats.providerAddress),
cid
task.cid
)
console.log('\nHow to install Lassie: https://github.com/filecoin-project/lassie?tab=readme-ov-file#installation')
break
case 'http':
try {
const url = getRetrievalUrl(stats.protocol, stats.providerAddress, cid)
const url = getRetrievalUrl(stats.protocol, stats.providerAddress, task.cid)
console.log('You can get more details by requesting the following URL yourself:\n')
console.log(' %s', url)
console.log('\nE.g. using `curl`:')
Expand All @@ -38,7 +46,7 @@ if (stats.providerAddress && stats.statusCode !== 200) {
console.log(
' lassie fetch -o /dev/null -vv --dag-scope block --protocols http --providers %s %s',
JSON.stringify(stats.providerAddress),
cid
task.cid
)
console.log('\nHow to install Lassie: https://github.com/filecoin-project/lassie?tab=readme-ov-file#installation')
} catch (err) {
Expand Down