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

ChainIndexer: move lotus-shed chainindex into lotus CLI #12654

Closed
rvagg opened this issue Oct 28, 2024 · 2 comments · Fixed by #12668 or #12684
Closed

ChainIndexer: move lotus-shed chainindex into lotus CLI #12654

rvagg opened this issue Oct 28, 2024 · 2 comments · Fixed by #12668 or #12684
Assignees
Labels
good first issue Good for newcomers

Comments

@rvagg
Copy link
Member

rvagg commented Oct 28, 2024

The new chain_index.go functionality in lotus-shed is more like a lotus command now than the previous sqlite db management utilities. It interacts via RPC and doesn't do any shonky multi-writer work anymore and our documentation treats it as a normal part of a workflow, so we should just normalise it.

Let's move it into the lotus CLI. I think it could either go in under the existing chain subcommand as an index sub-sub command, or it we could just add a new top-level index subcommand in the same DEVELOPER group as chain.

@rvagg rvagg added the good first issue Good for newcomers label Oct 28, 2024
@github-project-automation github-project-automation bot moved this to 📌 Triage in FilOz Oct 28, 2024
@rvagg
Copy link
Member Author

rvagg commented Nov 1, 2024

Some thoughts on how to attack this:

  • Start by looking at how the lotus CLI is instantiated - cmd/lotus/main.go - it pulls in its subcommands from cli/clicommands/cmd.go, which is where the initial groupings get set that you see in lotus help.
  • I think we should just add a new subcommand, so it shows up in that DEVELOPER list as index Manage the chain indexer
  • cmd/lotus-shed/chain_index.go has the existing command that we want to move, it's currently named chainindex but I think we should just be index for the new one. It has one sub-sub-command, validate-backfill, which is what we're moving. That file needs to move into the cli/ package, I think we should just call it index.go. Have a look at chain.go as a template for how it should be organised, and follow where ChainCmd is used, we want to add an IndexCmd.
  • Again, look through chain.go for any patterns that we should be following once out of lotus-shed, hopefully they're roughly the same. We're connecting to the node via RPC but we need to figure out where to connect to, that's mostly all handled for us via GetFullNodeAPI and friends. Basically we want to make this command fit in to lotus, and hopefully it's pretty close as it is and this will mostly be about just moving the file and its wiring.

@rjan90 rjan90 moved this from 📌 Triage to 🔎 Awaiting review in FilOz Nov 5, 2024
@github-project-automation github-project-automation bot moved this from 🔎 Awaiting review to 🎉 Done in FilOz Nov 7, 2024
@rvagg
Copy link
Member Author

rvagg commented Nov 7, 2024

Reopening this because I just realised we have other documentation that refers to the old usage that needs to be updated.

git grep 'lotus-shed chainindex'

Even the new file, cli/index.go, refers to the old one.

These should all be lotus index instead, and if there are any references to building lotus-shed we should remove those too.

@rvagg rvagg reopened this Nov 7, 2024
@github-project-automation github-project-automation bot moved this from 🎉 Done to 📌 Triage in FilOz Nov 7, 2024
@rjan90 rjan90 moved this from 📌 Triage to 🐱 Todo in FilOz Nov 7, 2024
@github-project-automation github-project-automation bot moved this from 🐱 Todo to 🎉 Done in FilOz Nov 7, 2024
@rjan90 rjan90 moved this from 🎉 Done to ☑️ Done (Archive) in FilOz Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Status: ☑️ Done (Archive)
2 participants