data

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package data is an interface for key-value storage.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("not found")
)

Functions

This section is empty.

Types

type Data

type Data interface {
	// Dump the known records
	Dump() ([]*Record, error)
	// Read a record with key
	Read(key string) (*Record, error)
	// Write a record
	Write(r *Record) error
	// Delete a record with key
	Delete(key string) error
}

Data is a data storage interface

type Option

type Option func(o *Options)

func Nodes

func Nodes(a ...string) Option

func Prefix

func Prefix(p string) Option

Prefix sets a prefix to any lock ids used

type Options

type Options struct {
	Nodes  []string
	Prefix string
}

type Record

type Record struct {
	Key        string
	Value      []byte
	Expiration time.Duration
}

Record represents a data record

Directories

Path Synopsis
Package consul is a consul implementation of kv
Package consul is a consul implementation of kv

Jump to

Keyboard shortcuts

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