httpd

package
v0.0.0-...-8ec4a59 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package httpd provides the HTTP server for accessing the distributed key-value store. It also provides the endpoint for other nodes to join an existing cluster.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service provides HTTP service.

func New

func New(addr string, store Store) *Service

New returns an uninitialized HTTP service.

func (*Service) Addr

func (s *Service) Addr() net.Addr

Addr returns the address on which the Service is listening

func (*Service) Close

func (s *Service) Close()

Close closes the service.

func (*Service) ServeHTTP

func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP allows Service to serve HTTP requests.

func (*Service) Start

func (s *Service) Start() error

Start starts the service.

type Store

type Store interface {
	// Get returns the value for the given key.
	Get(key string) ([]byte, error)

	// Set sets the value for the given key, via distributed consensus.
	Set(key string, value []byte) error

	// Delete removes the given key, via distributed consensus.
	Delete(key string) error
}

Store is the interface Raft-backed key-value stores must implement.

Jump to

Keyboard shortcuts

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