Documentation ¶
Overview ¶
Package mq implements interprocess queues logic.
Index ¶
Constants ¶
const ( // O_NONBLOCK flag makes mq read/write operations nonblocking. O_NONBLOCK = common.O_NONBLOCK )
Variables ¶
This section is empty.
Functions ¶
func DestroySystemVMessageQueue ¶
DestroySystemVMessageQueue permanently removes queue with a given name.
Types ¶
type Messenger ¶
type Messenger interface { // Send sends the data. It blocks if there are no readers and the queue if full Send(data []byte) error // Receive reads data from the queue. It blocks if the queue is empty Receive(data []byte) error io.Closer }
Messenger is an interface which must be satisfied by any message queue implementation on any platform.
func New ¶
New creates a mq with a given name and permissions. It uses the default implementation. If there are several implementations on a platform, you can use explicit create functions.
name - unique queue name. perm - permissions for the new queue. this may not be supported by all implementations.
func Open ¶
Open opens a mq with a given name and flags. It uses the default implementation. If there are several implementations on a platform, you can use explicit create functions.
name - unique queue name. flags - a set of flags can be used to specify r/w options. this may not be supported by all implementations.
type SystemVMessageQueue ¶
type SystemVMessageQueue struct {
// contains filtered or unexported fields
}
SystemVMessageQueue is a System V ipc mechanism based on message passing.
func CreateSystemVMessageQueue ¶
func CreateSystemVMessageQueue(name string, perm os.FileMode) (*SystemVMessageQueue, error)
CreateSystemVMessageQueue creates new queue with the given name and permissions. 'execute' permission cannot be used.
func OpenSystemVMessageQueue ¶
func OpenSystemVMessageQueue(name string, flags int) (*SystemVMessageQueue, error)
OpenSystemVMessageQueue opens existing message queue.
func (*SystemVMessageQueue) Close ¶
func (mq *SystemVMessageQueue) Close() error
Close closes the queue. As there is no need to close SystemV mq, this function returns nil. It was added to satisfy io.Closer
func (*SystemVMessageQueue) Destroy ¶
func (mq *SystemVMessageQueue) Destroy() error
Destroy closes the queue and removes it permanently.
func (*SystemVMessageQueue) Receive ¶
func (mq *SystemVMessageQueue) Receive(data []byte) error
Receive receives a message. It blocks if the queue is empty.
func (*SystemVMessageQueue) Send ¶
func (mq *SystemVMessageQueue) Send(data []byte) error
Send sends a message. It blocks if the queue is full.
func (*SystemVMessageQueue) SetBlocking ¶
func (mq *SystemVMessageQueue) SetBlocking(block bool) error
SetBlocking sets whether the send/receive operations on the queue block.
type TimedMessenger ¶
type TimedMessenger interface { Messenger // SendTimeout sends the data. It blocks if there are no readers and the queue if full. // It wait for not more, than timeout. SendTimeout(data []byte, timeout time.Duration) error // ReceiveTimeout reads data from the queue. It blocks if the queue is empty. // It wait for not more, than timeout. ReceiveTimeout(data []byte, timeout time.Duration) error }
TimedMessenger is a Messenger, which supports send/receive timeouts.