public class NFCompressedGraph extends NFGraph
NFGraph. The connections for all nodes in the graph
are encoded into a single byte array. The encoding for each set will be specified as either a CompactOrdinalSet or
HashSetOrdinalSet. If it is more efficient, the actual encoding will be a BitSetOrdinalSet.
The offsets into the byte array where connections for each node are encoded are held in the NFCompressedGraphPointers.
graphSpec, modelHolder| Constructor and Description |
|---|
NFCompressedGraph(NFGraphSpec spec,
com.netflix.nfgraph.NFGraphModelHolder modelHolder,
com.netflix.nfgraph.util.ByteData data,
long dataLength,
com.netflix.nfgraph.compressed.NFCompressedGraphPointers pointers) |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
When using a
ByteSegmentPool, this method will return all borrowed arrays back to that pool. |
protected int |
getConnection(int connectionModelIndex,
java.lang.String nodeType,
int ordinal,
java.lang.String propertyName) |
protected OrdinalIterator |
getConnectionIterator(int connectionModelIndex,
java.lang.String nodeType,
int ordinal,
java.lang.String propertyName) |
protected OrdinalSet |
getConnectionSet(int connectionModelIndex,
java.lang.String nodeType,
int ordinal,
java.lang.String propertyName) |
static NFCompressedGraph |
readFrom(java.io.InputStream is) |
static NFCompressedGraph |
readFrom(java.io.InputStream is,
com.netflix.nfgraph.util.ByteSegmentPool memoryPool)
When using a
ByteSegmentPool, this method will borrow arrays used to construct the NFCompressedGraph from that pool. |
void |
writeTo(java.io.OutputStream os) |
getConnection, getConnection, getConnectionIterator, getConnectionIterator, getConnectionSet, getConnectionSetpublic NFCompressedGraph(NFGraphSpec spec, com.netflix.nfgraph.NFGraphModelHolder modelHolder, com.netflix.nfgraph.util.ByteData data, long dataLength, com.netflix.nfgraph.compressed.NFCompressedGraphPointers pointers)
protected int getConnection(int connectionModelIndex,
java.lang.String nodeType,
int ordinal,
java.lang.String propertyName)
getConnection in class NFGraphprotected OrdinalSet getConnectionSet(int connectionModelIndex, java.lang.String nodeType, int ordinal, java.lang.String propertyName)
getConnectionSet in class NFGraphprotected OrdinalIterator getConnectionIterator(int connectionModelIndex, java.lang.String nodeType, int ordinal, java.lang.String propertyName)
getConnectionIterator in class NFGraphpublic void writeTo(java.io.OutputStream os)
throws java.io.IOException
java.io.IOExceptionpublic static NFCompressedGraph readFrom(java.io.InputStream is) throws java.io.IOException
java.io.IOExceptionpublic static NFCompressedGraph readFrom(java.io.InputStream is, com.netflix.nfgraph.util.ByteSegmentPool memoryPool) throws java.io.IOException
ByteSegmentPool, this method will borrow arrays used to construct the NFCompressedGraph from that pool.
Note that because the ByteSegmentPool is NOT thread-safe, this this call is also NOT thread-safe.
It is up to implementations to ensure that only a single update thread
is accessing this memory pool at any given time.
java.io.IOExceptionpublic void destroy()
ByteSegmentPool, this method will return all borrowed arrays back to that pool.
Note that because the ByteSegmentPool is NOT thread-safe, this this call is also NOT thread-safe.
It is up to implementations to ensure that only a single update thread
is accessing this memory pool at any given time.