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

More detailed usage #59

Closed
yuhr opened this issue Feb 9, 2021 · 4 comments
Closed

More detailed usage #59

yuhr opened this issue Feb 9, 2021 · 4 comments
Labels
kind/support A question or request for support

Comments

@yuhr
Copy link

yuhr commented Feb 9, 2021

The section "Usage" in the readme is not fully illustrating how to use this module with ipfs-core. Could you provide more information? How can I pass this module to "IPFS.create" API?

I'm struggling to make IPFS work entirely in memory. My current setup is following (constructed according to https://github.com/ipfs/js-ipfs/blob/master/examples/custom-ipfs-repo/index.js), but it emits OpenError: IO error: .ipfs/kptQGJNdBNgFcQxtixKUw/pins/LOCK: No such file or directory.

import IPFS from "ipfs-core"
import { nanoid } from "nanoid"
import Repo from "ipfs-repo"
import DatastoreLevel from "datastore-level"
import LevelMem from "level-mem"
import LockMemory from "ipfs-repo/src/lock-memory"

const ipfs = await IPFS.create({
  repo: new Repo(`.ipfs/${nanoid()}`, {
    storageBackends: {
      root: DatastoreLevel,
      blocks: DatastoreLevel,
      keys: DatastoreLevel,
      datastore: DatastoreLevel
    },
    storageBackendOptions: {
      root: { db: LevelMem },
      blocks: { db: LevelMem },
      keys: { db: LevelMem },
      datastore: { db: LevelMem }
    },
    lock: LockMemory
  }),
  start: false,
  silent: true,
  init: {
    algorithm: "Ed25519"
  }
})
@yuhr yuhr added the need/triage Needs initial labeling and prioritization label Feb 9, 2021
@welcome
Copy link

welcome bot commented Feb 9, 2021

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment.
Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

Finally, remember to use https://discuss.ipfs.io if you just need general support.

@aschmahmann aschmahmann added kind/support A question or request for support and removed need/triage Needs initial labeling and prioritization labels Feb 22, 2021
@aschmahmann
Copy link

aschmahmann commented Feb 22, 2021

This looks like a general support request. Try asking on https://discuss.ipfs.io as it'll be more visible to the community (nobody looks at closed GitHub issues).

@achingbrain
Copy link
Member

achingbrain commented Feb 22, 2021

@yuhr if you want to run everything in memory, use MemoryDataStore from interface-datastore instead of datastore-level - https://github.com/ipfs/interface-datastore

const MemoryStore = require('interface-datastore').MemoryDatastore
const ipfs = await IPFS.create({
  repo: new Repo(`.ipfs/${nanoid()}`, {
    storageBackends: {
      root: MemoryStore,
      // etc

@yuhr
Copy link
Author

yuhr commented Mar 3, 2021

@aschmahmann Okay sorry, but I think this is rather an issue that the docs is lacking adequate information, though this could apply not only to this repo. I believe in-memory use case is pretty common for development environment, but the answer @achingbrain provided is not reachable from the readme of https://github.com/ipfs/js-ipfs.

Though, let's move to https://discuss.ipfs.io, if you say nobody looks here. Thanks @achingbrain, but the general-support-request-like part of my question is still not resolved. Written here: https://discuss.ipfs.io/t/datastore-setup/10385

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support A question or request for support
Projects
None yet
Development

No branches or pull requests

3 participants