store

package
v0.0.0-...-0abef86 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package store provides an interface to database storage for the TRISA directory service.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCorruptedSequence = errors.New("primary key sequence is invalid")
	ErrCorruptedIndex    = errors.New("search indices are invalid")
	ErrIncompleteRecord  = errors.New("vasp record is missing required fields")
	ErrEntityNotFound    = errors.New("entity not found")
	ErrDuplicateEntity   = errors.New("entity unique constraints violated")
)

Errors that may occur during LevelDB operations

Functions

This section is empty.

Types

type Store

type Store interface {
	Close() error
	Create(v pb.VASP) (uint64, error)
	Retrieve(id uint64) (pb.VASP, error)
	Update(v pb.VASP) error
	Destroy(id uint64) error
	Search(query map[string]interface{}) ([]pb.VASP, error)
}

Store provides an interface for directory storage services to abstract the underlying database provider. The storage methods correspond to directory service requests, which are currently implemented with a simple CRUD and search interface for VASP records. The underlying database can be a simple embedded store or a distributed SQL server, so long as it can interact with VASP identity records.

func Open

func Open(uri string) (Store, error)

Open a directory storage provider with the specified URI. Database URLs should either specify protocol+transport://user:pass@host/dbname?opt1=a&opt2=b for servers or protocol:/path/to/file for embedded databases.

func OpenLevelDB

func OpenLevelDB(uri string) (Store, error)

OpenLevelDB directory Store at the specified path. This is the default storage provider.

Jump to

Keyboard shortcuts

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