Documentation ¶
Overview ¶
Package graph derives trust/block relations by consuming type:contact message and offers lookup APIs between two feeds.
Index ¶
- func NewLogBuilder(logger kitlog.Logger, contacts margaret.Log) (*logBuilder, error)
- type BadgerBuilder
- func (b *BadgerBuilder) Authorizer(from refs.FeedRef, maxHops int) ssb.Authorizer
- func (b *BadgerBuilder) Build() (*Graph, error)
- func (b *BadgerBuilder) DeleteAuthor(who refs.FeedRef) error
- func (b *BadgerBuilder) DumpXMLOverHTTP(self refs.FeedRef, w http.ResponseWriter, req *http.Request)
- func (b *BadgerBuilder) Follows(forRef refs.FeedRef) (*ssb.StrFeedSet, error)
- func (b *BadgerBuilder) Hops(from refs.FeedRef, max int) *ssb.StrFeedSet
- func (b *BadgerBuilder) OpenContactsIndex() (librarian.SeqSetterIndex, librarian.SinkIndex)
- func (b *BadgerBuilder) OpenMetafeedsIndex() (librarian.SeqSetterIndex, librarian.SinkIndex)
- func (b *BadgerBuilder) Subfeeds(forRef refs.FeedRef) (*ssb.StrFeedSet, error)
- type Builder
- type ErrNoSuchFrom
- type Graph
- func (g *Graph) Attributes() []encoding.Attribute
- func (g *Graph) BlockedList(from refs.FeedRef) *ssb.StrFeedSet
- func (g *Graph) Blocks(from, to refs.FeedRef) bool
- func (g *Graph) Follows(from, to refs.FeedRef) bool
- func (g *Graph) MakeDijkstra(from refs.FeedRef) (*Lookup, error)
- func (g *Graph) NodeCount() int
- func (g *Graph) RenderSVG(w io.Writer) error
- func (g *Graph) RenderSVGToFile(path string) error
- func (g *Graph) Subfeed(from, to refs.FeedRef) bool
- type IndexingBuilder
- type Lookup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLogBuilder ¶
NewLogBuilder is a much nicer abstraction than the direct k:v implementation. most likely terribly slow though. Additionally, we have to unmarshal from stored.Raw again... TODO: actually compare the two with benchmarks if only to compare the 3rd!
Types ¶
type BadgerBuilder ¶ added in v0.2.1
type BadgerBuilder struct {
// contains filtered or unexported fields
}
BadgerBuilder can construct a graph from the badger key-value database it was initialized with.
func NewBuilder ¶
func NewBuilder(log log.Logger, db *badger.DB, hmacSecret *[32]byte) *BadgerBuilder
NewBuilder creates a Builder that is backed by a badger database
func (*BadgerBuilder) Authorizer ¶ added in v0.2.1
func (b *BadgerBuilder) Authorizer(from refs.FeedRef, maxHops int) ssb.Authorizer
func (*BadgerBuilder) Build ¶ added in v0.2.1
func (b *BadgerBuilder) Build() (*Graph, error)
func (*BadgerBuilder) DeleteAuthor ¶ added in v0.2.1
func (b *BadgerBuilder) DeleteAuthor(who refs.FeedRef) error
func (*BadgerBuilder) DumpXMLOverHTTP ¶ added in v0.2.1
func (b *BadgerBuilder) DumpXMLOverHTTP(self refs.FeedRef, w http.ResponseWriter, req *http.Request)
func (*BadgerBuilder) Follows ¶ added in v0.2.1
func (b *BadgerBuilder) Follows(forRef refs.FeedRef) (*ssb.StrFeedSet, error)
func (*BadgerBuilder) Hops ¶ added in v0.2.1
func (b *BadgerBuilder) Hops(from refs.FeedRef, max int) *ssb.StrFeedSet
Hops returns a slice of feed refrences that are in a particulare range of from max == 0: only direct follows of from max == 1: max:0 + follows of friends of from max == 2: max:1 + follows of their friends
func (*BadgerBuilder) OpenContactsIndex ¶ added in v0.2.1
func (b *BadgerBuilder) OpenContactsIndex() (librarian.SeqSetterIndex, librarian.SinkIndex)
func (*BadgerBuilder) OpenMetafeedsIndex ¶ added in v0.2.1
func (b *BadgerBuilder) OpenMetafeedsIndex() (librarian.SeqSetterIndex, librarian.SinkIndex)
func (*BadgerBuilder) Subfeeds ¶ added in v0.2.1
func (b *BadgerBuilder) Subfeeds(forRef refs.FeedRef) (*ssb.StrFeedSet, error)
type Builder ¶
type Builder interface { // Build a complete graph of all follow/block relations Build() (*Graph, error) // Follows returns a set of all people ref follows Follows(refs.FeedRef) (*ssb.StrFeedSet, error) // TODO: move this into the graph Hops(refs.FeedRef, int) *ssb.StrFeedSet Authorizer(from refs.FeedRef, maxHops int) ssb.Authorizer DeleteAuthor(who refs.FeedRef) error }
Builder can build a trust graph and answer other questions
type ErrNoSuchFrom ¶
ErrNoSuchFrom should only happen if you reconstruct your existing log from the network
func (ErrNoSuchFrom) Error ¶
func (nsf ErrNoSuchFrom) Error() string
type Graph ¶
type Graph struct { sync.Mutex *simple.WeightedDirectedGraph // contains filtered or unexported fields }
func (*Graph) Attributes ¶
func (*Graph) BlockedList ¶
func (g *Graph) BlockedList(from refs.FeedRef) *ssb.StrFeedSet
func (*Graph) RenderSVGToFile ¶
type IndexingBuilder ¶
type IndexingBuilder interface { Builder OpenIndex() (librarian.SeqSetterIndex, librarian.SinkIndex) }