database

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoProjectNode = errors.New("No project node found")
View Source
var ErrNoSuchPackage = errors.New("no such package")

Functions

func AnalyzerCreatedInfoNodes

func AnalyzerCreatedInfoNodes(infoInter interface{}, infonode interface{}) bool

AnalyzerCreatedInfoNodes checks if the analyzer has created info nodes for a file node

func CheckSchema

func CheckSchema(checkSchema string) bool

func Delete

func Delete(db *DataBase, nodeUID string) (string, error)

Delete deletes nodes from the db. The data should be JSON marshalable

func DeleteEdge

func DeleteEdge(db *DataBase, nodeUID string, predicate string) (string, error)

DeleteEdge deletes an edge from a node

Types

type DataBase

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

func Setup

func Setup(dbAddr string, queueWorkers int) (*DataBase, error)

Setup connects to dgraph and returns the instance

func (*DataBase) AddDiagnosticNode

func (db *DataBase) AddDiagnosticNode(nodeID string, diagnosticnode *service.DiagnosticNode) error

AddDiagnosticNode stores the given DiagnosticNodes in a PackageNode or FileNode identified by the nodeID

func (*DataBase) AddFileNode

func (db *DataBase) AddFileNode(node *service.FileNode)

AddFileNode adds a node to the insert queue in build phase

func (*DataBase) AddFileNodes

func (db *DataBase) AddFileNodes(nodeID string, filenodes ...*service.FileNode) error

AddFileNodes stores the given FileNodes in the FileNode identified by the nodeID

func (*DataBase) AddInfoNodes

func (db *DataBase) AddInfoNodes(nodeID string, infonodes []*service.InfoNode) error

AddInfoNodes stores the given InfoNodes in a PackageNode or FileNode identified by the nodeID

func (*DataBase) AddPackageFileNodes

func (db *DataBase) AddPackageFileNodes(nodeID string, filenodes ...*service.FileNode) error

AddPackageFileNodes stores the given FileNodes in a PackageNode identified by the nodeID

func (*DataBase) AddPackageNode

func (db *DataBase) AddPackageNode(node *service.PackageNode)

AddPackageNode adds a node to the insert queue

func (*DataBase) AddProjectNode

func (db *DataBase) AddProjectNode(node *service.ProjectNode)

AddProjectNode adds a node to the insert queue

func (*DataBase) AddQmstrStateNode

func (db *DataBase) AddQmstrStateNode(qNode *service.QmstrStateNode) (map[string]string, error)

func (*DataBase) CloseInsertQueue

func (db *DataBase) CloseInsertQueue()

func (*DataBase) GetAllInfoData

func (db *DataBase) GetAllInfoData(infotype string) ([]string, error)

func (*DataBase) GetAnalyzerByName

func (db *DataBase) GetAnalyzerByName(name string) (*service.Analyzer, error)

func (*DataBase) GetDiagnosticNodeBySeverity

func (db *DataBase) GetDiagnosticNodeBySeverity(diagnosticNode *service.DiagnosticNode) ([]*service.DiagnosticNode, error)

GetDiagnosticNodeBySeverity queries diagnostic nodes on a specific severity

func (*DataBase) GetFileDataUID

func (db *DataBase) GetFileDataUID(hash string) (string, error)

GetFileDataUID returns the UID of the fileData node if exists in the db

func (*DataBase) GetFileNodeHashByPath

func (db *DataBase) GetFileNodeHashByPath(path string) (string, error)

func (*DataBase) GetFileNodeLeaves

func (db *DataBase) GetFileNodeLeaves(offset int, first int) ([]*service.FileNode, error)

GetFileNodeLeaves returns the filenodes that are not derived from other filenodes

func (*DataBase) GetFileNodeUid

func (db *DataBase) GetFileNodeUid(path string, hash string) (string, error)

GetFileNodeUid returns the UID of the node if exists otherwise ""

func (*DataBase) GetFileNodesByFileNode

func (db *DataBase) GetFileNodesByFileNode(in *service.GetFileNodeMessage, offset int, first int) ([]*service.FileNode, error)

GetFileNodesByFileNode queries filenodes on a specific attribute of a provided filenode. For instance, you can provide a filenode with a certain name and get all the filenodes with this name. You can query for just one attribute. For instance, if you set path and hash, only the hash will be used in the query.

func (*DataBase) GetFileNodesWithUIDByHash

func (db *DataBase) GetFileNodesWithUIDByHash(hash string) ([]*service.FileNode, error)

GetFileNodesWithUIDByHash returns the UID of the fileNode

func (*DataBase) GetInfoData

func (db *DataBase) GetInfoData(rootNodeID string, infotype string, datatype string) ([]string, error)

func (*DataBase) GetInfoDataByTrustLevel

func (db *DataBase) GetInfoDataByTrustLevel(fileID string, infotype string, datatype string) ([]string, error)

GetInfoDataByTrustLevel returns infonodes containing the datanodes detected from the most trusted analyzer

func (*DataBase) GetNodesByType

func (db *DataBase) GetNodesByType(valuetype string, recursive bool, namefilter string) ([]*service.FileNode, error)

func (*DataBase) GetPackageNode

func (db *DataBase) GetPackageNode() ([]*service.PackageNode, error)

func (*DataBase) GetPackageNodeByName

func (db *DataBase) GetPackageNodeByName(name string) (*service.PackageNode, error)

func (*DataBase) GetPackageTargets

func (db *DataBase) GetPackageTargets(pkgNodeID string) ([]*service.FileNode, error)

func (*DataBase) GetPendingInserts

func (db *DataBase) GetPendingInserts() uint64

func (*DataBase) GetProjectNode

func (db *DataBase) GetProjectNode() (*service.ProjectNode, error)

func (*DataBase) GetQmstrStateNode

func (db *DataBase) GetQmstrStateNode() (*service.QmstrStateNode, error)

func (*DataBase) OpenInsertQueue

func (db *DataBase) OpenInsertQueue()

func (*DataBase) Sync

func (db *DataBase) Sync()

Jump to

Keyboard shortcuts

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