skydb

package
v0.0.0-...-71adcf2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

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

func EntropyFromEnv

func EntropyFromEnv() (crypto.Hash, error)

EntropyFromEnv returns the configured value of the CADDY_SKYDB_ENTROPY environment variable or an error.

Types

type SkyDB

type SkyDB struct {
	Client *client.Client
	// contains filtered or unexported fields
}

func New

func New() (*SkyDB, error)

New creates a new SkyDB client with default option. The default options are to look for a skyd node at localhost:9980, to use "Sia-Agent" as user agent and 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(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.

Jump to

Keyboard shortcuts

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