Documentation
¶
Overview ¶
Package files provides file browsing and content retrieval for Git repositories.
Package files provides file browsing and content retrieval for Git repositories.
Package files provides file browsing and content retrieval for Git repositories.
Index ¶
- func DetectLanguage(filename string, content []byte) string
- func MapToCodeMirrorMode(language string) string
- type BlobResponse
- type FederatedClient
- func (c *FederatedClient) GetBlob(ctx context.Context, repoName, path, ref string) (*BlobResponse, error)
- func (c *FederatedClient) GetBranches(ctx context.Context, repoName string) ([]string, error)
- func (c *FederatedClient) GetRawBlob(ctx context.Context, repoName, path, ref string) (io.ReadCloser, int64, error)
- func (c *FederatedClient) GetShardForRepo(repoName string) int
- func (c *FederatedClient) GetTags(ctx context.Context, repoName string) ([]string, error)
- func (c *FederatedClient) ListTree(ctx context.Context, repoName, path, ref string) ([]TreeEntry, error)
- func (c *FederatedClient) RepoExists(ctx context.Context, repoName string) (bool, error)
- type FileSymbol
- type Service
- func (s *Service) GetBlob(ctx context.Context, repoName, path, ref string) (*BlobResponse, error)
- func (s *Service) GetBranches(ctx context.Context, repoName string) ([]string, error)
- func (s *Service) GetRawBlob(ctx context.Context, repoName, path, ref string) (io.ReadCloser, int64, error)
- func (s *Service) GetRepoPath(repoName string) string
- func (s *Service) GetTags(ctx context.Context, repoName string) ([]string, error)
- func (s *Service) ListTree(ctx context.Context, repoName, path, ref string) ([]TreeEntry, error)
- func (s *Service) RepoExists(repoName string) bool
- type TreeEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectLanguage ¶
DetectLanguage detects the programming language of a file. Uses go-enry which is GitHub's linguist library ported to Go.
func MapToCodeMirrorMode ¶
MapToCodeMirrorMode maps enry language names to CodeMirror mode names.
Types ¶
type BlobResponse ¶
type BlobResponse struct {
Content string `json:"content"`
Path string `json:"path"`
Size int64 `json:"size"`
Language string `json:"language"`
Binary bool `json:"binary"`
}
BlobResponse represents file content.
type FederatedClient ¶
type FederatedClient struct {
// contains filtered or unexported fields
}
FederatedClient handles proxying file requests to the correct indexer shard.
func NewFederatedClient ¶
func NewFederatedClient(indexerService string, indexerPort, totalShards int) *FederatedClient
NewFederatedClient creates a client for federated file access.
func (*FederatedClient) GetBlob ¶
func (c *FederatedClient) GetBlob( ctx context.Context, repoName, path, ref string, ) (*BlobResponse, error)
GetBlob proxies a blob request to the correct shard.
func (*FederatedClient) GetBranches ¶
GetBranches proxies a branch listing request to the correct shard.
func (*FederatedClient) GetRawBlob ¶
func (c *FederatedClient) GetRawBlob( ctx context.Context, repoName, path, ref string, ) (io.ReadCloser, int64, error)
GetRawBlob proxies a raw file content request to the correct shard. Returns the response body as a ReadCloser — the caller must close it.
func (*FederatedClient) GetShardForRepo ¶
func (c *FederatedClient) GetShardForRepo(repoName string) int
GetShardForRepo returns which shard should handle a repo.
func (*FederatedClient) ListTree ¶
func (c *FederatedClient) ListTree( ctx context.Context, repoName, path, ref string, ) ([]TreeEntry, error)
ListTree proxies a tree listing request to the correct shard.
func (*FederatedClient) RepoExists ¶
RepoExists checks if a repository exists on its assigned shard.
type FileSymbol ¶
type FileSymbol struct {
Name string `json:"name"`
Kind string `json:"kind"`
Line int `json:"line"`
Column int `json:"column"`
Signature string `json:"signature,omitempty"`
Parent string `json:"parent,omitempty"`
}
FileSymbol represents a symbol found in a file.
func ExtractSymbols ¶
func ExtractSymbols(content, language string) []FileSymbol
ExtractSymbols extracts symbols from file content based on language.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides file browsing operations for repositories.
func (*Service) GetBranches ¶
GetBranches returns all branches for a repository.
func (*Service) GetRawBlob ¶
func (s *Service) GetRawBlob( ctx context.Context, repoName, path, ref string, ) (io.ReadCloser, int64, error)
GetRawBlob returns a reader for raw file content (including binary files).
func (*Service) GetRepoPath ¶
GetRepoPath returns the local path to a cloned repository (public version).
func (*Service) RepoExists ¶
RepoExists checks if a repository exists locally.