mariadb/newbrt/bread.h
Rich Prohaska fbfd0476ba more merging of 1032 to 1032b. addresses #1032
git-svn-id: file:///svn/toku/tokudb.1032b@7779 c7de825b-a66e-492c-adef-691d508d4ae1
2013-04-16 23:57:27 -04:00

25 lines
923 B
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).
// If not for the large-buffer requirement, we could have used a FILE.
#include <sys/types.h>
typedef struct bread *BREAD;
BREAD create_bread_from_fd_initialize_at(int fd, toku_off_t filesize, size_t bufsize);
// Effect: Given a file descriptor, fd, that points at a file of size filesize, create a BREAD.
// Requires: The filesize must be correct. 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