Documentation ¶
Index ¶
- Variables
- func ByteSliceHasAnyPrefix(s []byte, prefixes ...string) bool
- func CheckClockSync(ntpHost string, driftThreshold time.Duration) (bool, error)
- func ErrAborted(err error) error
- func ErrAbortedf(format string, a ...interface{}) error
- func ErrAlreadyExists(err error) error
- func ErrAlreadyExistsf(format string, a ...interface{}) error
- func ErrCanceled(err error) error
- func ErrCanceledf(format string, a ...interface{}) error
- func ErrDataLossf(format string, a ...interface{}) error
- func ErrDeadlineExceeded(err error) error
- func ErrDeadlineExceededf(format string, a ...interface{}) error
- func ErrFailedPrecondition(err error) error
- func ErrFailedPreconditionf(format string, a ...interface{}) 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 ErrNotFoundf(format string, a ...interface{}) error
- func ErrPermissionDenied(err error) error
- func ErrPermissionDeniedf(format string, a ...interface{}) error
- func ErrUnavailable(err error) error
- func ErrUnavailablef(format string, a ...interface{}) error
- func ErrUnimplementedf(format string, a ...interface{}) error
- func ErrUnknownf(format string, a ...interface{}) error
- func ErrWithDetails(err error, details ...proto.Message) (error, error)
- func GrpcCode(err error) codes.Code
- func IsNumber(s []byte) bool
- func RepoPathEqual(a, b repository.GitRepo) bool
- func SanitizeError(err error) error
- func SanitizeString(str string) string
- func SuppressCancellation(ctx context.Context) context.Context
- func UnquoteBytes(s []byte) []byte
- type CountingWriter
- type ManualTicker
- type Ticker
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.
Functions ¶
func ByteSliceHasAnyPrefix ¶
ByteSliceHasAnyPrefix tests whether the byte slice s begins with any of the prefixes.
func CheckClockSync ¶
CheckClockSync checks if machine clock has allowed drift threshold compare to NTP service. ntpHost is a URL of the NTP service to query, if not set the default pool.ntp.org is used. driftThreshold is a time duration that is considered acceptable time offset.
func ErrAborted ¶
ErrAborted wraps err with codes.Aborted, unless err is already a gRPC error.
func ErrAbortedf ¶
ErrAbortedf wraps a formatted error with codes.Aborted, unless the formatted error is a wrapped gRPC error.
func ErrAlreadyExists ¶
ErrAlreadyExists wraps err with codes.AlreadyExists, unless err is already a gRPC error.
func ErrAlreadyExistsf ¶
ErrAlreadyExistsf wraps a formatted error with codes.AlreadyExists, unless the formatted error is a wrapped gRPC error.
func ErrCanceled ¶
ErrCanceled wraps err with codes.Canceled, unless err is already a gRPC error.
func ErrCanceledf ¶ added in v15.3.0
ErrCanceledf wraps a formatted error with codes.Canceled, unless the formatted error is a wrapped gRPC error.
func ErrDataLossf ¶ added in v15.6.0
ErrDataLossf wraps a formatted error with codes.DataLoss, unless the formatted error is a wrapped gRPC error.
func ErrDeadlineExceeded ¶ added in v15.3.0
ErrDeadlineExceeded wraps err with codes.DeadlineExceeded, unless err is already a gRPC error.
func ErrDeadlineExceededf ¶ added in v15.3.0
ErrDeadlineExceededf wraps a formatted error with codes.DeadlineExceeded, unless the formatted error is a wrapped gRPC error.
func ErrFailedPrecondition ¶
ErrFailedPrecondition wraps err with codes.FailedPrecondition, unless err is already a gRPC error.
func ErrFailedPreconditionf ¶
ErrFailedPreconditionf wraps a formatted error with codes.FailedPrecondition, unless the formatted error is a wrapped gRPC error.
func ErrInternal ¶
ErrInternal wraps err with codes.Internal, unless err is already a gRPC error.
func ErrInternalf ¶
ErrInternalf wraps a formatted error with codes.Internal, unless the formatted error is a wrapped gRPC error.
func ErrInvalidArgument ¶
ErrInvalidArgument wraps err with codes.InvalidArgument, unless err is already a gRPC error.
func ErrInvalidArgumentf ¶
ErrInvalidArgumentf wraps a formatted error with codes.InvalidArgument, unless the formatted error is a wrapped gRPC error.
func ErrNotFound ¶
ErrNotFound wraps error with codes.NotFound, unless err is already a gRPC error.
func ErrNotFoundf ¶
ErrNotFoundf wraps a formatted error with codes.NotFound, unless the formatted error is a wrapped gRPC error.
func ErrPermissionDenied ¶
ErrPermissionDenied wraps err with codes.PermissionDenied, unless err is already a gRPC error.
func ErrPermissionDeniedf ¶
ErrPermissionDeniedf wraps a formatted error with codes.PermissionDenied, unless the formatted error is a wrapped gRPC error.
func ErrUnavailable ¶
ErrUnavailable wraps err with codes.Unavailable, unless err is already a gRPC error.
func ErrUnavailablef ¶
ErrUnavailablef wraps a formatted error with codes.Unavailable, unless the formatted error is a wrapped gRPC error.
func ErrUnimplementedf ¶ added in v15.6.0
ErrUnimplementedf wraps a formatted error with codes.Unimplemented, unless the formatted error is a wrapped gRPC error.
func ErrUnknownf ¶ added in v15.6.0
ErrUnknownf wraps a formatted error with codes.Unknown, unless the formatted error is a wrapped gRPC error.
func ErrWithDetails ¶
ErrWithDetails adds the given details to the error if it is a gRPC status whose code is not OK.
func GrpcCode ¶
GrpcCode translates errors into codes.Code values. It unwraps the nested errors until it finds the most nested one that returns the codes.Code. If err is nil it returns codes.OK. If no codes.Code found it returns codes.Unknown.
func RepoPathEqual ¶
func RepoPathEqual(a, b repository.GitRepo) bool
RepoPathEqual compares if two repositories are in the same location
func SanitizeError ¶
SanitizeError does the same thing as SanitizeString but for error types
func SanitizeString ¶
SanitizeString will clean password and tokens from URLs, and replace them with [FILTERED].
func SuppressCancellation ¶
SuppressCancellation returns a context that suppresses cancellation or expiration of the parent context.
func UnquoteBytes ¶
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 ¶
type CountingWriter ¶
CountingWriter wraps an io.Writer and counts all the writes. Accessing the count N is not thread-safe.
type ManualTicker ¶
type ManualTicker struct { StopFunc func() ResetFunc func() // contains filtered or unexported fields }
ManualTicker implements a ticker that ticks when Tick is called. Stop and Reset functions call the provided functions.
func NewCountTicker ¶
func NewCountTicker(n int, callback func()) *ManualTicker
NewCountTicker returns a ManualTicker with a ResetFunc that calls the provided callback on Reset call after it has been called N times.
func NewManualTicker ¶
func NewManualTicker() *ManualTicker
NewManualTicker returns a Ticker that can be manually controlled.
func (*ManualTicker) C ¶
func (mt *ManualTicker) C() <-chan time.Time
func (*ManualTicker) Reset ¶
func (mt *ManualTicker) Reset()
func (*ManualTicker) Stop ¶
func (mt *ManualTicker) Stop()
func (*ManualTicker) Tick ¶
func (mt *ManualTicker) Tick()
type Ticker ¶
Ticker ticks on the channel returned by C to signal something.
func NewTimerTicker ¶
NewTimerTicker returns a Ticker that ticks after the specified interval has passed since the previous Reset call.