All Projects β†’ ipfs-shipyard β†’ tevere

ipfs-shipyard / tevere

Licence: other
🏞 Decentralized DB over IPFS

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to tevere

ipfs-add-from-url
A command line executable to add a file to IPFS from a URL instead of a file path
Stars: ✭ 24 (-57.89%)
Mutual labels:  ipfs
kotal
Blockchain Kubernetes Operator
Stars: ✭ 137 (+140.35%)
Mutual labels:  ipfs
ipfs-haskell
IPFS wrapper for Haskell
Stars: ✭ 37 (-35.09%)
Mutual labels:  ipfs
nebula-crawler
🌌 A libp2p DHT crawler, monitor, and measurement tool that exposes timely information about DHT networks.
Stars: ✭ 97 (+70.18%)
Mutual labels:  ipfs
ehr-blockchain
Electronic Health Record (EHR) and Electronic Medical Record (EMR) systems. However, they still face some issues regarding the security of medical records, user ownership of data, data integrity etc. The solution to these issues could be the use of a novel technology, i.e., Blockchain. This technology offers to provide a secure, temper-proof pl…
Stars: ✭ 41 (-28.07%)
Mutual labels:  ipfs
origin-website
The code powering our website
Stars: ✭ 36 (-36.84%)
Mutual labels:  ipfs
pollinations
Generate Art
Stars: ✭ 100 (+75.44%)
Mutual labels:  ipfs
typescript-eth-starter
πŸ”Œ Ethereum Dapp Basic Typescript Starter
Stars: ✭ 125 (+119.3%)
Mutual labels:  ipfs
dbclient
λ°μ΄ν„°λ°°μ΄μŠ€ 관리 / μžλ™ 메일링 / Admin μžλ™ν™” / Database IDE Tool. SQL Development Helper. Support DBMS Oracle/Mysql/MS-SQL
Stars: ✭ 35 (-38.6%)
Mutual labels:  db
denarius
Denarius [$D] is a PoW/PoS Hybrid Cryptocurrency with Tribus a new PoW Hashing Algo built specifically for D, one of a kind hybrid masternodes called Fortuna Stakes, atomic swaps, staking, mining, IPFS, optional Native Tor and I2P, and much more!
Stars: ✭ 105 (+84.21%)
Mutual labels:  ipfs
thegraph-react
βš›οΈ React bindings for helping build decentralized applications quickly on Ethereum and IPFS using GraphQL.
Stars: ✭ 31 (-45.61%)
Mutual labels:  ipfs
ipfs-dag-builder-vis
See how the DAGs get built
Stars: ✭ 19 (-66.67%)
Mutual labels:  ipfs
ipfs-chat
Real-time P2P messenger using go-ipfs pubsub. TUI. End-to-end encrypted texting & file-sharing. NAT traversal.
Stars: ✭ 84 (+47.37%)
Mutual labels:  ipfs
go-stellar-ipfs
πŸŒ€ A library that is a bridge between Stellar and IPFS.
Stars: ✭ 25 (-56.14%)
Mutual labels:  ipfs
subleveldown
Split a levelup database into sublevels with their own keyspace, encoding and events.
Stars: ✭ 117 (+105.26%)
Mutual labels:  level
superhighway84
USENET-inspired, uncensorable, decentralized internet discussion system running on IPFS & OrbitDB
Stars: ✭ 437 (+666.67%)
Mutual labels:  ipfs
ipfs-blog
IPFS Blog & News
Stars: ✭ 31 (-45.61%)
Mutual labels:  ipfs
rsync2ipfs-cluster
No description or website provided.
Stars: ✭ 16 (-71.93%)
Mutual labels:  ipfs
deplayer
Decentralized mediaplayer which runs entirely in the browser.
Stars: ✭ 14 (-75.44%)
Mutual labels:  ipfs
ElegantData
εƒζ“δ½œRoomδΈ€ζ ·ζ“δ½œ SharedPreferences ε’Œ File ζ–‡δ»Ά.
Stars: ✭ 18 (-68.42%)
Mutual labels:  db

Tevere

Build Status

Decentralized eventually-consistent key-value store over IPFS for the browser. Exposes a Leveldown-compatible API.

Install

$ npm install tevere --save

Use

Here we're using Memdown as a log database, but you can use any database that conforms to the Leveldown interface (Level-js on the browser or Leveldown on Node.js):

const Tevere = require('tevere')
const Memdown = require('memdown')

const db = Tevere('partition name', {
  log: Memdown('partition name')
})

db.put('key', { val: 'ue' }, (err) => {
  if (err) {
    throw err
  }
  console.log('PUT succeeded')
})

Custom merge function

By default, when a conflict exists (two nodes have concucrently performed a change on the same key), Tevere will determinstically choose one of the values for you. Instead, you can provide a synchronous merge function like this:

const db = Tevere('partition name', {
  log: Memdown('partition name'),
  merge: merge
})

// custom merge function that merges two records
function merge (v1, v2) {
  return {
    a: v1.a,
    b: v2.b,
    c: v1.c.concat(v2.c),
    d: Math.max(v1.d, v2.d)
  }
}

Custom merge and determinism

If you define a custom merge function, the result must be deterministic. For every node involved in the same conflict, Tevere guarantees that the order of the values passed into the merge function is the same. In return, you must guarantee that, given the same two values, you always return the same merged value.

This means that you cannot generate data that is not deterministic, like random values or even time stamps.

Invalid merge function:

function merge (v1, v2) {
  return {
    timestamp: Date.now()
  }
}

This is valid, though:

function merge (v1, v2) {
  return {
    timestamp: Math.max(v1.timestamp, v2.timestamp)
  }
}

Tevere's compromise: Given a specific conflict, the order of the two values passed into the merge function is always the same. This means that, if two nodes have conflicting changes, both nodes custom merge functions will be called with the exact same arguments in the exact same order.

Your compromise: Determinism, purely funcional merge function: given a sets of two conflicting values, you always return the same merged value, no matter at which node and at which time the merging occurs.

Tevere API

Tevere (partition, options)

Creates a Tevere instance.

  • partition (string, mandatory): identifies the partition this node will participate in.
  • options (object, mandatory): some options:
    • ipfsOptions (object, optional). IPFS options object.
    • log (LevelDown-compatible database): this is where the node keeps the log entries (which only have a vector clock and a hash β€” all the actual data is kept in IPFS).
    • ipfs (IPFS object, optional): an IPFS object instance. If you already can provide an IPFS object, pass it in here.
    • merge (function, optional): a synchronous function that will receive two values and return a new value.

A Tevere instance respects the Leveldown API. Here are the main methods:

Example:

const Leveljs = require('level-js')

const db = Tevere('partition name', {
  log: Leveljs('partition name')
})

db.put (key, value, callback)

Save a value to key.

db.get (key, callback)

Get the value stored in key.

db.iterator (options)

Returns an iterator over the database. Supports the same options described in the Leveldown API.

Events

A Tevere instance emits these event types:

"change" (change)

Every time there is a change (either local or remote), a Tevere instance emits a change event, which is an object that has these properties:

  • type (string, either "del" or "put")
  • key (string)
  • value (any, relevant for put type operations)

Examples

Check the tests dir for some examples.

Internals

Internal workings are documented here.

License

MIT

Why the name "Tevere"?

Tevere is the italian name for the river that goes through Rome. At the time the repo for this project was created, I was hanging out in Rome with some of the IPFS crew, so I guess it made sense at the time...

Contribute

Feel free to join in. All welcome. Open an issue!

This repository falls under the IPFS Code of Conduct.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].