antsdb

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: MIT Imports: 10 Imported by: 0

README

ants-db

Distributed KV store using go-ds-crdt and libp2p

AntsDB provides a simple KV interface over go-ds-crdt. The code is highly inspired by the example in ipfs-cluster/consesus

Its especially useful if you are already using the IPFS ecosystem. With minimal code layer we can create this KV Store which can be used by apps.

Install

ants-db works like a regular Go module:

> go get github.com/StreamSpace/ants-db

Usage

import "github.com/StreamSpace/ants-db"

Check tests for examples

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AntsDB

type AntsDB struct {
	store.Store
	// contains filtered or unexported fields
}

func New

func New(
	syncer crdt.SessionDAGSyncer,
	pubsub *pubsub.PubSub,
	store ds.Batching,
	opts ...Option,
) (*AntsDB, error)

func (*AntsDB) Close

func (a *AntsDB) Close() error

type Option

type Option func(a *AntsDB)

func WithChannel

func WithChannel(topic string) Option

func WithNamespace

func WithNamespace(ns string) Option

func WithOnCloseHook

func WithOnCloseHook(hook func()) Option

func WithPeerValidator

func WithPeerValidator(validator func(context.Context, peer.ID) bool) Option

func WithRebroadcastDuration

func WithRebroadcastDuration(d time.Duration) Option

Jump to

Keyboard shortcuts

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