@Override public void setConf(final Configuration config) { HadoopPoolsConfigurable.super.setConf(config); this.mrConf = ModifiableHadoopConfiguration.of(TitanHadoopConfiguration.MAPRED_NS, config); this.hadoopConf = config; this.titanConf = mrConf.getTitanGraphConf(); }
@Override public boolean nextKeyValue() throws IOException, InterruptedException { while (reader.nextKeyValue()) { // TODO titan05 integration -- the duplicate() call may be unnecessary final TinkerVertex maybeNullTinkerVertex = deser.readHadoopVertex(reader.getCurrentKey(), reader.getCurrentValue()); if (null != maybeNullTinkerVertex) { vertex = new VertexWritable(maybeNullTinkerVertex); //vertexQuery.filterRelationsOf(vertex); // TODO reimplement vertexquery filtering return true; } } return false; }
@Override public void write(NullWritable key, VertexWritable value) throws IOException, InterruptedException { // TODO tolerate possibility that concurrent OLTP activity has deleted the vertex? maybe configurable... Object vertexID = value.get().id(); Vertex vertex = tx.vertices(vertexID).next(); Iterator<VertexProperty<Object>> vpIter = value.get().properties(); while (vpIter.hasNext()) { VertexProperty<Object> vp = vpIter.next(); if (!persistableKeys.isEmpty() && !persistableKeys.contains(vp.key())) { log.debug("[vid {}] skipping key {}", vertexID, vp.key()); continue; } vertex.property(vp.key(), vp.value()); log.debug("[vid {}] set {}={}", vertexID, vp.key(), vp.value()); } }
@Override public default void setConf(final Configuration configuration) { HadoopPools.initialize(configuration); }
public static <A> ObjectWritable<A> empty() { return new ObjectWritable<>(null); }
public VertexWritable(final Vertex vertex) { this.set(vertex); }
@Override public ObjectWritable<A> zero(final ObjectWritable<A> a) { return ObjectWritable.empty(); } }
private void writeObject(final ObjectOutputStream outputStream) throws IOException { this.write(outputStream); }
public GryoPool getGryoPool() { return HadoopPools.getGryoPool(); }
@Override public void close() { HadoopPools.close(); }
@Override public List<String> ls() { return this.ls("/"); }
public static FileSystemStorage open(final FileSystem fileSystem) { return new FileSystemStorage(fileSystem); }
private void readObject(final ObjectInputStream inputStream) throws IOException, ClassNotFoundException { this.readFields(inputStream); }
private void writeObject(final ObjectOutputStream outputStream) throws IOException { this.write(outputStream); }
private void readObject(final ObjectInputStream inputStream) throws IOException, ClassNotFoundException { this.readFields(inputStream); }
@Override public void applyConfiguration(final Configuration configuration) { HadoopPools.initialize(configuration); }
@Override public <I extends InputShim> ObjectWritable<T> read(final KryoShim<I, ?> kryo, final I input, final Class<ObjectWritable<T>> clazz) { return new ObjectWritable(kryo.readClassAndObject(input)); } }