Documentation ¶
Index ¶
- Constants
- Variables
- func NewFileTooBigError(err error, rpcName, path string) error
- func NewInvalidArgument(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 ClientPool
- type Error
- type ErrorCode
- type FetchVisitor
- type FileVisitor
- type FindCommitResponseForPolling
- func (*FindCommitResponseForPolling) Descriptor() ([]byte, []int)deprecated
- func (x *FindCommitResponseForPolling) GetCommit() *GitCommitForPolling
- func (*FindCommitResponseForPolling) ProtoMessage()
- func (x *FindCommitResponseForPolling) ProtoReflect() protoreflect.Message
- func (x *FindCommitResponseForPolling) Reset()
- func (x *FindCommitResponseForPolling) String() string
- type GitCommitForPolling
- func (*GitCommitForPolling) Descriptor() ([]byte, []int)deprecated
- func (x *GitCommitForPolling) GetId() string
- func (*GitCommitForPolling) ProtoMessage()
- func (x *GitCommitForPolling) ProtoReflect() protoreflect.Message
- func (x *GitCommitForPolling) Reset()
- func (x *GitCommitForPolling) String() string
- 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
- func (f *PathFetcher) VisitSingleFile(ctx context.Context, repo *gitalypb.Repository, revision, repoPath []byte, ...) error
- type PathFetcherInterface
- type PathVisitor
- type PollInfo
- type Poller
- type PollerInterface
- type Pool
- type PoolInterface
Constants ¶
const (
DefaultBranch = "HEAD"
)
Variables ¶
var File_internal_gitaly_gitaly_proto protoreflect.FileDescriptor
Functions ¶
func NewFileTooBigError ¶
func NewInvalidArgument ¶
func NewNotFoundError ¶
func NewProtocolError ¶
func NewRPCError ¶
Types ¶
type AccumulatingFileVisitor ¶
type AccumulatingFileVisitor struct {
Data []byte
}
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 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 // InvalidArgument - returned when Gitaly responds with InvalidArgument status code. InvalidArgument )
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 FindCommitResponseForPolling ¶
type FindCommitResponseForPolling struct { Commit *GitCommitForPolling `protobuf:"bytes,1,opt,name=commit,proto3" json:"commit,omitempty"` // contains filtered or unexported fields }
func (*FindCommitResponseForPolling) Descriptor
deprecated
func (*FindCommitResponseForPolling) Descriptor() ([]byte, []int)
Deprecated: Use FindCommitResponseForPolling.ProtoReflect.Descriptor instead.
func (*FindCommitResponseForPolling) GetCommit ¶
func (x *FindCommitResponseForPolling) GetCommit() *GitCommitForPolling
func (*FindCommitResponseForPolling) ProtoMessage ¶
func (*FindCommitResponseForPolling) ProtoMessage()
func (*FindCommitResponseForPolling) ProtoReflect ¶
func (x *FindCommitResponseForPolling) ProtoReflect() protoreflect.Message
func (*FindCommitResponseForPolling) Reset ¶
func (x *FindCommitResponseForPolling) Reset()
func (*FindCommitResponseForPolling) String ¶
func (x *FindCommitResponseForPolling) String() string
type GitCommitForPolling ¶
type GitCommitForPolling struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*GitCommitForPolling) Descriptor
deprecated
func (*GitCommitForPolling) Descriptor() ([]byte, []int)
Deprecated: Use GitCommitForPolling.ProtoReflect.Descriptor instead.
func (*GitCommitForPolling) GetId ¶
func (x *GitCommitForPolling) GetId() string
func (*GitCommitForPolling) ProtoMessage ¶
func (*GitCommitForPolling) ProtoMessage()
func (*GitCommitForPolling) ProtoReflect ¶
func (x *GitCommitForPolling) ProtoReflect() protoreflect.Message
func (*GitCommitForPolling) Reset ¶
func (x *GitCommitForPolling) Reset()
func (*GitCommitForPolling) String ¶
func (x *GitCommitForPolling) String() 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
func (*PathFetcher) VisitSingleFile ¶
func (f *PathFetcher) VisitSingleFile(ctx context.Context, repo *gitalypb.Repository, revision, repoPath []byte, 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 an error occurs. Visit(ctx context.Context, repo *gitalypb.Repository, revision, repoPath []byte, recursive bool, visitor FetchVisitor) error // VisitSingleFile returns a wrapped context.Canceled, context.DeadlineExceeded or gRPC error if ctx signals done and interrupts a running gRPC call. // VisitSingleFile returns *Error when an error occurs. VisitSingleFile(ctx context.Context, repo *gitalypb.Repository, revision, repoPath []byte, 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 an 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 an 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.CommitServiceClient Features map[string]string }
func (*Poller) Poll ¶
func (p *Poller) Poll(ctx context.Context, repo *gitalypb.Repository, lastProcessedCommitID, fullRefName string) (*PollInfo, error)
Poll searched the given repository for the given fullRefName and returns a PollInfo containing a resolved Commit Object ID. Valid fullRefNames are: * `refs/heads/*` => for branches * `refs/tags/*` => for tags * `HEAD` => for the repository's default branch
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 an 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 *entity.GitalyInfo) (PathFetcherInterface, error)
func (*Pool) Poller ¶
func (p *Pool) Poller(ctx context.Context, info *entity.GitalyInfo) (PollerInterface, error)
type PoolInterface ¶
type PoolInterface interface { Poller(context.Context, *entity.GitalyInfo) (PollerInterface, error) PathFetcher(context.Context, *entity.GitalyInfo) (PathFetcherInterface, error) }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
vendored
|
|
backoff
Package backoff implements exponential backoff mechanism based on gRPC's backoff algorithm https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md
|
Package backoff implements exponential backoff mechanism based on gRPC's backoff algorithm https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md |