graphstore

package
v0.0.0-...-7b96089 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeserializeNode

func DeserializeNode(uuid psi.NodeID, data []byte) (psi.Node, error)

func SerializeGraph

func SerializeGraph(g psi.Graph) ([]byte, error)

func SerializeNode

func SerializeNode(n psi.Node) ([]byte, cid.Cid, error)

Types

type FrozenEdge

type FrozenEdge struct {
	Cid cidlink.Link `json:"cid,omitempty"`

	Key psi.EdgeKey `json:"key"`

	From psi.NodeID `json:"from"`
	To   psi.NodeID `json:"to"`

	Attributes map[string]interface{} `json:"attr,omitempty"`
}

type FrozenGraph

type FrozenGraph struct {
	Nodes []*FrozenNode
	Edges []*FrozenEdge
}

func FreezeGraph

func FreezeGraph(g psi.Graph) (*FrozenGraph, error)

type FrozenNode

type FrozenNode struct {
	Cid cidlink.Link `json:"cid,omitempty"`

	Index   int64 `json:"index"`
	Version int64 `json:"version"`

	UUID psi.NodeID   `json:"uuid"`
	Type psi.NodeType `json:"type"`

	Attributes map[string]interface{} `json:"attr,omitempty"`
}

type IndexedGraph

type IndexedGraph struct {
	psi.BaseGraph
	// contains filtered or unexported fields
}

func NewIndexedGraph

func NewIndexedGraph(ctx context.Context, ds datastore.Batching, root psi.Node) *IndexedGraph

func (*IndexedGraph) Add

func (g *IndexedGraph) Add(n psi.Node)

func (*IndexedGraph) GetNodeByID

func (g *IndexedGraph) GetNodeByID(id psi.NodeID) (psi.Node, error)

func (*IndexedGraph) GetNodeChildren

func (g *IndexedGraph) GetNodeChildren(path psi.Path) (result []psi.Path, err error)

func (*IndexedGraph) OnNodeInvalidated

func (g *IndexedGraph) OnNodeInvalidated(n psi.Node)

func (*IndexedGraph) OnNodeUpdated

func (g *IndexedGraph) OnNodeUpdated(n psi.Node)

func (*IndexedGraph) Remove

func (g *IndexedGraph) Remove(n psi.Node)

func (*IndexedGraph) ResolveNode

func (g *IndexedGraph) ResolveNode(path psi.Path) (n psi.Node, err error)

type ObjectStore

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

func NewObjectStore

func NewObjectStore(ds datastore.Datastore) *ObjectStore

func (*ObjectStore) Get

func (s *ObjectStore) Get(ctx context.Context, contentId cid.Cid) (io.ReadCloser, error)

func (*ObjectStore) Has

func (s *ObjectStore) Has(ctx context.Context, contentId cid.Cid) (bool, error)

func (*ObjectStore) Put

func (s *ObjectStore) Put(ctx context.Context, data io.Reader) (cid.Cid, error)

type Store

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

func NewStore

func NewStore(ds datastore.Batching, os *ObjectStore) *Store

func (*Store) GetEdgeByCid

func (s *Store) GetEdgeByCid(ctx context.Context, id cid.Cid) (*FrozenEdge, error)

func (*Store) GetNodeByCid

func (s *Store) GetNodeByCid(ctx context.Context, id cid.Cid) (*FrozenNode, error)

func (*Store) GetNodeByID

func (s *Store) GetNodeByID(ctx context.Context, id psi.NodeID, version int64) (*FrozenNode, error)

func (*Store) GetNodeEdges

func (s *Store) GetNodeEdges(ctx context.Context, id psi.NodeID, version int64) (iterators.Iterator[*FrozenEdge], error)

func (*Store) LoadNode

func (s *Store) LoadNode(ctx context.Context, fn *FrozenNode) (psi.Node, error)

func (*Store) RemoveEdge

func (s *Store) RemoveEdge(ctx context.Context, nodeId psi.NodeID, key psi.EdgeKey) error

func (*Store) RemoveNode

func (s *Store) RemoveNode(ctx context.Context, path psi.Path) error

func (*Store) ResolvePath

func (s *Store) ResolvePath(ctx context.Context, path psi.Path) (psi.NodeID, error)

func (*Store) UpsertEdge

func (s *Store) UpsertEdge(ctx context.Context, edge psi.Edge) (*FrozenEdge, error)

func (*Store) UpsertNode

func (s *Store) UpsertNode(ctx context.Context, n psi.Node) (*FrozenNode, error)

Jump to

Keyboard shortcuts

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