golfstream

package module
v0.0.0-...-5a8c9f9 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2016 License: MIT Imports: 14 Imported by: 0

README

golfstream

A library, written in Go, for manipulating streams of data

GoDoc

Documentation

Overview

Package that provides a golfstream Service interface and it's implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(s Service, errorCb func(error)) http.Handler

Create a http.Handler that maps URLs from HTTP service and websocket commands from it to a methods of an object implementing Service interface.

Types

type Backend

type Backend interface {
	// Get an underlying backend.
	Backend() backend.Backend

	// List stream names, their corresponding backend names and definitions.
	Streams() ([]string, []string, [][]string, error)

	// Add stream with given name and definition to a backend stream.
	AddStream(bstream, name string, defs []string) (backend.BackendStream, error)
	// Get stream and it's backend stream's name by stream name.
	GetStream(name string) (backend.BackendStream, string, error)
	// Remove stream by name.
	RmStream(name string) error

	// Add subscriber to a backend stream.
	// Returns a range from history.
	AddSub(bstream string, s backend.Stream, hFrom int, hTo int) (uint, uint, error)
	// Remove a subscriber from a backend stream.
	// Returns true if this subscribes actually was subscribed, false otherwise.
	RmSub(bstream string, s backend.Stream) (bool, error)
}

Backend is an interface to a collection of streams that map to pairs of backend stream and conversion definition.

type Service

type Service interface {
	// List added backend names.
	Backends() ([]string, error)

	// Add backend by name.
	AddBackend(name string, back backend.Backend) (Backend, error)
	// Get backend by name.
	GetBackend(name string) (Backend, error)
	// Remove backend by name.
	RmBackend(name string) error

	// Close the Service handler.
	Close() error
}

Service is an interface to a collection of named backends.

func New

func New() Service

Create the golfstream service.

func NewHttp

func NewHttp(baseUrl string, p poster.Poster, errorCb func(error)) (Service, error)

Create a golfstream remote service implementation that doesn't itseld do anything except sending commands to remote server wia HTTP and a websoket.

Directories

Path Synopsis
A package with a Backend interface for storing streams of data and it's implementations for different storage engines.
A package with a Backend interface for storing streams of data and it's implementations for different storage engines.
Package dchan provides an elastic event channel implementation and a Chan interface, unifying all the go channel types.
Package dchan provides an elastic event channel implementation and a Chan interface, unifying all the go channel types.
Package errors provides helper functions and structures for more natural error handling in some situations.
Package errors provides helper functions and structures for more natural error handling in some situations.
A package for mocking the JSON HTTP POST requests.
A package for mocking the JSON HTTP POST requests.
A package for manipulating streams of events, which are basically any pieces of data.
A package for manipulating streams of events, which are basically any pieces of data.

Jump to

Keyboard shortcuts

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