broker

package
v0.0.0-...-65c615f Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2014 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterStore

func RegisterStore(name string, d StoreDriver) error

Types

type App

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

func NewApp

func NewApp(jsonConfig json.RawMessage) (*App, error)

func NewAppWithConfig

func NewAppWithConfig(cfg *Config) (*App, error)

func (*App) Close

func (app *App) Close()

func (*App) Config

func (app *App) Config() *Config

func (*App) Run

func (app *App) Run()

type Config

type Config struct {
	Version uint32 `json:"version"`

	Addr string `json:"addr"`

	HttpAddr string `json:"http_addr"`

	KeepAlive int `json:"keepalive"`

	MaxMessageSize int `json:"max_msg_size"`
	MessageTimeout int `json:"msg_timeout"`
	MaxQueueSize   int `json:"max_queue_size"`

	Store       string          `json:"store"`
	StoreConfig json.RawMessage `json:"store_config"`
}

func NewDefaultConfig

func NewDefaultConfig() *Config

type MemStore

type MemStore struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*MemStore) Close

func (s *MemStore) Close() error

func (*MemStore) Delete

func (s *MemStore) Delete(queue string, msgId int64) error

func (*MemStore) Front

func (s *MemStore) Front(queue string) (*msg, error)

func (*MemStore) GenerateID

func (s *MemStore) GenerateID() (int64, error)

func (*MemStore) Len

func (s *MemStore) Len(queue string) (int, error)

func (*MemStore) Pop

func (s *MemStore) Pop(queue string) error

func (*MemStore) Save

func (s *MemStore) Save(queue string, m *msg) error

type MemStoreDriver

type MemStoreDriver struct {
}

func (MemStoreDriver) Open

func (d MemStoreDriver) Open(jsonConfig json.RawMessage) (Store, error)

type MsgHandler

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

func (*MsgHandler) ServeHTTP

func (h *MsgHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RedisStore

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

func (*RedisStore) Close

func (s *RedisStore) Close() error

func (*RedisStore) Delete

func (s *RedisStore) Delete(queue string, msgId int64) error

func (*RedisStore) Front

func (s *RedisStore) Front(queue string) (*msg, error)

func (*RedisStore) GenerateID

func (s *RedisStore) GenerateID() (int64, error)

func (*RedisStore) Len

func (s *RedisStore) Len(queue string) (int, error)

func (*RedisStore) Pop

func (s *RedisStore) Pop(queue string) error

func (*RedisStore) Save

func (s *RedisStore) Save(queue string, m *msg) error

type RedisStoreConfig

type RedisStoreConfig struct {
	Addr      string `json:"addr"`
	DB        int    `json:"db"`
	Password  string `json:"password"`
	IdleConns int    `json:"idle_conns"`
	KeyPrefix string `json:"key_prefix"`
}

type RedisStoreDriver

type RedisStoreDriver struct {
}

func (RedisStoreDriver) Open

func (d RedisStoreDriver) Open(jsonConfig json.RawMessage) (Store, error)

type Store

type Store interface {
	Close() error
	GenerateID() (int64, error)
	Save(queue string, m *msg) error
	Delete(queue string, msgId int64) error
	Pop(queue string) error
	Front(queue string) (*msg, error)
	Len(queue string) (int, error)
}

func OpenStore

func OpenStore(name string, configJson json.RawMessage) (Store, error)

type StoreDriver

type StoreDriver interface {
	Open(configJson json.RawMessage) (Store, error)
}

Jump to

Keyboard shortcuts

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