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

Add offline mode #726

Merged
merged 1 commit into from
Nov 14, 2019
Merged

Add offline mode #726

merged 1 commit into from
Nov 14, 2019

Conversation

haadcode
Copy link
Member

This PR adds an options flag to start an OrbitDB instance in offline mode.

Inside OrbitDB, if options.offline: true is set, Pubsub won't be started, thus no exchange of updates will happen.

This is a useful feature for example when starting IPFS nodes offline (with new IPFS({start: false})). For example, we should optimize some of the tests to use offline IPFS and OrbitDB nodes for faster startup times and to decrease overall testing time.

The flag is documented as:

  • offline (boolean): Start the OrbitDB instance in offline mode. Databases are not be replicated when the instance is started in offline mode. If the OrbitDB instance was started offline mode and you want to start replicating databases, the OrbitDB instance needs to be re-created. Default: false.

And would be used like:

const orbitdb = await OrbitDB.createInstance(ipfs, {offline: true})
...

Note, as per the API doc, if the OrbitDB instance was started offline mode and you want to start replicating databases, the OrbitDB instance needs to be re-created. There's currently no support for "going online" if the node has been started in offline mode, but this is something we can add in the future.

@shamb0t shamb0t merged commit cb7b080 into develop Nov 14, 2019
@haadcode haadcode deleted the feat/offline-mode branch November 14, 2019 15:50
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

Successfully merging this pull request may close these issues.

2 participants