web

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2021 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BufferStatusHandler bufferStatusHandler
View Source
var (
	// ErrParser is thrown when a request object is of the wrong type
	ErrParser error = errParse{}
)
View Source
var HomeHandler homeHandler
View Source
var MP3StreamHandler mp3StreamHandler
View Source
var NowPlayingHandler nowPlayingHandler
View Source
var StatusHandler statusHandler
View Source
var WAVStreamHandler wavStreamHandler

Functions

This section is empty.

Types

type Handler added in v0.5.0

type Handler interface {
	// DecodeRequest turns a HTTP request into a domain-specific request type
	DecodeRequest(*http.Request) (Request, error)

	// A RequestHandler is a monadic definition of a request handler. The inputs
	// are the current state of the world, and a handler-specific request type,
	// and the output is the new state of the world (which may or may not be the
	// same), a handler-specific response type, and/or an error.
	HandleRequest(State, Request) (State, Response, error)
}

A Handler handles requests

type Request added in v0.5.0

type Request interface {
	FlaggedAsRequest()
}

A Request flags any request type

type Response added in v0.5.0

type Response interface {
	FlaggedAsResponse()
}

A Response flags any response type

type State added in v0.5.0

type State struct {
	Library    *speeldoos.Library
	NowPlaying speeldoos.Performance
	RawStream  chunker.Chunker
	MP3Stream  chunker.Chunker
	Buffers    struct {
		Scheduler chunker.Statuser
		MP3Stream chunker.Statuser
	}
}

The State struct represents the current state of the world

Jump to

Keyboard shortcuts

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