Documentation
¶
Index ¶
- Variables
- type ContentReader
- type Registry
- type Repository
- type SCIPIndexReader
- type Service
- func (service *Service) List(ctx context.Context, principal authn.Principal) ([]api.RepositorySummary, error)
- func (service *Service) ReadFile(ctx context.Context, principal authn.Principal, request api.ReadFileRequest) (api.ReadFileResponse, error)
- func (service *Service) ReadFileAt(ctx context.Context, principal authn.Principal, request api.ReadFileRequest, ...) (api.ReadFileResponse, error)
- func (service *Service) Status(ctx context.Context, principal authn.Principal, repositoryID int64) (api.RepositorySummary, error)
- type ServiceStore
- type Static
- func (registry *Static) AllAuthorizedRepositories(ctx context.Context, names []string) ([]Repository, error)
- func (registry *Static) AnyAuthorizedRepository(ctx context.Context, id int64) (Repository, error)
- func (registry *Static) AuthorizedRepositories(ctx context.Context, _ int64, ids []int64, _ []string) ([]Repository, error)
- func (registry *Static) AuthorizedRepository(ctx context.Context, _ int64, ids []int64, id int64) (Repository, error)
- func (registry *Static) Repositories() []Repository
Constants ¶
This section is empty.
Variables ¶
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") )
var ErrInvalid = errors.New("invalid repository registry")
Functions ¶
This section is empty.
Types ¶
type ContentReader ¶
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 ¶
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) ReadFile ¶
func (service *Service) ReadFile(ctx context.Context, principal authn.Principal, request api.ReadFileRequest) (api.ReadFileResponse, error)
func (*Service) ReadFileAt ¶
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 NewStatic ¶
func NewStatic(repositories []Repository) (*Static, error)
func (*Static) AllAuthorizedRepositories ¶
func (*Static) AnyAuthorizedRepository ¶
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 (*Static) AuthorizedRepository ¶
func (*Static) Repositories ¶
func (registry *Static) Repositories() []Repository