graph

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrMissingID = errors.Error("missing id")
	ErrInternal  = errors.Error("internal error")
	ErrExists    = errors.Error("already exists")
	ErrNotFound  = errors.Error("not found")
)

Variables

This section is empty.

Functions

func Dot

func Dot(objects []*object.Object) (string, error)

Dot returns a graphviz representation of a graph

Types

type Cayley

type Cayley struct {
	// contains filtered or unexported fields
}

Cayley object store

func (*Cayley) Children

func (s *Cayley) Children(hash string) ([]*object.Object, error)

Children returns the all the children of an object, sorted

func (*Cayley) Dump

func (s *Cayley) Dump() ([]graphObject, error)

Dump returns all objects

func (*Cayley) Get

func (s *Cayley) Get(hash string) (*object.Object, error)

Get returns an object given its hash

func (*Cayley) Graph

func (s *Cayley) Graph(hash string) ([]*object.Object, error)

Graph returns all objects in a graph given the hash of of its objects

func (*Cayley) Head

func (s *Cayley) Head(hash string) (*object.Object, error)

Head returns the root object given another object in the graph.

func (*Cayley) Heads

func (s *Cayley) Heads() ([]*object.Object, error)

Heads returns all the objects that do not have any parents

func (*Cayley) Put

func (s *Cayley) Put(v *object.Object) error

Put an object in the store

func (*Cayley) Tails

func (s *Cayley) Tails(hash string) ([]*object.Object, error)

Tails returns all the leaf nodes starting from an object

type Store

type Store interface {
	Put(*object.Object) error
	Get(string) (*object.Object, error)
	Graph(string) ([]*object.Object, error)
	Children(string) ([]*object.Object, error)
	Head(string) (*object.Object, error)
	Heads() ([]*object.Object, error)
	Tails(string) ([]*object.Object, error)
}

Store interface

func NewCayley

func NewCayley(store *cayley.Handle) Store

NewCayley constructs a new object store given a quad store

func NewCayleyWithTempStore

func NewCayleyWithTempStore() (Store, error)

NewCayleyWithTempStore constructs a new object store with a temp bolt store NOTE: Cayley's in-memory store is not thread safe, please don't use it to replace this.

Jump to

Keyboard shortcuts

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