mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 06:44:16 +01:00
1f796663cd
This was a tricky merge. In the 1332a directory I did: {{{ svn merge https://svn.tokutek.com/tokudb/toku/tokudb.1032b+1332@8415 https://svn.tokutek.com/tokudb/toku/tokudb.1032b+1332@8416 }}} Then I was able to resolve the conflicts. Then in the main line I did: {{{ svn merge -r9042:9046 https://svn.tokutek.com/tokudb/toku/tokudb.1332a }}} Fixes #1332. git-svn-id: file:///svn/toku/tokudb@9047 c7de825b-a66e-492c-adef-691d508d4ae1
27 lines
1.2 KiB
C
27 lines
1.2 KiB
C
#ifndef BREAD_H
|
|
#define BREAD_H
|
|
|
|
// A BREAD reads a file backwards using buffered I/O. BREAD stands for Buffered Read or Backwards Read.
|
|
// Conceivably, we could read forward too.
|
|
// The buffered I/O is buffered using a large buffer (e.g., something like a megabyte).
|
|
// Furthermore, data is compressed into blocks. Each block is a 4-byte compressed length (in network order), followed by compressed data, followed by a 4-byte uncompressed-length (in network order), followed by a 4-byte compressed length
|
|
// The compressed-length appears twice so that the file can be read backward or forward.
|
|
// If not for the large-buffer requirement, as well as compression, as well as reading backward, we could have used a FILE.
|
|
|
|
#include <sys/types.h>
|
|
typedef struct bread *BREAD;
|
|
|
|
BREAD create_bread_from_fd_initialize_at(int fd);
|
|
// Effect: Given a file descriptor, fd, create a BREAD.
|
|
// Requires: The fd must be an open fd.
|
|
|
|
int close_bread_without_closing_fd(BREAD);
|
|
// Effect: Close the BREAD, but don't close the underlying fd.
|
|
|
|
ssize_t bread_backwards(BREAD, void *buf, size_t nbytes);
|
|
// Read nbytes into buf, reading backwards.
|
|
|
|
int bread_has_more(BREAD);
|
|
// Is there more to read?
|
|
|
|
#endif
|