# ``twisted`.`mail`.`maildir`.`_MaildirMailboxAppendMessageTask``

class documentation

`class _MaildirMailboxAppendMessageTask: (source)`

Implements interfaces: `twisted.internet.interfaces.IConsumer`

View In Hierarchy

A task which adds a message to a maildir mailbox.

Method | `__init__` |
Method | `createTempFile` | Create a temporary file to hold the message as it is being transferred.
Method | `fail` | Fire the deferred to indicate the task completed with a failure.
Method | `moveFileToNew` | Place the message in the new/ directory, add it to the mailbox and fire the deferred to indicate that the task has completed successfully.
Method | `prodProducer` | Repeatedly prod a non-streaming producer to produce data.
Method | `registerProducer` | Register a producer and start asking it for data if it is non-streaming.
Method | `startUp` | Start transferring the message to the mailbox.
Method | `unregisterProducer` | Finish transferring the message to the mailbox.
Method | `write` | Write data to the maildir file.
Class Variable | `osclose` | Undocumented
Class Variable | `osopen` | Undocumented
Class Variable | `osrename` | Undocumented
Class Variable | `oswrite` | Undocumented
Instance Variable | `defer` | A deferred which fires when the task has completed.
Instance Variable | `fh` | The new maildir file.
Instance Variable | `filesender` | A file sender which sends the message.
Instance Variable | `mbox` | See `__init__`.
Instance Variable | `msg` | The message to add.
Instance Variable | `myproducer` | The registered producer.
Instance Variable | `opencall` | A scheduled call to `prodProducer`.
Instance Variable | `openCall` | Undocumented
Instance Variable | `streaming` | Indicates whether the registered producer provides a streaming interface.
Instance Variable | `tmpname` | The pathname of the temporary file holding the message while it is being transferred.

def __init__(self, mbox, msg): (source)

Parameters
mbox:`MaildirMailbox` | A maildir mailbox.
msg:`bytes` or file-like object | The message to add.

def createTempFile(self): (source)
Create a temporary file to hold the message as it is being transferred.
def fail(self, err=None): (source)
Fire the deferred to indicate the task completed with a failure.

Parameters
err:`Failure` | The error that occurred.

def moveFileToNew(self): (source)
Place the message in the new/ directory, add it to the mailbox and fire the deferred to indicate that the task has completed successfully.
def prodProducer(self): (source)
Repeatedly prod a non-streaming producer to produce data.
def registerProducer(self, producer, streaming): (source)
from `twisted.internet.interfaces.IConsumer`
Register a producer and start asking it for data if it is non-streaming.

Parameters
producer:`IProducer` | A producer.
streaming:`bool` | A flag indicating whether the producer provides a streaming interface.

def startUp(self): (source)
Start transferring the message to the mailbox.
def unregisterProducer(self): (source)
from `twisted.internet.interfaces.IConsumer`
Finish transferring the message to the mailbox.
def write(self, data): (source)
from `twisted.internet.interfaces.IConsumer`
Write data to the maildir file.

Parameters
data:`bytes` | Data to be written to the file.

osclose = (source)

Undocumented

osopen = (source)

Undocumented

osrename = (source)

Undocumented

oswrite = (source)

Undocumented

defer: `Deferred` which successfully returns `None` = (source)
A deferred which fires when the task has completed.
fh: file = (source)
The new maildir file.
filesender: `FileSender` = (source)
A file sender which sends the message.
mbox = (source)
See `__init__`.
msg: file-like object = (source)
The message to add.
myproducer: `IProducer` = (source)
The registered producer.
opencall: `IDelayedCall` provider or `None` = (source)
A scheduled call to `prodProducer`.
openCall = (source)

Undocumented

streaming: `bool` = (source)
Indicates whether the registered producer provides a streaming interface.
tmpname: `bytes` = (source)
The pathname of the temporary file holding the message while it is being transferred.