godless

package module
v0.19.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2017 License: MIT Imports: 14 Imported by: 0

README

Godless

A toy peer-to-peer database for the future internet.

What does that mean?

Godless is a way of sharing structured data between computers without using servers or the cloud.

Check the wiki for a tutorial.

Try it!

Run IPFS:

$ ipfs daemon

Run server:

$ godless init
$ godless store server --early

The --early flag indicates that the server should fail if it can find no running IPFS daemon.

Now send queries to the server using godless query console:

> join books rows (@key=book50, authorName="EL James", publisher="Don't wanna know")

QmPbufdDocGLc1jxmyLwMXdNpnj4Gsgs5Ve5ky4at5DFYx
Waited 278.572562ms for response from server.

> select books where str_eq(@key, "book50")

--------------------------------------------------
| Table | Row    | Entry      | Point            |
--------------------------------------------------
| books | book50 | authorName | EL James         |
| books | book50 | publisher  | Don't wanna know |
--------------------------------------------------
Found 2 Namespace Entries.
Waited 29.798089ms for response from server.

How does it work?

Data is stored in a CRDT namespace suitable for sharing between peers. This is indexed using an another datastructure which itself is a CRDT. Indexes and namespaces are arranged into a canonical order and saved to the Interplanetary File System.

The datastructures can be reassembled at another peer by looking up the IPFS hash. Index hashes are shared over PubSub.

Crucially, data is signed using strong cryptography. You can specify a key in your queries to sign (in joins) or verify (in selects). This is crucial to maintaining data consistency in the face of arbitrary joins by other net users :).

Installing

Godless is currently in alpha stage for Linux only.

For everyone

Check out the releases page.

Download signatures from teoma.org.uk.

For Golang programmers
go get -u github.com/johnny-morrice/godless/godless

Documentation

Overview

Godless is a peer-to-peer database running over IPFS.

Godless uses a Consistent Replicated Data Type called a Namespace to share schemaless data with peers.

Godless is in alpha, and should be considered experimental software.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeKeyStore

func MakeKeyStore() api.KeyStore

Types

type Godless

type Godless struct {
	Options
	// contains filtered or unexported fields
}

Godless is a peer-to-peer database. It shares structured data between peers, using IPFS as a backing store. The core datastructure is a CRDT namespace which resembles a relational scheme in that it has tables, rows, and entries.

func New

func New(options Options) (*Godless, error)

New creates a godless instance, connecting to any services, and providing any services, specified in the options.

func (*Godless) Errors

func (godless *Godless) Errors() <-chan error

Errors provides a stream of errors from godless. Godless will attempt to handle any errors it can. Any errors received here indicate that bad things have happened.

func (*Godless) Send

func (godless *Godless) Send(request api.Request) (api.Response, error)

func (*Godless) Shutdown

func (godless *Godless) Shutdown()

Shutdown stops all godless processes. It waits for all processes to stop.

type Options

type Options struct {
	// IpfsServiceUrl is required, unless specifying your own DataPeer or RemoteStore.
	IpfsServiceUrl string
	// DataPeer is optional.  If specified, none of the IPFS options will be used.
	DataPeer api.DataPeer
	// RemoteStore is optional.  If specified, the DataPeer will not be used, nor any of the IPFS options.
	RemoteStore api.RemoteStore
	// KeyStore is required. A private Key store.
	KeyStore api.KeyStore
	// MemoryImage is required.
	MemoryImage api.MemoryImage
	// WebServiceAddr is optional.  If not set, the webservice will be disabled.
	WebServiceAddr string
	// IndexHash is optional.  Set to load an existing index from IPFS.
	IndexHash string
	// FailEarly will cause the godless process to crash if it cannot contact IPFS on startup.
	FailEarly bool
	// ReplicateInterval is optional.  The duration between peer-to-peer replications.
	ReplicateInterval time.Duration
	// Pulse is optional.  The duration between flushes of the index to IPFS.
	Pulse time.Duration
	// Topics is optional.  Two godless servers which share a topic will replicate indices. An empty topics slice will disable replication.
	Topics []string
	// IpfsClient is optional.  Specify a HTTP client for IPFS.
	IpfsClient *gohttp.Client
	// IpfsPingTimeout is optional.  Specify a lower timeout for "Am I Connected?" checks.
	IpfsPingTimeout time.Duration
	// Functions is optional.
	Functions function.FunctionNamespace
	// Cache is optional. Build a 12-factor app by supplying your own remote cache.
	// HeadCache, IndexCache and NamespaceCache can be used to specify different caches for different data types.
	Cache api.Cache
	// PriorityQueue is optional. Build a 12-factor app by supplying your own remote cache.
	PriorityQueue api.RequestPriorityQueue
	// ApiConcurrency is optional.  Tune performance by setting the number of simultaneous queries.
	ApiConcurrency int
	// PublicServer is optional.  If false, the index will only be updated from peers who are in your public key list.
	PublicServer bool
	// WebService is optional.
	WebService api.WebService
	// contains filtered or unexported fields
}

Godless options.

Directories

Path Synopsis
This is a test-only package.
This is a test-only package.
cmd
internal
Package proto is a generated protocol buffer package.
Package proto is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL