@ocap/indexdb

Defines the basic interface for OCAP IndexDB

Usage no npm install needed!

<script type="module">
  import ocapIndexdb from 'https://cdn.skypack.dev/@ocap/indexdb';
</script>

README

OCAP IndexDB

Defines the abstract interface of OCAP IndexDB, must be implemented with an actual statedb, please checkout following packages:

  • @ocap/indexdb-memory
  • @ocap/indexdb-fs
  • @ocap/indexdb-elasticsearch

Usage

yarn add @ocap/statedb-memory

Then:

const MemoryIndexDB = require('@ocap/indexdb-memory');

const indexdb = new MemoryIndexDB();

indexdb.account.create(address, attrs, context);
indexdb.account.get(address);
indexdb.account.update(address, updates, context);

indexdb.asset.create(address, attrs, context);
indexdb.asset.get(address);
indexdb.asset.update(address, updates, context);

indexdb.tx.create(hash, attrs, context);
indexdb.tx.get(hash);
indexdb.tx.find(conditions);