Documentation ¶
Index ¶
- Constants
- Variables
- func GraphKey(id int64) []byte
- func IsLabelKey(labelKey []byte) bool
- func IsPropertyKey(propertyKey []byte) bool
- func LabelKey(labelID int64) []byte
- func ParseLabelKey(labelKey []byte) (int64, error)
- func ParsePropertyKey(propertyKey []byte) (int64, error)
- func PropertyKey(propertyID uint16) []byte
- type Meta
- func (m *Meta) AdvanceGlobalID(n int) (int64, error)
- func (m *Meta) AdvanceID(graphID int64, n int) (int64, error)
- func (m *Meta) CreateGraph(info *model.GraphInfo) error
- func (m *Meta) CreateLabel(graphID int64, labelInfo *model.LabelInfo) error
- func (m *Meta) CreateProperty(graphID int64, propertyInfo *model.PropertyInfo) error
- func (m *Meta) DropGraph(graphID int64) error
- func (m *Meta) DropLabel(graphID int64, labelID int64) error
- func (m *Meta) DropProperty(graphID int64, propertyID uint16) error
- func (m *Meta) GenGlobalIDs(n int) ([]int64, error)
- func (m *Meta) GetGraph(graphID int64) (*model.GraphInfo, error)
- func (m *Meta) GetLabel(graphID int64, labelID int64) (*model.LabelInfo, error)
- func (m *Meta) GetProperty(graphID int64, propertyID uint16) (*model.PropertyInfo, error)
- func (m *Meta) GlobalID() (int64, error)
- func (m *Meta) ListGraphs() ([]*model.GraphInfo, error)
- func (m *Meta) ListLabels(graphID int64) ([]*model.LabelInfo, error)
- func (m *Meta) ListProperties(graphID int64) ([]*model.PropertyInfo, error)
- func (m *Meta) NextGlobalID() (int64, error)
- func (m *Meta) UpdateGraph(info *model.GraphInfo) error
- func (m *Meta) UpdateLabel(graphID int64, labelInfo *model.LabelInfo) error
- func (m *Meta) UpdateProperty(graphID int64, propertyInfo *model.PropertyInfo) error
Constants ¶
const ( // CurrentMagicByteVer is the current magic byte version, used for future meta compatibility. CurrentMagicByteVer byte = 0x00 // MaxInt48 is the max value of int48. MaxInt48 = 0x0000FFFFFFFFFFFF // MaxGlobalID reserves 1000 IDs. Use MaxInt48 to reserves the high 2 bytes to compatible with Multi-tenancy. MaxGlobalID = MaxInt48 - 1000 )
Variables ¶
var ( // ErrGraphExists is the error for db exists. ErrGraphExists = errors.New("graph exists") // ErrGraphNotExists is the error for db not exists. ErrGraphNotExists = errors.New("graph not exists") ErrInvalidString = errors.New("invalid string") ErrLabelExists = errors.New("label exists") ErrLabelNotExists = errors.New("label not exists") ErrIndexExists = errors.New("index exists") ErrIndexNotExists = errors.New("index not exists") ErrPropertyExists = errors.New("property exists") ErrPropertyNotExists = errors.New("property not exists") ErrNoGraphSelected = errors.New("no graph selected") )
Functions ¶
func IsLabelKey ¶
IsLabelKey checks whether the label key comes from LabelKey().
func IsPropertyKey ¶
IsPropertyKey checks whether the property key comes from PropertyKey().
func ParseLabelKey ¶
ParseLabelKey decodes the label key to get label id.
func ParsePropertyKey ¶
ParsePropertyKey decodes the property key to get property id.
func PropertyKey ¶
PropertyKey encodes the propertyID into property key.
Types ¶
type Meta ¶
Meta is for handling meta information in a transaction.
func NewSnapshot ¶
NewSnapshot returns a read-only new instance of meta API object.
func (*Meta) AdvanceGlobalID ¶
AdvanceGlobalID advances the global ID by n. return the old global ID.
func (*Meta) AdvanceID ¶
AdvanceID advances the local ID allocator by n, and return the old global ID. NOTE: It's better to call graph.MDLock() to reduce transaction conflicts.
func (*Meta) CreateGraph ¶
CreateGraph creates a graph.
func (*Meta) CreateLabel ¶
CreateLabel creates a label.
func (*Meta) CreateProperty ¶
func (m *Meta) CreateProperty(graphID int64, propertyInfo *model.PropertyInfo) error
CreateProperty creates a property.
func (*Meta) DropProperty ¶
DropProperty drops property in graph.
func (*Meta) GenGlobalIDs ¶
GenGlobalIDs generates the next n global IDs.
func (*Meta) GetProperty ¶
GetProperty gets the property value in a graph.
func (*Meta) ListGraphs ¶
ListGraphs shows all graphs.
func (*Meta) ListLabels ¶
ListLabels shows all labels in a graph.
func (*Meta) ListProperties ¶
func (m *Meta) ListProperties(graphID int64) ([]*model.PropertyInfo, error)
ListProperties shows all properties in a graph.
func (*Meta) NextGlobalID ¶
NextGlobalID generates next id globally.
func (*Meta) UpdateGraph ¶
UpdateGraph updates a graph.
func (*Meta) UpdateLabel ¶
UpdateLabel updates the label.
func (*Meta) UpdateProperty ¶
func (m *Meta) UpdateProperty(graphID int64, propertyInfo *model.PropertyInfo) error
UpdateProperty updates the property.