database

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterDatabaseEngine

func RegisterDatabaseEngine(name string, db Engine)

RegisterDatabaseEngine registers a database engine.

Types

type Config

type Config interface{}

Config is a generic config type for database used essentially during YAML configuration parsing, so database engines are free to implement their own configuration requirements.

type Engine

type Engine interface {
	// NewConfig returns a config instance for the corresponding DB engine.
	NewConfig() Config
	// CheckConfig ensure proper configuration parameters and also handle
	// configuration set by environment variables.
	CheckConfig() error

	// Connect initiates connection to the database.
	Connect() error
	// Disconnect initiates disconnection from the database.
	Disconnect() error

	// Add adds the provided keys into the database.
	Add(e openpgp.EntityList) error
	// Del removes the provided keys from the database.
	Del(e openpgp.EntityList) error
	// Get retrieves keys corresponding to the search pattern.
	Get(s string, isFingerprint bool, exact bool, kt KeyType) (openpgp.EntityList, error)
}

Engine defines interface that database engines must implement.

func GetDatabaseEngine

func GetDatabaseEngine(name string) (Engine, bool)

GetDatabaseEngine returns the database engine correspo

type KeyType

type KeyType uint8

KeyType defines the type of key to be stored in the database.

const (
	// PublicKey is the key type for getting a public keys.
	PublicKey KeyType = iota
	// SigningKey is the key type used internally by the HKP server to
	// sign submitted user public keys.
	SigningKey
)

Jump to

Keyboard shortcuts

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