infrastructure

package
v0.0.0-...-238f78a Latest Latest
Warning

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

Go to latest
Published: May 6, 2015 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RssServer

type RssServer struct {
	// URL of the Server
	Server string
	// Port the server listens on
	Port int
	// Feed Object
	Feed *feeds.RssFeed
	// Internal map of files that we are making available
	Filemap map[string]*domain.MediaFile
}

RssServer is a HTTP server which maintains and presents a https://github.com/gorilla/feeds feed

Exposes:

/ - Prints the RSS XML
/file/<id>/filename - Downloads the file

func NewRssServer

func NewRssServer(serverName string, port int) *RssServer

NewRssServer takes the URL and port that the server will listen and offer its wares from.

func (*RssServer) CreateRssItem

func (s *RssServer) CreateRssItem(file *domain.MediaFile) *feeds.RssItem

CreateRssItem takes a provided file.MediaFile and converts it into a RssItem

func (*RssServer) GetFile

func (s *RssServer) GetFile(w http.ResponseWriter, r *http.Request)

GetFile is the endpoint that will return the file requested, or raise a 404 error if the file cannot be found

func (*RssServer) GetList

func (s *RssServer) GetList(w http.ResponseWriter, r *http.Request)

GetList is the endpoint that will return the XML file

func (*RssServer) MakeLinkUrl

func (s *RssServer) MakeLinkUrl(parts ...string) string

MakeLinkUrl creates a URL from the provided string parts

func (*RssServer) Run

func (s *RssServer) Run() error

Run starts the HTTP listener. Returns whatever error the HTTP server may raise (not HTTP errors)

func (*RssServer) ServerAddress

func (s *RssServer) ServerAddress() string

ServerAddress returns the base URL

func (*RssServer) SetFileInput

func (s *RssServer) SetFileInput(additions chan *domain.MediaFile)

SetFileInput sets the input channel that will feed the RSS feed Starts a new go routine

Jump to

Keyboard shortcuts

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