proxygen
folly::RecordIOReader Class Reference

#include <RecordIO.h>

Classes

class  Iterator
 

Public Types

typedef Iterator iterator
 
typedef Iterator const_iterator
 
typedef std::pair< ByteRange, off_t > value_type
 
typedef value_typereference
 
typedef const value_typeconst_reference
 

Public Member Functions

 RecordIOReader (File file, uint32_t fileId=0)
 
Iterator cbegin () const
 
Iterator begin () const
 
Iterator cend () const
 
Iterator end () const
 
Iterator seek (off_t pos) const
 

Private Attributes

MemoryMapping map_
 
uint32_t fileId_
 

Detailed Description

Class to read from a RecordIO file. Will skip invalid records.

Definition at line 86 of file RecordIO.h.

Member Typedef Documentation

Definition at line 97 of file RecordIO.h.

Definition at line 100 of file RecordIO.h.

RecordIOReader is iterable, returning pairs of ByteRange (record content) and position in file where the record (including header) begins. Note that the position includes the header, that is, it can be passed back to seek().

Definition at line 88 of file RecordIO.h.

Definition at line 99 of file RecordIO.h.

typedef std::pair<ByteRange, off_t> folly::RecordIOReader::value_type

Definition at line 98 of file RecordIO.h.

Constructor & Destructor Documentation

folly::RecordIOReader::RecordIOReader ( File  file,
uint32_t  fileId = 0 
)
explicit

A record reader with a fileId of 0 will return all records. A record reader with a non-zero fileId will only return records where the fileId matches.

Definition at line 72 of file RecordIO.cpp.

73  : map_(std::move(file)), fileId_(fileId) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
MemoryMapping map_
Definition: RecordIO.h:120

Member Function Documentation

auto folly::RecordIOReader::begin ( ) const
inline

Definition at line 60 of file RecordIO-inl.h.

References cbegin().

Referenced by folly::test::TEST().

60  {
61  return cbegin();
62 }
Iterator cbegin() const
Definition: RecordIO-inl.h:57
auto folly::RecordIOReader::cbegin ( ) const
inline

Definition at line 57 of file RecordIO-inl.h.

References seek().

Referenced by begin().

57  {
58  return seek(0);
59 }
Iterator seek(off_t pos) const
Definition: RecordIO-inl.h:69
auto folly::RecordIOReader::cend ( ) const
inline

Definition at line 63 of file RecordIO-inl.h.

References seek().

Referenced by end().

63  {
64  return seek(off_t(-1));
65 }
Iterator seek(off_t pos) const
Definition: RecordIO-inl.h:69
auto folly::RecordIOReader::end ( ) const
inline

Definition at line 66 of file RecordIO-inl.h.

References cend().

Referenced by folly::recordio_helpers::findRecord(), and folly::test::TEST().

66  {
67  return cend();
68 }
Iterator cend() const
Definition: RecordIO-inl.h:63
auto folly::RecordIOReader::seek ( off_t  pos) const
inline

Create an iterator to the first valid record after pos.

Definition at line 69 of file RecordIO-inl.h.

References folly::RecordIOReader::Iterator::fileId_, folly::RecordIOReader::Iterator::Iterator(), map_, and folly::MemoryMapping::range().

Referenced by cbegin(), and cend().

69  {
70  return Iterator(map_.range(), fileId_, pos);
71 }
MemoryMapping map_
Definition: RecordIO.h:120
ByteRange range() const

Member Data Documentation

uint32_t folly::RecordIOReader::fileId_
private

Definition at line 121 of file RecordIO.h.

MemoryMapping folly::RecordIOReader::map_
private

Definition at line 120 of file RecordIO.h.

Referenced by seek().


The documentation for this class was generated from the following files: