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

how to sync bee #46

Open
shikhars371 opened this issue Apr 24, 2021 · 1 comment
Open

how to sync bee #46

shikhars371 opened this issue Apr 24, 2021 · 1 comment

Comments

@shikhars371
Copy link

hi here is my backend.js

const { Client } = require('hyperspace')
const HyperBee = require('hyperbee')
const { kvPairs : dictionaryPairs } = require('websters-english-dictionary')

start()

async function start() {
const { corestore, replicate } = new Client()
const store = corestore()

const core = store.get({ name: 'dictionary' })

const db = new HyperBee(core, { keyEncoding: 'utf-8', valueEncoding: 'utf-8' })

const batch = db.batch()
for (const { key, value } of dictionaryPairs()) {
await batch.put(key, value)
}

await batch.flush()

//print bee key
console.log(' bee ', db.feed.key.toString('hex'))

// Now announce on hyp
await replicate(core)
}

when i am running this code its giving me a console a key on console :

ba118da4eb768dde70d6c1e016ff5b26f3e97ef91ff097c9f21d7c4f8c4699e1
I am seeding the above key as : hyp seed ba118da4eb768dde70d6c1e016ff5b26f3e97ef91ff097c9f21d7c4f8c4699e1

now on second server i am doing :: hyp sync ba118da4eb768dde70d6c1e016ff5b26f3e97ef91ff097c9f21d7c4f8c4699e1 ------ above line giving me error:
root@tower6:~# hyp sync ba118da4eb768dde70d6c1e016ff5b26f3e97ef91ff097c9f21d7c4f8c4699e1
Error: The hyper:// was expected to be a hyperdrive, got hyperbee

please help me how to seed and sync bee

@Octalbyte
Copy link
Contributor

Hi @shikhars371 ! There is an issue on the CLI command of the second server.
The command hyp sync [key] is an alias for hyp drive sync [key]. sync does not work for bees.
The commands available for hyperbee are:
image
The error has none to do with the backend.js code.
I hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants