store

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMessageIng  = errors.New("the message is consuming")
	ErrMessageDone = errors.New("the message is consumed")
	ErrAssertFail  = errors.New("assert failure")
)
View Source
var DefaultPayload = &defaultPayload{}

Functions

func NewMysqlStore

func NewMysqlStore(opts *OptionsWithDB, payloader Payloader) (*mysqlStore, error)

func NewMysqlStoreWithDB added in v1.0.0

func NewMysqlStoreWithDB(opts *Options, db *gorm.DB, payloader Payloader) (*mysqlStore, error)

Types

type MQStatus added in v1.0.0

type MQStatus int
const (
	StatusUndo  MQStatus = 0
	StatusDoing MQStatus = 1
	StatusDone  MQStatus = 2
)

type Options added in v1.0.0

type Options struct {
	TableName string
	// 假设任务最长执行时间为 a
	// 假设宕机最长时间为 b
	// 下面时间为 c
	// 应当满足 b < c < a
	ReadRepeatTimeout time.Duration
}

type OptionsWithDB added in v1.0.0

type OptionsWithDB struct {
	Options

	Debug bool

	User     string
	Password string
	Address  string
	DBName   string

	Timeout     string
	ReadTimeout string
}

type Payloader added in v1.0.0

type Payloader interface {
	Encode(topic string, payload interface{}) ([]byte, error)
	Decode(topic string, payload []byte) (interface{}, error)
}

Jump to

Keyboard shortcuts

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