Documentation
¶
Index ¶
- Variables
- type Command
- type Conn
- type Controller
- func (c *Controller) Delete(input []string) error
- func (c *Controller) Dispatch() error
- func (c *Controller) FinishSession()
- func (c *Controller) Flush(input []string) error
- func (c *Controller) FlushAll() error
- func (c *Controller) Get(input []string) error
- func (c *Controller) ReadFirstMessage() (string, error)
- func (c *Controller) SendError(err error)
- func (c *Controller) Set(input []string) error
- func (c *Controller) Stats() error
- func (c *Controller) UnknownCommand() error
- func (c *Controller) Version() error
- type Error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnknownCommand is returned when command was not recognized ErrUnknownCommand = &Error{commonError, "Unknown command"} // ErrInvalidCommand means command wasn't parsed correcty ErrInvalidCommand = &Error{clientError, "Invalid command"} // ErrCloseCurrentItemFirst is returned when client attemted // to read next item before closing the current one ErrCloseCurrentItemFirst = &Error{clientError, "Close current item first"} // ErrBadDataChunk is returned when data provided by client has different size ErrBadDataChunk = &Error{clientError, "bad data chunk"} // ErrInvalidDataSize is returned when data size field is not a number ErrInvalidDataSize = &Error{clientError, "Invalid <bytes> number"} )
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
Name string
QueueName string
SubCommand string
ConsumerGroup string
FanoutQueues []string
DataSize int
}
Command represents a client command
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller represents a connection controller
func NewSession ¶
func NewSession(conn Conn, repo *repository.QueueRepository) *Controller
NewSession creates and initializes new controller
func (*Controller) Delete ¶
func (c *Controller) Delete(input []string) error
Delete handles DELETE command Command: DELETE <queue> Response: END
func (*Controller) Dispatch ¶
func (c *Controller) Dispatch() error
Dispatch routes client commands to their respective handlers
func (*Controller) FinishSession ¶
func (c *Controller) FinishSession()
FinishSession aborts unfinished transaction
func (*Controller) Flush ¶
func (c *Controller) Flush(input []string) error
Flush handles FLUSH command Command: FLUSH <queue> Response: END
func (*Controller) FlushAll ¶
func (c *Controller) FlushAll() error
FlushAll handles FLUSH_ALL command. Command: FLUSH_ALL Response: Flushed all queues
func (*Controller) Get ¶
func (c *Controller) Get(input []string) error
Get handles GET command Command: GET <queue> Response: VALUE <queue> 0 <bytes> <data block> END
func (*Controller) ReadFirstMessage ¶
func (c *Controller) ReadFirstMessage() (string, error)
ReadFirstMessage reads initial message from connection buffer
func (*Controller) SendError ¶
func (c *Controller) SendError(err error)
SendError sends an error message to the client
func (*Controller) Set ¶
func (c *Controller) Set(input []string) error
Set handles SET command Command: SET <queue> <not_impl> <not_impl> <bytes> <data block> Response: STORED
func (*Controller) UnknownCommand ¶
func (c *Controller) UnknownCommand() error
UnknownCommand reports an error