How to use the datastore-core.TieredDatastore function in datastore-core

To help you get started, we’ve selected a few datastore-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ipfs / js-ipfs / src / core / ipns / routing / config.js View on Github external
const peerId = ipfs._peerInfo.id

    pubsubDs = new PubsubDatastore(pubsub, localDatastore, peerId)
    ipnsStores.push(pubsubDs)
  }

  // DHT should not be added as routing if we are offline or it is disabled
  if (get(ipfs._options, 'offline') || !get(ipfs._options, 'libp2p.config.dht.enabled', false)) {
    const offlineDatastore = new OfflineDatastore(ipfs._repo)
    ipnsStores.push(offlineDatastore)
  } else {
    ipnsStores.push(ipfs.libp2p.dht)
  }

  // Create ipns routing with a set of datastores
  return new TieredDatastore(ipnsStores)
}