blob: 182b8636d14362dd0f4324df264d699c36a34b11 [file] [log] [blame]
/*
* Copyright 2015 Webindex authors (see AUTHORS)
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package webindex.data;
import org.apache.fluo.api.config.FluoConfiguration;
import org.apache.fluo.api.config.ObserverConfiguration;
import org.apache.fluo.recipes.accumulo.export.AccumuloExport;
import org.apache.fluo.recipes.accumulo.export.AccumuloExporter;
import org.apache.fluo.recipes.accumulo.export.TableInfo;
import org.apache.fluo.recipes.core.export.ExportQueue;
import org.apache.fluo.recipes.kryo.KryoSimplerSerializer;
import webindex.data.fluo.DomainMap;
import webindex.data.fluo.PageObserver;
import webindex.data.fluo.UriMap;
import webindex.serialization.WebindexKryoFactory;
public class FluoApp {
public static final String EXPORT_QUEUE_ID = "eq";
public static void configureApplication(FluoConfiguration appConfig, TableInfo exportTable,
int numBuckets, int numTablets) {
appConfig.addObserver(new ObserverConfiguration(PageObserver.class.getName()));
KryoSimplerSerializer.setKryoFactory(appConfig, WebindexKryoFactory.class);
UriMap.configure(appConfig, numBuckets, numTablets);
DomainMap.configure(appConfig, numBuckets, numTablets);
ExportQueue.configure(appConfig, new ExportQueue.Options(EXPORT_QUEUE_ID,
AccumuloExporter.class.getName(), String.class.getName(), AccumuloExport.class.getName(),
numBuckets).setBucketsPerTablet(numBuckets / numTablets));
AccumuloExporter.setExportTableInfo(appConfig, EXPORT_QUEUE_ID, exportTable);
}
}