scipgraph

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package scipgraph parses SCIP indexes into storage rows.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrForbidden      = errors.New("forbidden")
	ErrInvalidRequest = errors.New("invalid_request")
	ErrNotIndexed     = errors.New("not_indexed")
	// Navigate used to collapse all four conditions below into ErrNotIndexed, which
	// reported a healthy, search-indexed repository as unindexed. They are distinct
	// causes with distinct operator remedies, so they get distinct sentinels.
	ErrStaleCommit     = errors.New("stale_commit")
	ErrSCIPUnavailable = errors.New("scip_unavailable")
	ErrSCIPStale       = errors.New("scip_stale")
	ErrSymbolNotFound  = errors.New("symbol_not_found")
)
View Source
var (
	ErrOccurrenceNotFound = errors.New("SCIP occurrence not found")
	ErrStaleIndex         = errors.New("stale SCIP index")
)
View Source
var ErrInvalidIndex = errors.New("invalid SCIP index")

Functions

func VersionlessSymbolKey

func VersionlessSymbolKey(symbol string) ([]byte, error)

Types

type DependencyReader

type DependencyReader interface {
	DependencySBOM(context.Context, int64, string, string) (githubapp.SBOM, bool, error)
}

type Location

type Location struct {
	RepositoryID                                     int64
	RepositoryName, WebURL, Commit, Path, Symbol     string
	StartLine, StartCharacter, EndLine, EndCharacter int32
	PositionEncoding                                 int32
	Roles                                            int32
	Approximate                                      bool
}

type Occurrence

type Occurrence struct {
	Path, Symbol                                     string
	StartLine, StartCharacter, EndLine, EndCharacter int32
	PositionEncoding                                 int32
	Roles                                            int32
	Local                                            bool
}

type OccurrencePosition

type OccurrencePosition struct {
	UTF8, UTF16, UTF32 int
}

type Package

type Package struct {
	PURL, Manager, Name, Version string
}

func ParsePackageURL

func ParsePackageURL(value string) (Package, error)

type PackageMapping

type PackageMapping struct {
	Package  Package
	Relation string
	Source   string
}

type Relationship

type Relationship struct {
	Path                                                  string
	Source, Target                                        string
	Definition, Reference, Implementation, TypeDefinition bool
}

type Service

type Service struct {
	Store      ServiceStore
	GitHub     DependencyReader
	MaxResults int
}

func (*Service) Navigate

func (service *Service) Navigate(ctx context.Context, principal authn.Principal, request api.SCIPNavigationRequest) (api.SCIPNavigationResponse, error)

func (*Service) RefreshGitHubDependencies

func (service *Service) RefreshGitHubDependencies(ctx context.Context, principal authn.Principal, repositoryID int64) (api.DependencyRefreshResponse, error)

func (*Service) SetDependencies

func (service *Service) SetDependencies(ctx context.Context, principal authn.Principal, repositoryID int64, purls api.RepositoryPackages) error

func (*Service) Upload

func (service *Service) Upload(ctx context.Context, principal authn.Principal, repositoryID int64, commit string, data []byte) error

func (*Service) ValidateUpload

func (service *Service) ValidateUpload(ctx context.Context, principal authn.Principal, repositoryID int64, commit string) error

type ServiceStore

type ServiceStore interface {
	AuthorizedRepository(context.Context, int64, []int64, int64) (repository.Repository, error)
	AnyAuthorizedRepository(context.Context, int64) (repository.Repository, error)
	ReplaceSCIP(context.Context, int64, string, Upload) error
	OccurrenceAt(context.Context, int64, string, string, int, OccurrencePosition) (StoredOccurrence, error)
	// SCIPIndexCommit reports the commit of the most recent SCIP upload for a
	// repository, or "" when none exists. Consulted only on the error path.
	SCIPIndexCommit(context.Context, int64) (string, error)
	Locations(context.Context, authn.Principal, StoredOccurrence, string, int) ([]Location, bool, error)
	ReplacePackages(context.Context, int64, string, []PackageMapping) error
}

type StoredOccurrence

type StoredOccurrence struct {
	UploadID, RepositoryID                           int64
	Commit, Path, Symbol                             string
	StartLine, StartCharacter, EndLine, EndCharacter int32
	PositionEncoding                                 int32
	Roles                                            int32
	Local                                            bool
}

type Upload

type Upload struct {
	ProjectRoot, IndexerName, IndexerVersion string
	Occurrences                              []Occurrence
	Relationships                            []Relationship
}

func Parse

func Parse(data []byte) (Upload, error)

Jump to

Keyboard shortcuts

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