| Maintainer | Toshio Ito <[email protected]> |
|---|---|
| Safe Haskell | None |
| Language | Haskell2010 |
NetSpider.Weaver
Description
Since: 0.4.2.0
Synopsis
- data Weaver n na la
- newWeaver :: FoundNodePolicy n na -> Weaver n na la
- addFoundNode :: (Eq n, Hashable n) => FoundNode n na la -> Weaver n na la -> Weaver n na la
- markAsVisited :: (Eq n, Hashable n) => n -> Weaver n na la -> Weaver n na la
- getSnapshot :: (Ord n, Hashable n, Show n) => LinkSampleUnifier n na fla sla -> Weaver n na fla -> SnapshotGraph n na sla
- getSnapshot' :: (Ord n, Hashable n, Show n) => LinkSampleUnifier n na fla sla -> Weaver n na fla -> (SnapshotGraph n na sla, [LogLine])
- isVisited :: (Eq n, Hashable n) => n -> Weaver n na la -> Bool
- getFoundNodes :: (Eq n, Hashable n) => n -> Weaver n na la -> Maybe [FoundNode n na la]
- getBoundaryNodes :: (Eq n, Hashable n) => Weaver n na fla -> [n]
- visitAllBoundaryNodes :: (Eq n, Hashable n) => Weaver n na fla -> Weaver n na fla
Type
Weaver is an on-memory builder for snapshot graphs. It builds a
SnapshotGraph from FoundNodes without using an external graph
database.
Construction
newWeaver :: FoundNodePolicy n na -> Weaver n na la Source #
Make a new Weaver.
The FoundNodePolicy controls the behavior of addFoundNode. If
it's policyOverwrite, Weaver maintains only the FoundNode
with the latest timestamp for each node. If it's policyAppend,
Weaver maintains all FoundNodes added.
Add FoundNode
addFoundNode :: (Eq n, Hashable n) => FoundNode n na la -> Weaver n na la -> Weaver n na la Source #
Query
getSnapshot :: (Ord n, Hashable n, Show n) => LinkSampleUnifier n na fla sla -> Weaver n na fla -> SnapshotGraph n na sla Source #
Make SnapshotGraph from the current Weaver.
The SnapshotGraph is constructed from all FoundNodes added to
the Weaver so far.
getSnapshot' :: (Ord n, Hashable n, Show n) => LinkSampleUnifier n na fla sla -> Weaver n na fla -> (SnapshotGraph n na sla, [LogLine]) Source #
Same as getSnapshot, but it also returns logs.
isVisited :: (Eq n, Hashable n) => n -> Weaver n na la -> Bool Source #
Returns True if the node ID is already visited in the Weaver.
A visited node is the one that has at least one FoundNode added,
or on which markAsVisited has executed.
getFoundNodes :: (Eq n, Hashable n) => n -> Weaver n na la -> Maybe [FoundNode n na la] Source #
Get the FoundNodes for the given node ID kept in Weaver.
It returns Nothing if the node ID is not visited. It returns an
empty list if the node ID is visited (by markAsVisited), but
doesn't have any FoundNode.
getBoundaryNodes :: (Eq n, Hashable n) => Weaver n na fla -> [n] Source #
Get boundary nodes from the Weaver.
A boundary node is a node that has been observed as a target of some links but not visited yet. This function returns the set of unique boundary nodes.
Misc.
visitAllBoundaryNodes :: (Eq n, Hashable n) => Weaver n na fla -> Weaver n na fla Source #
(Basically for testing): run markAsVisited on all boundary
nodes.