Documentation ¶
Index ¶
- Constants
- func NewFileTooBigError(err error, rpcName, path string) error
- func NewNotFoundError(rpcName, path string) error
- func NewProtocolError(err error, message, rpcName, path string) error
- func NewRpcError(err error, rpcName, path string) error
- func NewUnexpectedTreeEntryTypeError(rpcName, path string) error
- type AccumulatingFileVisitor
- type ChunkingFetchVisitor
- type ClientPool
- type DuplicatePathDetectingVisitor
- type DuplicatePathFoundError
- type EntryCountLimitingFetchVisitor
- type Error
- type ErrorCode
- type FetchVisitor
- type FileVisitor
- type GlobFilteringFetchVisitor
- type GlobMatchFailedError
- type HiddenDirFilteringFetchVisitor
- type MaxNumberOfFilesError
- type PathEntryVisitor
- type PathFetcher
- func (f *PathFetcher) FetchFile(ctx context.Context, repo *gitalypb.Repository, revision, repoPath []byte, ...) ([]byte, error)
- func (f *PathFetcher) StreamFile(ctx context.Context, repo *gitalypb.Repository, revision, repoPath []byte, ...) error
- func (f *PathFetcher) Visit(ctx context.Context, repo *gitalypb.Repository, revision, repoPath []byte, ...) error
- type PathFetcherInterface
- type PathVisitor
- type PollInfo
- type Poller
- type PollerInterface
- type Pool
- type PoolInterface
- type Reference
- type ReferenceDiscovery
- type TotalSizeLimitingFetchVisitor
Constants ¶
const (
DefaultBranch = ""
)
Variables ¶
This section is empty.
Functions ¶
func NewFileTooBigError ¶
func NewNotFoundError ¶
func NewProtocolError ¶
func NewRpcError ¶
Types ¶
type AccumulatingFileVisitor ¶
type AccumulatingFileVisitor struct {
Data []byte
}
type ChunkingFetchVisitor ¶
type ChunkingFetchVisitor struct {
// contains filtered or unexported fields
}
func NewChunkingFetchVisitor ¶
func NewChunkingFetchVisitor(delegate FetchVisitor, maxChunkSize int) *ChunkingFetchVisitor
func (ChunkingFetchVisitor) StreamChunk ¶
func (v ChunkingFetchVisitor) StreamChunk(path []byte, data []byte) (bool, error)
type ClientPool ¶
type ClientPool interface {
Dial(ctx context.Context, address, token string) (*grpc.ClientConn, error)
}
ClientPool abstracts gitlab.com/gitlab-org/gitaly/client.Pool.
type DuplicatePathDetectingVisitor ¶
type DuplicatePathDetectingVisitor struct {
// contains filtered or unexported fields
}
func NewDuplicateFileDetectingVisitor ¶
func NewDuplicateFileDetectingVisitor(delegate FetchVisitor) DuplicatePathDetectingVisitor
type DuplicatePathFoundError ¶
type DuplicatePathFoundError struct {
Path string
}
func (*DuplicatePathFoundError) Error ¶
func (e *DuplicatePathFoundError) Error() string
type EntryCountLimitingFetchVisitor ¶
type EntryCountLimitingFetchVisitor struct { FilesVisited uint32 FilesSent uint32 // contains filtered or unexported fields }
func NewEntryCountLimitingFetchVisitor ¶
func NewEntryCountLimitingFetchVisitor(delegate FetchVisitor, maxNumberOfFiles uint32) *EntryCountLimitingFetchVisitor
type Error ¶
type ErrorCode ¶
type ErrorCode int
const ( // UnknownError - what happened is unknown UnknownError ErrorCode = iota // NotFound - file/directory/ref was not found NotFound // FileTooBig - file is too big FileTooBig // RpcError - gRPC returned an error RpcError // ProtocolError - protocol violation, an unexpected situation occurred. ProtocolError // UnexpectedTreeEntryType - returned when TreeEntryResponse has an unexpected type. UnexpectedTreeEntryType )
func ErrorCodeFromError ¶
type FetchVisitor ¶
type FetchVisitor interface { Entry(*gitalypb.TreeEntry) (bool, int64, error) StreamChunk(path []byte, data []byte) (bool, error) // EntryDone is called after the entry has been fully streamed. // It's not called for entries that are not streamed i.e. skipped. EntryDone(*gitalypb.TreeEntry, error) }
FetchVisitor is the visitor callback, invoked for each chunk of each path entry.
type FileVisitor ¶
FileVisitor is the visitor callback, invoked for each chunk of a file.
type GlobFilteringFetchVisitor ¶
type GlobFilteringFetchVisitor struct { Glob string // contains filtered or unexported fields }
func NewGlobFilteringFetchVisitor ¶
func NewGlobFilteringFetchVisitor(delegate FetchVisitor, glob string) *GlobFilteringFetchVisitor
type GlobMatchFailedError ¶
func (*GlobMatchFailedError) Error ¶
func (e *GlobMatchFailedError) Error() string
func (*GlobMatchFailedError) Unwrap ¶
func (e *GlobMatchFailedError) Unwrap() error
type HiddenDirFilteringFetchVisitor ¶
type HiddenDirFilteringFetchVisitor struct {
// contains filtered or unexported fields
}
func NewHiddenDirFilteringFetchVisitor ¶
func NewHiddenDirFilteringFetchVisitor(delegate FetchVisitor) *HiddenDirFilteringFetchVisitor
type MaxNumberOfFilesError ¶
type MaxNumberOfFilesError struct {
MaxNumberOfFiles uint32
}
func (*MaxNumberOfFilesError) Error ¶
func (e *MaxNumberOfFilesError) Error() string
type PathEntryVisitor ¶
type PathFetcher ¶
type PathFetcher struct { Client gitalypb.CommitServiceClient Features map[string]string }
func (*PathFetcher) FetchFile ¶
func (f *PathFetcher) FetchFile(ctx context.Context, repo *gitalypb.Repository, revision, repoPath []byte, sizeLimit int64) ([]byte, error)
func (*PathFetcher) StreamFile ¶
func (f *PathFetcher) StreamFile(ctx context.Context, repo *gitalypb.Repository, revision, repoPath []byte, sizeLimit int64, v FileVisitor) error
func (*PathFetcher) Visit ¶
func (f *PathFetcher) Visit(ctx context.Context, repo *gitalypb.Repository, revision, repoPath []byte, recursive bool, visitor FetchVisitor) error
type PathFetcherInterface ¶
type PathFetcherInterface interface { // Visit returns a wrapped context.Canceled, context.DeadlineExceeded or gRPC error if ctx signals done and interrupts a running gRPC call. // Visit returns *Error when a error occurs. Visit(ctx context.Context, repo *gitalypb.Repository, revision, repoPath []byte, recursive bool, visitor FetchVisitor) error // StreamFile streams the specified revision of the file. // The passed visitor is never called if file was not found. // StreamFile returns a wrapped context.Canceled, context.DeadlineExceeded or gRPC error if ctx signals done and interrupts a running gRPC call. // StreamFile returns *Error when a error occurs. StreamFile(ctx context.Context, repo *gitalypb.Repository, revision, repoPath []byte, sizeLimit int64, v FileVisitor) error // FetchFile fetches the specified revision of a file. // FetchFile returns a wrapped context.Canceled, context.DeadlineExceeded or gRPC error if ctx signals done and interrupts a running gRPC call. // FetchFile returns *Error when a error occurs. FetchFile(ctx context.Context, repo *gitalypb.Repository, revision, repoPath []byte, sizeLimit int64) ([]byte, error) }
type PathVisitor ¶
type PathVisitor struct { Client gitalypb.CommitServiceClient Features map[string]string }
func (*PathVisitor) Visit ¶
func (v *PathVisitor) Visit(ctx context.Context, repo *gitalypb.Repository, revision, repoPath []byte, recursive bool, visitor PathEntryVisitor) error
type Poller ¶
type Poller struct { Client gitalypb.SmartHTTPServiceClient Features map[string]string }
type PollerInterface ¶
type PollerInterface interface { // Poll performs a poll on the repository. // revision can be a branch name or a tag. // Poll returns a wrapped context.Canceled, context.DeadlineExceeded or gRPC error if ctx signals done and interrupts a running gRPC call. // Poll returns *Error when a error occurs. Poll(ctx context.Context, repo *gitalypb.Repository, lastProcessedCommitId, refName string) (*PollInfo, error) }
PollerInterface does the following: - polls ref advertisement for updates to the repository - detects which is the main branch, if branch or tag name is not specified - compares the commit id the branch or tag is referring to with the last processed one - returns the information about the change
type Pool ¶
type Pool struct {
ClientPool ClientPool
}
func (*Pool) PathFetcher ¶
func (p *Pool) PathFetcher(ctx context.Context, info *api.GitalyInfo) (PathFetcherInterface, error)
func (*Pool) Poller ¶
func (p *Pool) Poller(ctx context.Context, info *api.GitalyInfo) (PollerInterface, error)
type PoolInterface ¶
type PoolInterface interface { Poller(context.Context, *api.GitalyInfo) (PollerInterface, error) PathFetcher(context.Context, *api.GitalyInfo) (PathFetcherInterface, error) }
type Reference ¶
type Reference struct { // Oid is the object ID the reference points to Oid string // Name of the reference. The name will be suffixed with ^{} in case // the reference is the peeled commit. Name string }
Reference as used by the reference discovery protocol
type ReferenceDiscovery ¶
type ReferenceDiscovery struct { // FirstPacket tracks the time when the first pktline was received FirstPacket time.Time // LastPacket tracks the time when the last pktline was received LastPacket time.Time // PayloadSize tracks the size of all pktlines' data PayloadSize int64 // Packets tracks the total number of packets consumed Packets int // Refs contains all announced references Refs []Reference // Caps contains all supported capabilities Caps []string }
ReferenceDiscovery contains information about a reference discovery session.
func ParseReferenceDiscovery ¶
func ParseReferenceDiscovery(body io.Reader) (ReferenceDiscovery, error)
ParseReferenceDiscovery parses a client's reference discovery stream and returns either information about the reference discovery or an error in case it couldn't make sense of the client's request.
func (*ReferenceDiscovery) Parse ¶
func (d *ReferenceDiscovery) Parse(body io.Reader) error
Parse parses a client's reference discovery stream into the given ReferenceDiscovery struct or returns an error in case it couldn't make sense of the client's request.
Expected protocol: - "# service=git-upload-pack\n" - FLUSH - "<OID> <ref>\x00<capabilities>\n" - "<OID> <ref>\n" - ... - FLUSH
type TotalSizeLimitingFetchVisitor ¶
type TotalSizeLimitingFetchVisitor struct { RemainingTotalFileSize int64 // contains filtered or unexported fields }
func NewTotalSizeLimitingFetchVisitor ¶
func NewTotalSizeLimitingFetchVisitor(delegate FetchVisitor, maxTotalFileSize int64) *TotalSizeLimitingFetchVisitor
func (*TotalSizeLimitingFetchVisitor) StreamChunk ¶
func (v *TotalSizeLimitingFetchVisitor) StreamChunk(path []byte, data []byte) (bool, error)