The C++ library for WebMapReduce attempts to efficiently emulate map-reduce behavior as provided by Hadoop. It is composed of two namespaces, and makes heavy use of std::string
. Much of the library is not intended to be exposed to users, and is reserved for background use in ensuring correct behavior. The key parts of the library that users should be familiar with are the public elements of wmr_common.h
and datastream.h
.
This library is designed such that users are only required to provied two pieces of code: the mapper
class and the reducer
class. These classes must fit the following template:
class mapper
{
public:
void map(std::string key, std::string value);
};
class reducer
{
public:
void reduce(std::string key, wmr::datastream values);
};
The classes may also have constructors and destructors, but the constructer cannot take arguments. Once these classes are provided, the library instantiates them, and calls the methods map
and reduce
. Users should note that they must explicitly include the wmr namespace (or fully qualify library types) to use library classes.
5.1.1. Namespace/Class View
namespacewmr
class datastream
class utility
namespaceinternal
class wmr_common
class key_value_stream
The wmr
namespace is intended to be exposed to users, while the internal namespace is meant to be used behind the scenes. Technically, users may access the internal namespace, but doing so may cause unexpected results.