server

package
v0.0.0-...-c385811 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

A lot of this was adapted from https://gist.github.com/ismasan/3fb75381cd2deb6bfa9c Great big thanks to Ismael Celis for that work.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageBuffer

type MessageBuffer struct {
	Size int
	// contains filtered or unexported fields
}

func NewMessageBuffer

func NewMessageBuffer(size int) (buffer MessageBuffer)

NewMessageBuffer initializes a MessageBuffer with the given size.

func (*MessageBuffer) Add

func (buff *MessageBuffer) Add(entry TailMessage)

Add appends a TailMessage to the buffer, knocking off the first value if the size exceeds the size. Note that this will not *shorten* the buffer, it can only ever grow it.

func (*MessageBuffer) Clear

func (buff *MessageBuffer) Clear()

Clear reinitializes the buffer, making it so it contains no elements.

func (*MessageBuffer) Get

func (buff *MessageBuffer) Get() []TailMessage

Get returns a copy of the TailMessage elements contained in the buffer.

type TailMessage

type TailMessage struct {
	Line    string `json:"line"`
	Context string `json:"context,omitempty"`
}

type TailServer

type TailServer struct {
	Messaging chan TailMessage
	// contains filtered or unexported fields
}

func NewServer

func NewServer(cfg config.Configuration) (server *TailServer)

func (*TailServer) ServeEmbed

func (server *TailServer) ServeEmbed(rw http.ResponseWriter, req *http.Request, filename string, mimeType string)

func (*TailServer) ServeEvents

func (server *TailServer) ServeEvents(rw http.ResponseWriter, req *http.Request)

func (*TailServer) ServeHTTP

func (server *TailServer) ServeHTTP(rw http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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