BusBoy
2
|
A Dataset is a bundle of conceptually related files and metadata. More...
#include <Dataset.h>
Public Member Functions | |
Dataset () | |
DataFile * | getDataFile (const DataKey &key) const |
RandomAccessFile * | getDataFileForRandomAccess (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... | |
WritableRandomAccessFile * | addDataFileForRandomAccess (const DataKey &key, DataFile *file) |
Same as addDataFile with no content in the file. More... | |
bool | hasDataFile (const DataKey &key) const |
std::set< DataKey > | getAllFileKeys () const |
MetadataMap * | getMetadata (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< DataKey > | getAllMetadataKeys () 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 Keyspace & | getKeyspace () const |
Returns the keyspace containing all the elements found in this dataset. More... | |
const Keyspace & | getFilesKeyspace () const |
Returns the keyspace containing all the elements found in file keys of this dataset. More... | |
const Keyspace & | getMetadataKeyspace () 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) |
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.
BUSBOY::Dataset::Dataset | ( | ) |
BUSBOY::Dataset::~Dataset | ( | ) |
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.
|
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 |
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.
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.
Copyright 2014 Google Inc. All rights reserved.