Documentation ¶
Overview ¶
Package mq provides an implementation for POSIX message queues.
Index ¶
- Constants
- type AccessType
- type Message
- type OpenOpts
- type Queue
- func (q *Queue) EventRegister(e *waiter.Entry) error
- func (q *Queue) EventUnregister(e *waiter.Entry)
- func (q *Queue) Flush(ctx context.Context)
- func (q *Queue) Generate(ctx context.Context, buf *bytes.Buffer) error
- func (q *Queue) HasPermissions(creds *auth.Credentials, req vfs.AccessTypes) bool
- func (q *Queue) Readiness(mask waiter.EventMask) waiter.EventMask
- type Reader
- type ReaderWriter
- type Registry
- type RegistryImpl
- type Subscriber
- type View
- type Writer
Constants ¶
const MaxName = 255
MaxName is the maximum size for a queue name.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessType ¶
type AccessType int
AccessType is the access type passed to mq_open.
const ( ReadOnly AccessType = iota WriteOnly ReadWrite )
Possible access types.
type Message ¶
type Message struct { // Text is the message's sent content. Text string // Size is the message's size in bytes. Size uint64 // Priority is the message's priority. Priority uint32 // contains filtered or unexported fields }
Message holds a message exchanged through a Queue via mq_timedsend(2) and mq_timedreceive(2), and additional info relating to the message.
+stateify savable
type OpenOpts ¶
type OpenOpts struct { Name string Access AccessType Create bool Exclusive bool Block bool }
OpenOpts holds the options passed to FindOrCreate.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue represents a POSIX message queue.
+stateify savable
func (*Queue) EventRegister ¶
EventRegister implements Waitable.EventRegister.
func (*Queue) EventUnregister ¶
EventUnregister implements Waitable.EventUnregister.
func (*Queue) Generate ¶
Generate implements vfs.DynamicBytesSource.Generate. Queue is used as a DynamicBytesSource for mqfs's queueInode.
func (*Queue) HasPermissions ¶
func (q *Queue) HasPermissions(creds *auth.Credentials, req vfs.AccessTypes) bool
HasPermissions returns true if the given credentials meet the access permissions required by the queue.
type Reader ¶
type Reader struct { *Queue // contains filtered or unexported fields }
Reader provides a send-only view into a queue.
type ReaderWriter ¶
type ReaderWriter struct { *Queue // contains filtered or unexported fields }
ReaderWriter provides a send and receive view into a queue.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is a POSIX message queue registry.
Unlike SysV utilities, Registry is not map-based. It uses a provided RegistryImpl backed by a virtual filesystem to implement registry operations.
+stateify savable
func NewRegistry ¶
func NewRegistry(userNS *auth.UserNamespace, impl RegistryImpl) *Registry
NewRegistry returns a new, initialized message queue registry. NewRegistry should be called when a new message queue filesystem is created, once per IPCNamespace.
type RegistryImpl ¶
type RegistryImpl interface { // Get searchs for a queue with the given name, if it exists, the queue is // used to create a new FD, return it and return true. If the queue doesn't // exist, return false and no error. An error is returned if creation fails. Get(ctx context.Context, name string, access AccessType, block bool, flags uint32) (*vfs.FileDescription, bool, error) // New creates a new inode and file description using the given queue, // inserts the inode into the filesystem tree using the given name, and // returns the file description. An error is returned if creation fails, or // if the name already exists. New(ctx context.Context, name string, q *Queue, access AccessType, block bool, perm linux.FileMode, flags uint32) (*vfs.FileDescription, error) // Unlink removes the queue with given name from the registry, and returns // an error if the name doesn't exist. Unlink(ctx context.Context, name string) error // Destroy destroys the registry. Destroy(context.Context) }
RegistryImpl defines utilities needed by a Registry to provide actual registry implementation. It works mainly as an abstraction layer used by Registry to avoid dealing directly with the filesystem. RegistryImpl should be implemented by mqfs and provided to Registry at initialization.
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
Subscriber represents a task registered for async notification from a Queue.
+stateify savable
type View ¶
type View interface { // Flush checks if the calling process has attached a notification request // to this queue, if yes, then the request is removed, and another process // can attach a request. Flush(ctx context.Context) waiter.Waitable }
View is a view into a message queue. Views should only be used in file descriptions, but not inodes, because we use inodes to retreive the actual queue, and only FDs are responsible for providing user functionality.