@Override public Long getLength() { ensureDataLoaded(); return (long) this.data.length; }
private void ensureDataLoaded() { if (!isDataLoaded()) { this.data = streamingPropertyValueTableData(this.dataRowKey, this.timestamp); } }
@Override public List<InputStream> getInputStreams(List<StreamingPropertyValue> streamingPropertyValues) { List<StreamingPropertyValueTable> notLoadedTableSpvs = streamingPropertyValues.stream() .filter((spv) -> spv instanceof StreamingPropertyValueTable) .map((spv) -> (StreamingPropertyValueTable) spv) .filter((spv) -> !spv.isDataLoaded()) .collect(Collectors.toList()); List<String> dataRowKeys = notLoadedTableSpvs.stream() .map(StreamingPropertyValueTable::getDataRowKey) .collect(Collectors.toList()); Map<String, byte[]> tableInputStreams = streamingPropertyValueTableDatas(dataRowKeys); notLoadedTableSpvs .forEach((spv) -> { String dataRowKey = spv.getDataRowKey(); byte[] bytes = tableInputStreams.get(dataRowKey); if (bytes == null) { throw new VertexiumException("Could not find StreamingPropertyValue data: " + dataRowKey); } spv.setData(bytes); }); return streamingPropertyValues.stream() .map(StreamingPropertyValue::getInputStream) .collect(Collectors.toList()); }
StreamingPropertyValueTable(AccumuloGraph graph, String dataRowKey, StreamingPropertyValueTableRef valueRef, long timestamp) { super(valueRef.getValueType()); this.timestamp = timestamp; this.searchIndex(valueRef.isSearchIndex()); this.graph = graph; this.dataRowKey = dataRowKey; this.data = valueRef.getData(); }
@Override public StreamingPropertyValue toStreamingPropertyValue(AccumuloGraph graph, long timestamp) { return new StreamingPropertyValueTable(graph, getDataRowKey(), this, timestamp); } }
@Override public List<InputStream> getInputStreams(List<StreamingPropertyValue> streamingPropertyValues) { List<StreamingPropertyValueTable> notLoadedTableSpvs = streamingPropertyValues.stream() .filter((spv) -> spv instanceof StreamingPropertyValueTable) .map((spv) -> (StreamingPropertyValueTable) spv) .filter((spv) -> !spv.isDataLoaded()) .collect(Collectors.toList()); List<String> dataRowKeys = notLoadedTableSpvs.stream() .map(StreamingPropertyValueTable::getDataRowKey) .collect(Collectors.toList()); Map<String, byte[]> tableInputStreams = streamingPropertyValueTableDatas(dataRowKeys); notLoadedTableSpvs .forEach((spv) -> { String dataRowKey = spv.getDataRowKey(); byte[] bytes = tableInputStreams.get(dataRowKey); if (bytes == null) { throw new VertexiumException("Could not find StreamingPropertyValue data: " + dataRowKey); } spv.setData(bytes); }); return streamingPropertyValues.stream() .map(StreamingPropertyValue::getInputStream) .collect(Collectors.toList()); }
StreamingPropertyValueTable(AccumuloGraph graph, String dataRowKey, StreamingPropertyValueTableRef valueRef, long timestamp) { super(valueRef.getValueType()); this.timestamp = timestamp; this.searchIndex(valueRef.isSearchIndex()); this.graph = graph; this.dataRowKey = dataRowKey; this.data = valueRef.getData(); }
@Override public StreamingPropertyValue toStreamingPropertyValue(AccumuloGraph graph, long timestamp) { return new StreamingPropertyValueTable(graph, getDataRowKey(), this, timestamp); } }
private void ensureDataLoaded() { if (!isDataLoaded()) { this.data = streamingPropertyValueTableData(this.dataRowKey, this.timestamp); } }
@Override public Long getLength() { ensureDataLoaded(); return (long) this.data.length; }
@Override public InputStream getInputStream() { // we need to store the data here to handle the case that the mutation hasn't been flushed yet but the element is // passed to the search indexer to be indexed and we can't get the value yet. ensureDataLoaded(); return new ByteArrayInputStream(this.data); }
@Override public InputStream getInputStream() { // we need to store the data here to handle the case that the mutation hasn't been flushed yet but the element is // passed to the search indexer to be indexed and we can't get the value yet. ensureDataLoaded(); return new ByteArrayInputStream(this.data); }