upstream

package
v0.0.0-...-34ba797 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2015 License: GPL-3.0 Imports: 4 Imported by: 0

README

Upstream Modules

This directory contains all upstream modules. An upstream module is one which is resposible for downloading content from a remote host via HTTP.

Contents

Anatomy of a Upstream Module

It is a subpackage in the upstream/ directory which must have a new function of the type:

func New() *T

where T is a type which implements the Upstream interface defined in interface.go.

How to Write Your Own Module?

You can add your own modules as long as their names do not collide with any other module's name. Lets say you want to create a round robin upstream module which will get files from multiple origins. And you want your module be called rrobin.

  • Go into the upstream/ directory - $ cd .../nedomi/upstream
  • Create a directory which will be the name of your module. Lets say it is rrobin so it is mkdir rrobin
  • Write your implementation of Upstream in this directory as package rrobin
  • In the main project directory run go generate ./...

Removing a Module

Lets say you want to remove the rrobin module.

  • Within the project directory
  • rm -rf upstream/rrobin
  • go generate ./...

You will have to leave at least one upstream module in order to have a working build.

How Does it Work?

golang does not support dynamic linking. So our only choice is to come up with some other trick to have optional modules. For that reason we use the go generate tool.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(upstreamName string, upstreamURL *url.URL) (types.Upstream, error)

New creates and returns a particular type of upstream.

func TypeExists

func TypeExists(upstreamName string) bool

TypeExists returns true if a upstream module with this name exists. False otherwise.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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