repository

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: 18 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

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotIndexed            = errors.New("not_indexed")
	ErrInvalidPath           = errors.New("invalid_path")
	ErrInvalidRange          = errors.New("invalid_range")
	ErrInvalidFile           = errors.New("invalid_file")
	ErrFileTooLarge          = errors.New("file_too_large")
	ErrBinaryFile            = errors.New("binary_file")
	ErrLineOutOfRange        = errors.New("line_out_of_range")
	ErrSearchNodeUnavailable = errors.New("search_node_unavailable")
)
View Source
var ErrInvalid = errors.New("invalid repository registry")

Functions

This section is empty.

Types

type ContentReader

type ContentReader interface {
	ReadContents(context.Context, int64, string, string, string, string, int64) (githubapp.Content, error)
}

type Registry

type Registry interface {
	Repositories() []Repository
}

type Repository

type Repository struct {
	ID             int64      `json:"id"`
	InstallationID int64      `json:"installation_id"`
	GitHubID       int64      `json:"github_id"`
	SizeBytes      int64      `json:"size_bytes"`
	ZoektID        uint32     `json:"zoekt_id"`
	Name           string     `json:"name"`
	Branch         string     `json:"branch"`
	DesiredSHA     string     `json:"desired_sha"`
	IndexedSHA     string     `json:"indexed_sha"`
	WebURL         string     `json:"web_url"`
	Status         string     `json:"status"`
	ErrorCode      string     `json:"error_code"`
	SearchNode     string     `json:"search_node"`
	Enabled        bool       `json:"enabled"`
	LastIndexedAt  *time.Time `json:"last_indexed_at"`
}

type SCIPIndexReader

type SCIPIndexReader interface {
	SCIPIndexCommit(context.Context, int64) (string, error)
}

SCIPIndexReader reports the commit of a repository's most recent SCIP upload, or "" when none exists.

type Service

type Service struct {
	Store        ServiceStore
	GitHub       ContentReader
	MaxFileBytes int64
	MaxLines     int
	// SCIP is optional; when nil, status reports SCIPStatusUnknown.
	SCIP SCIPIndexReader
}

func (*Service) List

func (service *Service) List(ctx context.Context, principal authn.Principal) ([]api.RepositorySummary, error)

func (*Service) ReadFile

func (service *Service) ReadFile(ctx context.Context, principal authn.Principal, request api.ReadFileRequest) (api.ReadFileResponse, error)

func (*Service) ReadFileAt

func (service *Service) ReadFileAt(ctx context.Context, principal authn.Principal, request api.ReadFileRequest, expectedSHA string) (api.ReadFileResponse, error)

func (*Service) Status

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

type ServiceStore

type ServiceStore interface {
	AuthorizedRepositories(context.Context, int64, []int64, []string) ([]Repository, error)
	AuthorizedRepository(context.Context, int64, []int64, int64) (Repository, error)
	AllAuthorizedRepositories(context.Context, []string) ([]Repository, error)
	AnyAuthorizedRepository(context.Context, int64) (Repository, error)
}

type Static

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

func Load

func Load(path string, maxBytes int64) (*Static, error)

func NewStatic

func NewStatic(repositories []Repository) (*Static, error)

func (*Static) AllAuthorizedRepositories

func (registry *Static) AllAuthorizedRepositories(ctx context.Context, names []string) ([]Repository, error)

func (*Static) AnyAuthorizedRepository

func (registry *Static) AnyAuthorizedRepository(ctx context.Context, id int64) (Repository, error)

AnyAuthorizedRepository resolves an identifier without applying any scope, matching the ServiceStore contract for administrator sessions. Static mode never mints an administrator principal (see newHandler in cmd/graphnest-server), so this is unreachable there; granting one would silently expose the whole registry regardless of GRAPHNEST_ADMIN_REPOSITORIES. TestStaticHandlerRegistersSystemRoutes pins that invariant.

func (*Static) AuthorizedRepositories

func (registry *Static) AuthorizedRepositories(ctx context.Context, _ int64, ids []int64, _ []string) ([]Repository, error)

func (*Static) AuthorizedRepository

func (registry *Static) AuthorizedRepository(ctx context.Context, _ int64, ids []int64, id int64) (Repository, error)

func (*Static) Repositories

func (registry *Static) Repositories() []Repository

Jump to

Keyboard shortcuts

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