catalog

package
v0.0.0-...-959c02d Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Catalog

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

Catalog maintains the catalog of graphs and label information.

func Load

func Load(snapshot kv.Snapshot) (*Catalog, error)

Load loads the catalog from a kv snapshot.

func (*Catalog) Apply

func (c *Catalog) Apply(patch *Patch)

Apply applies the patch to catalog. Note: we need to ensure the DDL changes have applied to persistent storage first.

func (*Catalog) Graph

func (c *Catalog) Graph(name string) *Graph

Graph returns the graph of specified name.

func (*Catalog) GraphByID

func (c *Catalog) GraphByID(id int64) *Graph

GraphByID returns the graph of specified ID.

func (*Catalog) Graphs

func (c *Catalog) Graphs() []*Graph

Graphs returns all graphs.

func (*Catalog) Label

func (c *Catalog) Label(graphName, labelName string) *Label

Label returns the label of specified graph.

func (*Catalog) LabelByID

func (c *Catalog) LabelByID(graphID, labelID int64) *Label

LabelByID returns the label of specified graph.

func (*Catalog) Labels

func (c *Catalog) Labels(graphName string) []*Label

Labels returns all labels of specified graph.

func (*Catalog) MDLock

func (c *Catalog) MDLock()

MDLock locks the catalog to prevent executing DDL concurrently.

func (*Catalog) MDUnlock

func (c *Catalog) MDUnlock()

MDUnlock unlocks the catalog.

type Graph

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

Graph represents a runtime graph object.

func NewGraph

func NewGraph(meta *model.GraphInfo) *Graph

NewGraph returns a graph instance.

func (*Graph) CreateLabel

func (g *Graph) CreateLabel(labelInfo *model.LabelInfo)

CreateLabel create a new label and append to the graph labels list.

func (*Graph) CreateProperty

func (g *Graph) CreateProperty(propertyInfo *model.PropertyInfo)

CreateProperty create a new property and append to the graph properties list.

func (*Graph) DropLabel

func (g *Graph) DropLabel(labelInfo *model.LabelInfo)

DropLabel removes specified label from graph.

func (*Graph) DropProperty

func (g *Graph) DropProperty(propertyInfo *model.PropertyInfo)

DropProperty removes specified property from graph.

func (*Graph) Index

func (g *Graph) Index(name string) *Index

Index returns the label of specified name.

func (*Graph) IndexByID

func (g *Graph) IndexByID(id int64) *Index

IndexByID returns the label of specified ID.

func (*Graph) Indexes

func (g *Graph) Indexes() []*Index

Indexes returns the indexes.

func (*Graph) Label

func (g *Graph) Label(name string) *Label

Label returns the label of specified name.

func (*Graph) LabelByID

func (g *Graph) LabelByID(id int64) *Label

LabelByID returns the label of specified ID.

func (*Graph) Labels

func (g *Graph) Labels() []*Label

Labels returns the labels.

func (*Graph) MDLock

func (g *Graph) MDLock()

MDLock locks the metadata of the current graph.

func (*Graph) MDUnlock

func (g *Graph) MDUnlock()

MDUnlock unlocks the metadata of the current graph.

func (*Graph) Meta

func (g *Graph) Meta() *model.GraphInfo

Meta returns the meta information object of this graph.

func (*Graph) Properties

func (g *Graph) Properties() []*model.PropertyInfo

Properties returns the Properties.

func (*Graph) Property

func (g *Graph) Property(name string) *model.PropertyInfo

Property returns the property of specified name.

func (*Graph) PropertyByID

func (g *Graph) PropertyByID(id uint16) *model.PropertyInfo

PropertyByID returns the property of specified ID.

func (*Graph) SetNextPropID

func (g *Graph) SetNextPropID(propID uint16)

SetNextPropID sets the next property id.

type Index

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

Index represents a runtime index object.

func NewIndex

func NewIndex(meta *model.IndexInfo) *Index

NewIndex returns a new index object.

func (*Index) Meta

func (i *Index) Meta() *model.IndexInfo

Meta returns the meta information object of this index.

type Label

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

Label represents a runtime label object.

func NewLabel

func NewLabel(meta *model.LabelInfo) *Label

NewLabel returns a label instance.

func (*Label) Meta

func (l *Label) Meta() *model.LabelInfo

Meta returns the meta information object of this label.

type Patch

type Patch struct {
	Type PatchType
	Data interface{}
}

Patch represents patch which contains a DDL change.

type PatchLabel

type PatchLabel struct {
	GraphID   int64
	LabelInfo *model.LabelInfo
}

PatchLabel represents the payload of patching create/drop label DDL.

type PatchProperties

type PatchProperties struct {
	MaxPropID  uint16
	GraphID    int64
	Properties []*model.PropertyInfo
}

PatchProperties represents the payload of patching create properties

type PatchType

type PatchType byte

PatchType represents the type of patch.

const (
	PatchTypeCreateGraph PatchType = iota
	PatchTypeCreateLabel
	PatchTypeCreateIndex
	PatchTypeDropGraph
	PatchTypeDropLabel
	PatchTypeDropIndex
	PatchTypeCreateProperties
)

Jump to

Keyboard shortcuts

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