Documentation ¶
Index ¶
- Variables
- func ByteSliceHasAnyPrefix(s []byte, prefixes ...string) bool
- func ClientConnection(ctx context.Context, storageName string) (*grpc.ClientConn, error)
- func ContainsPathTraversal(path string) bool
- func DecorateError(code codes.Code, err error) error
- func ErrInternal(err error) error
- func ErrInternalf(format string, a ...interface{}) error
- func ErrInvalidArgument(err error) error
- func ErrInvalidArgumentf(format string, a ...interface{}) error
- func ErrNotFound(err error) error
- func ErrPreconditionFailed(err error) error
- func ErrPreconditionFailedf(format string, a ...interface{}) error
- func ExtractGitalyServers(ctx context.Context) (gitalyServersInfo storage.GitalyServers, err error)
- func GetObjectDirectoryPath(repo repository.GitRepo) (string, error)
- func GetPath(repo repository.GitRepo) (string, error)
- func GetRepoPath(repo repository.GitRepo) (string, error)
- func GetStorageByName(storageName string) (string, error)
- func GrpcCode(err error) codes.Code
- func IncomingToOutgoing(ctx context.Context) context.Context
- func InjectGitalyServers(ctx context.Context, name, address, token string) (context.Context, error)
- func IsGitDirectory(dir string) bool
- func IsNumber(s []byte) bool
- func SanitizeError(err error) error
- func SanitizeString(str string) string
- func UnquoteBytes(s []byte) []byte
Constants ¶
This section is empty.
Variables ¶
var MaxCommitOrTagMessageSize = 10 * 1024
MaxCommitOrTagMessageSize is the threshold for a commit/tag message, if exceeded then message is truncated and it's up to the client to request it in full separately.
var Unimplemented = status.Errorf(codes.Unimplemented, "this rpc is not implemented")
Unimplemented is a Go error with gRPC error code 'Unimplemented'
Functions ¶
func ByteSliceHasAnyPrefix ¶ added in v0.3.0
ByteSliceHasAnyPrefix tests whether the byte slice s begins with any of the prefixes.
func ClientConnection ¶ added in v1.77.0
ClientConnection creates a grpc.ClientConn from the injected gitaly-servers metadata
func ContainsPathTraversal ¶ added in v0.120.0
ContainsPathTraversal checks if the path contains any traversal
func DecorateError ¶ added in v0.11.0
DecorateError unless it's already a grpc error.
If given nil it will return nil.
func ErrInternal ¶ added in v1.13.0
ErrInternal wraps err with codes.Internal, unless err is already a grpc error
func ErrInternalf ¶ added in v1.28.0
ErrInternalf wrapps a formatted error with codes.Internal, unless err is already a grpc error
func ErrInvalidArgument ¶ added in v1.13.0
ErrInvalidArgument wraps err with codes.InvalidArgument, unless err is already a grpc error
func ErrInvalidArgumentf ¶ added in v1.28.0
ErrInvalidArgumentf wraps a formatted error with codes.InvalidArgument, unless err is already a grpc error
func ErrNotFound ¶ added in v1.31.0
ErrNotFound wraps error with codes.NotFound, unless err is already a grpc error
func ErrPreconditionFailed ¶ added in v1.26.0
ErrPreconditionFailed wraps err with codes.FailedPrecondition, unless err is already a grpc error
func ErrPreconditionFailedf ¶ added in v1.31.0
ErrPreconditionFailedf wraps a formatted error with codes.FailedPrecondition, unless err is already a grpc error
func ExtractGitalyServers ¶ added in v0.65.0
func ExtractGitalyServers(ctx context.Context) (gitalyServersInfo storage.GitalyServers, err error)
ExtractGitalyServers extracts `storage.GitalyServers` from an incoming context.
func GetObjectDirectoryPath ¶ added in v1.33.2
func GetObjectDirectoryPath(repo repository.GitRepo) (string, error)
GetObjectDirectoryPath returns the full path of the object directory in a repository referenced by an RPC Repository message. The errors returned are gRPC errors with relevant error codes and should be passed back to gRPC without further decoration.
func GetPath ¶ added in v0.15.0
func GetPath(repo repository.GitRepo) (string, error)
GetPath returns the path of the repo passed as first argument. An error is returned when either the storage can't be found or the path includes constructs trying to perform directory traversal.
func GetRepoPath ¶ added in v0.5.0
func GetRepoPath(repo repository.GitRepo) (string, error)
GetRepoPath returns the full path of the repository referenced by an RPC Repository message. The errors returned are gRPC errors with relevant error codes and should be passed back to gRPC without further decoration.
func GetStorageByName ¶ added in v0.40.0
GetStorageByName will return the path for the storage, which is fetched by its key. An error is return if it cannot be found.
func GrpcCode ¶ added in v0.72.0
GrpcCode emulates the old grpc.Code function: it translates errors into codes.Code values.
func IncomingToOutgoing ¶ added in v1.60.0
IncomingToOutgoing creates an outgoing context out of an incoming context with the same storage metadata
func InjectGitalyServers ¶ added in v1.56.0
InjectGitalyServers injects gitaly-servers metadata into an outgoing context
func IsGitDirectory ¶ added in v0.15.0
IsGitDirectory checks if the directory passed as first argument looks like a valid git directory.
func SanitizeError ¶ added in v1.36.0
SanitizeError does the same thing as SanitizeString but for error types
func SanitizeString ¶ added in v1.3.0
SanitizeString will clean password and tokens from URLs, and replace them with [FILTERED].
func UnquoteBytes ¶ added in v0.9.0
UnquoteBytes removes surrounding double-quotes from a byte slice returning a new slice if they exist, otherwise it returns the same byte slice passed.
Types ¶
This section is empty.