helper

package
v0.100.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
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

func ByteSliceHasAnyPrefix(s []byte, prefixes ...string) bool

ByteSliceHasAnyPrefix tests whether the byte slice s begins with any of the prefixes.

func DecorateError added in v0.11.0

func DecorateError(code codes.Code, err error) error

DecorateError unless it's already a grpc error.

If given nil it will return nil.

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 GetPath added in v0.15.0

func GetPath(repo *pb.Repository) (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 *pb.Repository) (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

func GetStorageByName(storageName string) (string, error)

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

func GrpcCode(err error) codes.Code

GrpcCode emulates the old grpc.Code function: it translates errors into codes.Code values.

func IsGitDirectory added in v0.15.0

func IsGitDirectory(dir string) bool

IsGitDirectory checks if the directory passed as first argument looks like a valid git directory.

func IsNumber added in v0.4.0

func IsNumber(s []byte) bool

IsNumber tests whether the byte slice s contains only digits or not

func UnquoteBytes added in v0.9.0

func UnquoteBytes(s []byte) []byte

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL