kv

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2021 License: ISC Imports: 10 Imported by: 0

README

Kilovolt

Websocket-based API over a Badger. Does not aim to give access to all features (for the time being), mostly what's needed for strimertul and stulbe

License

Most of the code here is based on Gorilla Websocket's chat example, which is licensed under BSD-2-Clause (see LICENSE-gorilla).

The entire project is licensed under ISC (see LICENSE).

Documentation

Index

Constants

View Source
const (
	CmdReadKey        = "kget"
	CmdWriteKey       = "kset"
	CmdSubscribeKey   = "ksub"
	CmdUnsubscribeKey = "kunsub"
)

Commands

Variables

This section is empty.

Functions

func ServeWs

func ServeWs(hub *Hub, w http.ResponseWriter, r *http.Request)

serveWs handles websocket requests from the peer.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a middleman between the websocket connection and the hub.

type Hub

type Hub struct {
	// contains filtered or unexported fields
}

func NewHub

func NewHub(db *badger.DB, logger logrus.FieldLogger) *Hub

func (*Hub) ReadKey

func (h *Hub) ReadKey(key string) (string, error)

func (*Hub) Run

func (h *Hub) Run()

func (*Hub) WriteKey

func (h *Hub) WriteKey(key string, data string) error

Jump to

Keyboard shortcuts

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