Documentation ¶
Index ¶
- type Engine
- func (me *Engine) Close()
- func (me *Engine) GenerateAckQuery(name string, ids []string) (string, map[string]interface{}, error)
- func (me *Engine) GeneratePostponeQuery(name string, ids []string) (string, map[string]interface{}, error)
- func (me *Engine) GeneratePurgeQuery(name string, timeCutoff int64) (string, map[string]interface{}, error)
- func (me *Engine) LockDB(newMessages map[string][]*MessageRow, changedMessages map[string][]string) func()
- func (me *Engine) Open(dbconfigs dbconfigs.DBConfigs) error
- func (me *Engine) Subscribe(name string, send func(*sqltypes.Result) error) (done chan struct{}, err error)
- func (me *Engine) UpdateCaches(newMessages map[string][]*MessageRow, changedMessages map[string][]string)
- type MessageRow
- type TabletService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is the engine for handling messages.
func NewEngine ¶
func NewEngine(tsv TabletService, se *schema.Engine, config tabletenv.TabletConfig) *Engine
NewEngine creates a new Engine.
func (*Engine) GenerateAckQuery ¶
func (me *Engine) GenerateAckQuery(name string, ids []string) (string, map[string]interface{}, error)
GenerateAckQuery returns the query and bind vars for acking a message.
func (*Engine) GeneratePostponeQuery ¶
func (me *Engine) GeneratePostponeQuery(name string, ids []string) (string, map[string]interface{}, error)
GeneratePostponeQuery returns the query and bind vars for postponing a message.
func (*Engine) GeneratePurgeQuery ¶
func (me *Engine) GeneratePurgeQuery(name string, timeCutoff int64) (string, map[string]interface{}, error)
GeneratePurgeQuery returns the query and bind vars for purging messages.
func (*Engine) LockDB ¶
func (me *Engine) LockDB(newMessages map[string][]*MessageRow, changedMessages map[string][]string) func()
LockDB obtains db locks for all messages that need to be updated and returns the counterpart unlock function.
func (*Engine) Subscribe ¶
func (me *Engine) Subscribe(name string, send func(*sqltypes.Result) error) (done chan struct{}, err error)
Subscribe subscribes to messages from the requested table. The function returns a done channel that will be closed when the subscription ends, which can be initiated by the send function returning io.EOF. The engine can also end a subscription which is usually triggered by Close. It's the responsibility of the send function to promptly return if the done channel is closed. Otherwise, the engine's Close function will hang indefinitely.
func (*Engine) UpdateCaches ¶
func (me *Engine) UpdateCaches(newMessages map[string][]*MessageRow, changedMessages map[string][]string)
UpdateCaches updates the caches for the committed changes.
type MessageRow ¶
MessageRow represents a message row.
func BuildMessageRow ¶
func BuildMessageRow(row []sqltypes.Value) (*MessageRow, error)
BuildMessageRow builds a MessageRow for a db row.
type TabletService ¶
type TabletService interface { CheckMySQL() PostponeMessages(ctx context.Context, target *querypb.Target, name string, ids []string) (count int64, err error) PurgeMessages(ctx context.Context, target *querypb.Target, name string, timeCutoff int64) (count int64, err error) }
TabletService defines the functions of TabletServer that the messager needs for callback.