Code Monkey home page Code Monkey logo

ipfs-ds-convert's Introduction

ipfs-ds-convert

Coverage Status Travis CI

Datastore converter for go-ipfs

This tool is WIP and may damage your data. Make sure to make a backup first.

TODO:

  • Finish basic conversion code
  • package.json for gx
  • Tests
  • Review
  • Standard readme
  • Revert on error / from backup
  • Cleanup backup subcommand
  • Optimize some standard cases
    • Don't copy directories when not needed
    • Detect renames
      • Not that common
  • Report progress
  • Don't depend on go-ipfs

Install

Build From Source

These instructions assume that go has been installed as described here.

$ GO111MODULE=on go get github.com/ipfs/ipfs-ds-convert@latest

Usage

Convert to Badger Datastore

Apply the Badger Datastore profile:

ipfs config profile apply badgerds

Then, start the conversion using

$ ipfs-ds-convert convert

This can take a very long time to complete depending on the size of the datastore. If running this on a headless server it's recommended to use something like screen or tmux to run this command in a persistent shell.

Contribute

PRs are welcome!

Small note: If editing the Readme, please conform to the standard-readme specification.

License

MIT © Łukasz Magiera

ipfs-ds-convert's People

Contributors

aschmahmann avatar galargh avatar gammazero avatar hsanjuan avatar ipfs-mgmt-read-write[bot] avatar leerspace avatar magik6k avatar marten-seemann avatar schomatis avatar stebalien avatar web-flow avatar web3-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ipfs-ds-convert's Issues

Avoid (re)converting to the same datastore type

If I run the conversion to Badger Datastore twice the second time (from badgerds to badgerds) happens even though there is no need for any conversion. If I'm following the code correctly that case corresponds to this strategy case, the directories that should be checked (as mentioned in the TODO) are the path components of the spec file?

Proposal: running the conversion tool out-of-the-box without manual configuration

I'm trying to understand (with very little knowledge of the datastore specification) why is it necessary to manually update the repository configuration file in order to convert it to the Badger datastore, I would expect to be able to manage the entire operation from the command line, e.g.,

ipfs init
ipfs add . -r
ipfs-ds-convert convert <badger options>

@magik6k Could you provide me some context to better understand this? And maybe a few pointers that would help me submit a PR to add some command line options that would allow running the conversion tool without adjusting the configuration file (if that is feasible).

add support for ipfs 0.6

Currently, the latest version of ipfs-ds-convert isn't compatible with ipfs 0.6.0:

unsupported fsrepo version: 10

@Stebalien I think the release todo should cover a bump for the ds-convert compatibility as well. :)

unsupported fsrepo version: 12

I'm running the 13rc1 of ipfs and I got this message as I tried to convert the datastore from flatfs to badgerds:

./ipfs-ds-convert convert
convert 2022/05/16 13:24:18 unsupported fsrepo version: 12

Add a repo description

We’re trying to make sure every repo has a description (see ipfs-inactive/docs#55) and this repo is missing one. I don’t have permissions to add it, but I’d suggest something like:

Command-line tool for convert a datastore (e.g. from FlatFS to Badger)

Excessive disk consumption during conversion

I'm attempting to convert a couple of my nodes from leveldb over to badger. And in each case I've run out of disk space before the conversion is complete.

While I'd expect the conversion to roughly double the size of the .ipfs directory during conversion, I'm seeing the conversion directory get up to several times bigger than the original datastore before the conversion even completes.

On one node I have roughly 400GB in IPFS and the conversion process filled up the filesystem overnight by consuming almost 2TB. On the other I have roughly 9GB, but I killed that conversion after the conversion directory got up to around 40GB; this node is a laptop with an SSD that isn't very large.

add support for ipfs 0.5.0-rc2

Currently, the latest version of ipfs-ds-convert isn't compatible with ipfs 0.5.0-rc2:

convert 2020/04/18 08:15:35 unsupported fsrepo version: 9

Provide precompiled binaries for popular platforms

Right now the only way to install ipfs-ds-convert is via go get. Since go already has a great support for multiple platforms, it would be great and easy for users to directly wget/curl the pre-compiled binaries instead of first having to install go first and then perform go get... for this.

failing TestVerifyKeysFail test

 === RUN   TestVerifyKeysFail
generating 2048-bit RSA keypair...done
peer identity: QmPUW1TptSZyFUcEmH4FEQk1jjvGzhfd8X92ybj5HuyJFu
convert 2021/05/17 17:02:55 Checks OK
convert 2021/05/17 17:02:55 Copying keys, this can take a long time

copied 101 keys
convert 2021/05/17 17:02:55 All data copied, swapping repo
convert 2021/05/17 17:02:55 Verifying key integrity
    copy_test.go:147: key /blocks/NOTARANDOMKEY was not present in new datastore
--- FAIL: TestVerifyKeysFail (0.46s)

some review

I read through the code and took some initial review notes. Since there is a lot of code here, i did not go through it as in depth as I would like.

  • convert/convert.go line 89, switch should have default case that errors
  • saveNewSpec, 'if backup' should probably all get extracted into its own function to make reading things a bit cleaner.
  • In general, I'm starting to lean towards oneline single error checks, i.e. if err := foo(); err != nil {. It looks a bit cleaner, would love your thoughts on the pattern
  • convert/copy.go:248, TODO still relevant?
  • config/validate: Should we actually require that paths be strictly within the ipfs repo? I think this is fine to require for now, but likely want to reconsider moving forward

In general, It looks good. Great job @magik6k :) I will give it a try on my own ipfs repo soon.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.