Serialize messages to permanent storage.
More...
|
LWMsgStatus | lwmsg_archive_new (const LWMsgContext *context, LWMsgProtocol *protocol, LWMsgArchive **archive) |
| Create new archive handle. More...
|
|
LWMsgStatus | lwmsg_archive_set_file (LWMsgArchive *archive, const char *filename, mode_t mode) |
| Set file name and parameters. More...
|
|
LWMsgStatus | lwmsg_archive_set_fd (LWMsgArchive *archive, int fd) |
| Set file descriptor. More...
|
|
LWMsgStatus | lwmsg_archive_set_byte_order (LWMsgArchive *archive, LWMsgByteOrder order) |
| Set byte order. More...
|
|
void | lwmsg_archive_set_protocol_update (LWMsgArchive *archive, LWMsgBool update) |
| Set protocol update flag. More...
|
|
LWMsgStatus | lwmsg_archive_open (LWMsgArchive *archive, LWMsgArchiveDisposition disp) |
| Open archive file. More...
|
|
LWMsgStatus | lwmsg_archive_close (LWMsgArchive *archive) |
| Close archive file. More...
|
|
LWMsgStatus | lwmsg_archive_write_message (LWMsgArchive *archive, LWMsgMessage *message) |
| Write message into archive. More...
|
|
LWMsgStatus | lwmsg_archive_read_message (LWMsgArchive *archive, LWMsgMessage *message) |
| Read next message from archive. More...
|
|
LWMsgStatus | lwmsg_archive_destroy_message (LWMsgArchive *archive, LWMsgMessage *message) |
| Destroy a message. More...
|
|
void | lwmsg_archive_delete (LWMsgArchive *archive) |
| Delete archive handle. More...
|
|
LWMsgAssoc * | lwmsg_archive_as_assoc (LWMsgArchive *archive) |
| View archive as an association. More...
|
|
A handle used to open, read, write, and close archive files.
Disposition used to open an archive file.
Enumerator |
---|
LWMSG_ARCHIVE_READ |
Open archive for reading
|
LWMSG_ARCHIVE_WRITE |
Open archive for writing
|
LWMSG_ARCHIVE_SCHEMA |
Use archive schema
|
Creates a new handle for reading and writing archive files for the specified protocol.
- Parameters
-
[in] | context | an optional context |
[in] | protocol | a protocol specifying the available messages to be read and written |
[out] | archive | the archive handle |
- Return values
-
Sets the archive file name and UNIX permissions for the given archive handle.
- Parameters
-
[in,out] | archive | the archive handle |
[in] | filename | the path to the archive file |
[in] | mode | the UNIX permissions used when creating a file that does not yet exist |
- Return values
-
Sets the file descriptor for the given archive handle.
- Parameters
-
[in,out] | archive | the archive handle |
[in] | fd | the file descriptor |
- Return values
-
Sets the preferred byte order for archive file creation. This only has an effect when creating new archives.
- Parameters
-
[in,out] | archive | the archive handle |
[in] | order | the byte order |
- Return values
-
Sets whether the protocol passed to lwmsg_archive_new() will be updated when schema information is read from an archive file. By default, the schema is merely checked against the protocol to ensure compatibility. If additional message types exist in the archive schema that are not in the protocol, opening the archive will fail as the application would be unable to handle these messages. If protocol updating is turned on, the protocol will instead be extended with the unknown message types and the open will succeed. This permanently modifies the protocol. The additional message types can be manipulated to a limited extent by the application with functions such as lwmsg_data_print_graph_alloc().
This only has an effect when an archive is opened for reading with the LWMSG_ARCHIVE_SCHEMA disposition bit set and the archive contains schema information.
- Parameters
-
[in,out] | archive | the archive handle |
[in] | update | whether to update the protocol or not |
Write a message into an open archive.
- Parameters
-
[in,out] | archive | the archive handle |
[in] | message | the message to write |
- Return values
-
Reads the next message from an open archive.
- Parameters
-
[in,out] | archive | the archive handle |
[out] | message | the read message |
- Return values
-
Frees all memory allocated for a message previously read from the given archive.
- Parameters
-
[in] | archive | the archive handle |
[in,out] | message | the message to destroy |
- Return values
-
Deletes the given archive handle.
- Parameters
-
[in,out] | archive | the archive handle |
Returns a "view" of the given archive handle as an association. The association may then be used as usual to "send" and "receive" messages, although some features (session, nonblocking operation) will not be available. Using lwmsg_assoc_delete() on the returned pointer is equivalent to deleting the archive handle.
- Parameters
-
[in] | archive | the archive handle |
- Returns
- a view of the archive as an association