skydb

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: MIT Imports: 9 Imported by: 0

README

SkyDB

This is a small, unofficial SDK for SkyDB. It also works for Skynet Registry on which SkyDB is based.

Documentation

Overview

Package skydb provides a simple library for working with Skynet Lab's SkyDB and the Skynet Registry on which SkyDB is built.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when an entry is not found.
	ErrNotFound = errors.New("skydb entry not found")
)

Functions

This section is empty.

Types

type SkyDB

type SkyDB struct {
	// contains filtered or unexported fields
}

SkyDB is a decentralized tool for storing mutable data built on top of Skynet Registry.

See https://blog.sia.tech/skydb-a-mutable-database-for-the-decentralized-web-7170beeaa985

func New

func New(sk crypto.SecretKey, pk crypto.PublicKey, opts client.Options) (*SkyDB, error)

New creates a new SkyDB client with the given options. If the options are empty we'll look for skyd at localhost:9980, we'll use "Sia-Agent" as user agent, and we'll try to get the password for skyd from the environment.

func (SkyDB) Read

func (db SkyDB) Read(dataKey crypto.Hash) ([]byte, uint64, error)

Read retrieves from SkyDB the data that corresponds to the given key set.

func (SkyDB) Write

func (db SkyDB) Write(data []byte, dataKey crypto.Hash, rev uint64) error

Write stores the given `data` in SkyDB under the given key set.

type SkyDBI

type SkyDBI interface {
	Read(hash crypto.Hash) ([]byte, uint64, error)
	Write(data []byte, dataKey crypto.Hash, rev uint64) error
}

SkyDBI is the interface for communicating with SkyDB. We use an interface, so we can easily override it for testing purposes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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