graph

package
v0.0.0-...-0a5fad8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a link or edge lookup fails
	ErrNotFound = errors.New("not found")

	// ErrUnknownEdgeLinks is returned when attempting to create an edge
	// with an invalid source and/or destination ID
	ErrUnknownEdgeLinks = errors.New("unknown source and/or destination for edge")
)

Functions

This section is empty.

Types

type Edge

type Edge struct {
	ID        uuid.UUID
	Src       uuid.UUID // the origin link.
	Dst       uuid.UUID // the destination link.
	UpdatedAt time.Time
}

type EdgeIterator

type EdgeIterator interface {
	Iterator
	Edge() *Edge
}

type Graph

type Graph interface {
	UpsertLink(link *Link) error
	FindLink(id uuid.UUID) (*Link, error)
	Links(fromID, toID uuid.UUID, retrievedBefore time.Time) (LinkIterator, error)
	UpsertEdge(edge *Edge) error
	Edges(fromID, toID uuid.UUID, updatedBefore time.Time) (EdgeIterator, error)
	RemoveStaleEdges(fromID uuid.UUID, updatedBefore time.Time) error
}

Graph is implemented by objects that can mutate or query a link graph

type Iterator

type Iterator interface {
	Next() bool
	Error() error
	Close() error
}

Iterator is implemented by graph objects that can be iterated

type Link struct {
	ID          uuid.UUID
	URL         string
	RetrievedAt time.Time
}

Link

type LinkIterator

type LinkIterator interface {
	Iterator
	Link() *Link
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL