db

package
v0.0.0-...-17f4e14 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package db manages route storage for FastGate. The storage is performed by a Key-Value community database called Badger.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEndpoint

func GetEndpoint(database *badger.DB, key string) (value string, err error)

GetEndpoint finds an address matching an key and returns it as a string.

func Init

func Init(databasePath string) (*badger.DB, error)

Init takes a path as input and reads / creates a bBadger database .

func UpdateEndpoint

func UpdateEndpoint(database *badger.DB, key string, address string) error

UpdateEndpoint is a simple querry that inserts/updates the Endpoint tuple used by FastGate.

Types

type Endpoint

type Endpoint struct {
	Address  string `json:"address"`
	Resource string `json:"resource"`
}

Endpoint structure stores the Endpoints for the gateway.

func GetEndpoints

func GetEndpoints(database *badger.DB) (endpoints []Endpoint, err error)

GetEndpoints function will read every entry in the database and return it as a list of Endpoints.

Jump to

Keyboard shortcuts

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