queued

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2013 License: MIT Imports: 15 Imported by: 3

Documentation

Index

Constants

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

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, mime string) (*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
	Store  string
	DbPath string
	Sync   bool
}

func NewConfig

func NewConfig() *Config

func (*Config) CreateStore added in v0.1.2

func (c *Config) CreateStore() Store

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 interface {
	NextRecord() (*Record, bool)
}

type Json

type Json map[string]interface{}

type LevelIterator added in v0.1.2

type LevelIterator struct {
	*levigo.Iterator
}

func (*LevelIterator) NextRecord added in v0.1.2

func (it *LevelIterator) NextRecord() (*Record, bool)

type LevelStore added in v0.1.2

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

func NewLevelStore added in v0.1.2

func NewLevelStore(path string, sync bool) *LevelStore

func (*LevelStore) Close added in v0.1.2

func (s *LevelStore) Close()

func (*LevelStore) Drop added in v0.1.2

func (s *LevelStore) Drop()

func (*LevelStore) Get added in v0.1.2

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

func (*LevelStore) Iterator added in v0.1.2

func (s *LevelStore) Iterator() Iterator

func (*LevelStore) Put added in v0.1.2

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

func (*LevelStore) Remove added in v0.1.2

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

type MemoryIterator added in v0.1.2

type MemoryIterator struct {
}

func (*MemoryIterator) NextRecord added in v0.1.2

func (it *MemoryIterator) NextRecord() (*Record, bool)

type MemoryStore added in v0.1.2

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

func NewMemoryStore added in v0.1.2

func NewMemoryStore() *MemoryStore

func (*MemoryStore) Drop added in v0.1.2

func (s *MemoryStore) Drop()

func (*MemoryStore) Get added in v0.1.2

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

func (*MemoryStore) Iterator added in v0.1.2

func (s *MemoryStore) Iterator() Iterator

func (*MemoryStore) Put added in v0.1.2

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

func (*MemoryStore) Remove added in v0.1.2

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

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
	Mime  string
	Queue string
	// contains filtered or unexported fields
}

func NewRecord

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

func (*Record) ContentType added in v0.1.3

func (r *Record) ContentType() string

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) 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 http.HandlerFunc) *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 interface {
	Get(id int) (*Record, error)
	Put(record *Record) error
	Remove(id int) error
	Iterator() Iterator
	Drop()
}

Jump to

Keyboard shortcuts

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