Documentation ¶
Index ¶
- Constants
- Variables
- func ForceRemoveQueue(name string) error
- type MessageQueue
- func (mq *MessageQueue) Close() error
- func (mq *MessageQueue) Count() (int, error)
- func (mq *MessageQueue) GetAttr() (*MessageQueueAttribute, error)
- func (mq *MessageQueue) Notify(sigNo syscall.Signal) error
- func (mq *MessageQueue) Receive() ([]byte, uint, error)
- func (mq *MessageQueue) Send(data []byte, priority uint) error
- func (mq *MessageQueue) TimedReceive(duration time.Duration) ([]byte, uint, error)
- func (mq *MessageQueue) TimedSend(data []byte, priority uint, duration time.Duration) error
- func (mq *MessageQueue) Unlink() error
- type MessageQueueAttribute
- type QueueConfig
Constants ¶
const ( O_RDONLY = C.O_RDONLY O_WRONLY = C.O_WRONLY O_RDWR = C.O_RDWR O_CLOEXEC = C.O_CLOEXEC O_CREAT = C.O_CREAT O_EXCL = C.O_EXCL O_NONBLOCK = C.O_NONBLOCK // Based on Linux 3.5+ MSGSIZE_MAX = 16777216 MSGSIZE_DEFAULT = MSGSIZE_MAX )
const POSIX_MQ_DIR = "/dev/mqueue/"
Variables ¶
var (
MemoryAllocationError = fmt.Errorf("Memory Allocation Error")
)
Functions ¶
func ForceRemoveQueue ¶ added in v0.2.1
ForceRemoveQueue deletes the posix queue by name If one or more processes have the message queue open when mq_unlink() is called, destruction of the message queue shall be postponed until all references to the message queue have been closed.
Types ¶
type MessageQueue ¶
type MessageQueue struct {
// contains filtered or unexported fields
}
Represents the message queue
func NewMessageQueue ¶
func NewMessageQueue(config *QueueConfig) (*MessageQueue, error)
NewMessageQueue returns an instance of the message queue given a QueueConfig.
func (*MessageQueue) Count ¶ added in v0.2.0
func (mq *MessageQueue) Count() (int, error)
Count gets the number of queued messages
func (*MessageQueue) GetAttr ¶ added in v0.2.1
func (mq *MessageQueue) GetAttr() (*MessageQueueAttribute, error)
GetAttr gets the queue attributes
func (*MessageQueue) Notify ¶
func (mq *MessageQueue) Notify(sigNo syscall.Signal) error
Notify set signal notification to handle new message
func (*MessageQueue) Receive ¶
func (mq *MessageQueue) Receive() ([]byte, uint, error)
Receive receives message from the message queue.
func (*MessageQueue) Send ¶
func (mq *MessageQueue) Send(data []byte, priority uint) error
Send sends message to the message queue.
func (*MessageQueue) TimedReceive ¶
TimedReceive receives message from the message queue with a ceiling on the time for which the call will block.
func (*MessageQueue) TimedSend ¶
TimedSend sends message to the message queue with a ceiling on the time for which the call will block.
func (*MessageQueue) Unlink ¶
func (mq *MessageQueue) Unlink() error
Unlink deletes the message queue.
type MessageQueueAttribute ¶
type QueueConfig ¶ added in v0.2.0
type QueueConfig struct { Name string Dir string Flags int Mode int // The mode of the message queue, e.g. 0600 Attrs *MessageQueueAttribute }
QueueConfig is used to configure an instance of the message queue.
func (*QueueConfig) GetFile ¶ added in v0.2.0
func (config *QueueConfig) GetFile() string
GetFile gets the file on the OS where the queues are stored