queued

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2013 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const NilDuration = time.Duration(-1)

Variables

This section is empty.

Functions

func Stod

func Stod(val string, scale ...time.Duration) (time.Duration, error)

Types

type Application

type Application struct {
	// contains filtered or unexported fields
}

func NewApplication

func NewApplication(store *Store) *Application

func (*Application) Complete

func (a *Application) Complete(name string, id int) (bool, error)

func (*Application) Dequeue

func (a *Application) Dequeue(name string, wait time.Duration, timeout time.Duration) (*Record, error)

func (*Application) Enqueue

func (a *Application) Enqueue(name string, value []byte) (*Record, error)

func (*Application) GetItem

func (a *Application) GetItem(id int) (*Item, bool)

func (*Application) GetQueue

func (a *Application) GetQueue(name string) *Queue

func (*Application) Info

func (a *Application) Info(name string, id int) (*Info, error)

func (*Application) PutItem

func (a *Application) PutItem(item *Item)

func (*Application) RemoveItem

func (a *Application) RemoveItem(id int)

func (*Application) Stats added in v0.1.1

func (a *Application) Stats(name string) map[string]int

type Config

type Config struct {
	Port   uint
	Auth   string
	DbPath string
	Sync   bool
}

func NewConfig

func NewConfig() *Config

type Info

type Info struct {
	// contains filtered or unexported fields
}

type Item

type Item struct {
	// contains filtered or unexported fields
}

func NewItem

func NewItem(value int) *Item

func (*Item) Complete

func (item *Item) Complete()

type Iterator

type Iterator struct {
	*levigo.Iterator
}

func NewIterator

func NewIterator(db *levigo.DB) *Iterator

func (*Iterator) Record

func (it *Iterator) Record() *Record

type Json

type Json map[string]interface{}

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue() *Queue

func (*Queue) Dequeue

func (q *Queue) Dequeue(wait time.Duration, timeout time.Duration) *Item

func (*Queue) Enqueue

func (q *Queue) Enqueue(value int) *Item

func (*Queue) EnqueueItem

func (q *Queue) EnqueueItem(item *Item)

func (*Queue) Stats added in v0.1.1

func (q *Queue) Stats() map[string]int

type Record

type Record struct {
	Value []byte
	Queue string
	// contains filtered or unexported fields
}

func NewRecord

func NewRecord(value []byte, queue string) *Record

type Server

type Server struct {
	Config *Config
	Router *mux.Router
	Store  *Store
	App    *Application
	Addr   string
}

func NewServer

func NewServer(config *Config) *Server

func (*Server) BeforeHandler

func (s *Server) BeforeHandler(w http.ResponseWriter, req *http.Request) bool

func (*Server) CompleteHandler

func (s *Server) CompleteHandler(w http.ResponseWriter, req *http.Request)

func (*Server) DequeueHandler

func (s *Server) DequeueHandler(w http.ResponseWriter, req *http.Request)

func (*Server) EnqueueHandler

func (s *Server) EnqueueHandler(w http.ResponseWriter, req *http.Request)

func (*Server) HandleFunc

func (s *Server) HandleFunc(route string, fn func(http.ResponseWriter, *http.Request)) *mux.Route

func (*Server) InfoHandler

func (s *Server) InfoHandler(w http.ResponseWriter, req *http.Request)

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*Server) StatsHandler added in v0.1.1

func (s *Server) StatsHandler(w http.ResponseWriter, req *http.Request)

type Stats added in v0.1.1

type Stats struct {
	Counters map[string]int
	// contains filtered or unexported fields
}

func NewStats added in v0.1.1

func NewStats(counters map[string]int) *Stats

func (*Stats) Dec added in v0.1.1

func (s *Stats) Dec(field string)

func (*Stats) Get added in v0.1.1

func (s *Stats) Get() map[string]int

func (*Stats) Inc added in v0.1.1

func (s *Stats) Inc(field string)

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore(path string, sync bool) *Store

func (*Store) Close

func (s *Store) Close()

func (*Store) Drop

func (s *Store) Drop()

func (*Store) Get

func (s *Store) Get(id int) (*Record, error)

func (*Store) Iterator

func (s *Store) Iterator() *Iterator

func (*Store) Put

func (s *Store) Put(record *Record) error

func (*Store) Remove

func (s *Store) Remove(id int) error

Jump to

Keyboard shortcuts

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