BusBoy  2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
BUSBOY::Dataset Class Reference

A Dataset is a bundle of conceptually related files and metadata. More...

#include <Dataset.h>

Public Member Functions

 Dataset ()
 
DataFilegetDataFile (const DataKey &key) const
 
RandomAccessFilegetDataFileForRandomAccess (const DataKey &key) const
 Same as getDataFile, but a copy of the file has been staged on local disk to allow random access. More...
 
void addDataFile (const DataKey &key, DataFile *file)
 Associates a key to a file. More...
 
WritableRandomAccessFileaddDataFileForRandomAccess (const DataKey &key, DataFile *file)
 Same as addDataFile with no content in the file. More...
 
bool hasDataFile (const DataKey &key) const
 
std::set< DataKeygetAllFileKeys () const
 
MetadataMapgetMetadata (const DataKey &key) const
 
void addMetadata (const DataKey &key, MetadataMap *meta)
 Associates a key to a metadata map. More...
 
bool hasMetadata (const DataKey &key) const
 
std::set< DataKeygetAllMetadataKeys () const
 
void release ()
 
void setContext (DatasetContext *context)
 For use by the framework. More...
 
void setGlobalKeyspace (const Keyspace &keyspace)
 For use by the framework. More...
 
std::string getDataFileName (const DataKey &key) const
 Tries to get the name of the data file. More...
 
const KeyspacegetKeyspace () const
 Returns the keyspace containing all the elements found in this dataset. More...
 
const KeyspacegetFilesKeyspace () const
 Returns the keyspace containing all the elements found in file keys of this dataset. More...
 
const KeyspacegetMetadataKeyspace () const
 Returns the keyspace containing all the elements found in metadata keys of this dataset. More...
 
void generateKeyspaces ()
 This will overwrite any keyspaces already in this object. More...
 
bool isQueryOnly ()
 
bool operator== (const Dataset &dataset) const
 
bool operator!= (const Dataset &dataset) const
 
 ~Dataset ()
 

Static Public Member Functions

static void copySourceToSink (std::shared_ptr< DataFileSource > src, DataFileSink *sink)
 

Detailed Description

A Dataset is a bundle of conceptually related files and metadata.

It consists of two maps:

Each key may have at most one file, and at most one metadata map. The metadata map is the root of a metadata structure of arbitrary complexity. To associate multiple metadata elements to a key, just add them to the map.

Constructor & Destructor Documentation

BUSBOY::Dataset::Dataset ( )
BUSBOY::Dataset::~Dataset ( )

Member Function Documentation

void BUSBOY::Dataset::addDataFile ( const DataKey key,
DataFile file 
)

Associates a key to a file.

The file must be allocated on the heap with new. This class takes ownership of the file object. The file object should not be associated to any other key. An exception will be thrown if this key already has a file. If the file has content, this dataset will attempt to write the file to storage. If the write succeeds, the dataset will call release() on the file.

WritableRandomAccessFile * BUSBOY::Dataset::addDataFileForRandomAccess ( const DataKey key,
DataFile file 
)

Same as addDataFile with no content in the file.

Instead of doing chunked writing, the returned WritableRandomAccessFile can be used to do the write with more flexibility. The cost is that the file must be staged on local disk, and then copied after the write is completed.

void BUSBOY::Dataset::addMetadata ( const DataKey key,
MetadataMap meta 
)

Associates a key to a metadata map.

The map must be allocated on the heap with new. This class takes ownership of the metadata object. The map object should not be associated to any other key. An exception will be thrown if this key already has metadata.

void BUSBOY::Dataset::copySourceToSink ( std::shared_ptr< DataFileSource src,
DataFileSink sink 
)
static
void BUSBOY::Dataset::generateKeyspaces ( )

This will overwrite any keyspaces already in this object.

std::set< DataKey > BUSBOY::Dataset::getAllFileKeys ( ) const
std::set< DataKey > BUSBOY::Dataset::getAllMetadataKeys ( ) const
DataFile * BUSBOY::Dataset::getDataFile ( const DataKey key) const
RandomAccessFile * BUSBOY::Dataset::getDataFileForRandomAccess ( const DataKey key) const

Same as getDataFile, but a copy of the file has been staged on local disk to allow random access.

std::string BUSBOY::Dataset::getDataFileName ( const DataKey key) const

Tries to get the name of the data file.

Returns
empty string if the name is not available
const Keyspace & BUSBOY::Dataset::getFilesKeyspace ( ) const

Returns the keyspace containing all the elements found in file keys of this dataset.

Return value is a reference valid for the lifetime of this object.

const Keyspace & BUSBOY::Dataset::getKeyspace ( ) const

Returns the keyspace containing all the elements found in this dataset.

Return value is a reference valid for the lifetime of this object.

MetadataMap * BUSBOY::Dataset::getMetadata ( const DataKey key) const
const Keyspace & BUSBOY::Dataset::getMetadataKeyspace ( ) const

Returns the keyspace containing all the elements found in metadata keys of this dataset.

Return value is a reference valid for the lifetime of this object.

bool BUSBOY::Dataset::hasDataFile ( const DataKey key) const
bool BUSBOY::Dataset::hasMetadata ( const DataKey key) const
bool BUSBOY::Dataset::isQueryOnly ( )
bool BUSBOY::Dataset::operator!= ( const Dataset dataset) const
bool BUSBOY::Dataset::operator== ( const Dataset dataset) const
void BUSBOY::Dataset::release ( )
void BUSBOY::Dataset::setContext ( DatasetContext context)

For use by the framework.

void BUSBOY::Dataset::setGlobalKeyspace ( const Keyspace keyspace)

For use by the framework.


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

Copyright 2014 Google Inc. All rights reserved.