public final class SegmentGraph extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SegmentGraph.Graph<T>
A simple graph representation for a graph with node of type
T . |
static interface |
SegmentGraph.SegmentGraphVisitor
Visitor for receiving call backs while traversing the
segment graph.
|
Modifier and Type | Method and Description |
---|---|
static com.google.common.base.Predicate<UUID> |
createRegExpFilter(String pattern,
SegmentStore store)
Create a regular expression based inclusion filter for segment.
|
static SegmentGraph.Graph<String> |
parseGCGraph(FileStore.ReadOnlyStore fileStore)
Parse the gc generation graph of a file store.
|
static SegmentGraph.Graph<UUID> |
parseHeadGraph(SegmentReader reader,
RecordId root)
Parser the head graph of segment store.
|
static SegmentGraph.Graph<UUID> |
parseSegmentGraph(FileStore.ReadOnlyStore fileStore,
com.google.common.base.Predicate<UUID> filter)
Parse the segment graph of a file store.
|
static <T> SegmentGraph.Graph<T> |
parseSegmentGraph(FileStore.ReadOnlyStore fileStore,
Set<UUID> roots,
com.google.common.base.Predicate<UUID> filter,
com.google.common.base.Function<UUID,T> map)
Parse the segment graph of a file store starting with a given set of root segments.
|
static void |
writeGCGraph(FileStore.ReadOnlyStore fileStore,
OutputStream out)
Write the gc generation graph of a file store to a stream.
|
static void |
writeSegmentGraph(FileStore.ReadOnlyStore fileStore,
OutputStream out,
Date epoch,
String pattern)
Write the segment graph of a file store to a stream.
|
public static void writeSegmentGraph(@Nonnull FileStore.ReadOnlyStore fileStore, @Nonnull OutputStream out, @Nonnull Date epoch, @CheckForNull String pattern) throws Exception
The graph is written in
the Guess GDF format,
which is easily imported into Gephi.
As GDF only supports integers but the segment time stamps are encoded as long
the epoch
argument is used as a negative offset translating all timestamps
into a valid int range.
fileStore
- file store to graphout
- stream to write the graph toepoch
- epoch (in milliseconds)pattern
- regular expression specifying inclusion of nodes or null
for all nodes.Exception
public static com.google.common.base.Predicate<UUID> createRegExpFilter(@Nonnull String pattern, @Nonnull SegmentStore store)
pattern
- regular expression specifying inclusion of nodes.store
- the segment store acting upon.@Nonnull public static SegmentGraph.Graph<UUID> parseSegmentGraph(@Nonnull FileStore.ReadOnlyStore fileStore, @Nonnull com.google.common.base.Predicate<UUID> filter) throws IOException
fileStore
- file store to parsefilter
- inclusion criteria for vertices and edges. An edge is only included if
both its source and target vertex are included.fileStore
.IOException
public static void writeGCGraph(@Nonnull FileStore.ReadOnlyStore fileStore, @Nonnull OutputStream out) throws Exception
The graph is written in the Guess GDF format, which is easily imported into Gephi.
fileStore
- file store to graphout
- stream to write the graph toException
@Nonnull public static SegmentGraph.Graph<String> parseGCGraph(@Nonnull FileStore.ReadOnlyStore fileStore) throws IOException
fileStore
- file store to parsefileStore
.IOException
@Nonnull public static <T> SegmentGraph.Graph<T> parseSegmentGraph(@Nonnull FileStore.ReadOnlyStore fileStore, @Nonnull Set<UUID> roots, @Nonnull com.google.common.base.Predicate<UUID> filter, @Nonnull com.google.common.base.Function<UUID,T> map) throws IOException
map
to the
graph returned by this function.fileStore
- file store to parseroots
- the initial set of segmentsmap
- map defining an homomorphism from the segment graph into the returned graphfilter
- inclusion criteria for vertices and edges. An edge is only included if
both its source and target vertex are included.fileStore
rooted at roots
and mapped
by map
IOException
@Nonnull public static SegmentGraph.Graph<UUID> parseHeadGraph(@Nonnull SegmentReader reader, @Nonnull RecordId root)
root
.reader
- segment reader for the store to parseroot
- root
.Copyright © 2012-2016 The Apache Software Foundation. All Rights Reserved.