code: @InterfaceAudience.Public
      public boolean setMapReduce(Mapper mapBlock, Reducer reduceBlock, String version) {
          assert (mapBlock != null);
          assert (version != null);
          boolean changed = (this.version == null || !this.version.equals(version));
          this.mapBlock = mapBlock;
          this.reduceBlock = reduceBlock;
          this.version = version;
          viewStore.setVersion(version); // for SQLite
          return changed;
      }
docs: Defines a view's functions.
  <p/>
  The view's definition is given as a class that conforms to the Mapper or
  Reducer interface (or null to delete the view). The body of the block
  should call the 'emit' object (passed in as a paramter) for every key/value pair
  it wants to write to the view.
  <p/>
  Since the function itself is obviously not stored in the database (only a unique
  string idenfitying it), you must re-define the view on every launch of the app!
  If the database needs to rebuild the view but the function hasn't been defined yet,
  it will fail and the view will be empty, causing weird problems later on.
  <p/>
  It is very important that this block be a law-abiding map function! As in other
  languages, it must be a "pure" function, with no side effects, that always emits
  the same values given the same input document. That means that it should not access
  or change any external state; be careful, since callbacks make that so easy that you
  might do it inadvertently!  The callback may be called on any thread, or on
  multiple threads simultaneously. This won't be a problem if the code is "pure" as
  described above, since it will as a consequence also be thread-safe.