Documentation
¶
Index ¶
- Constants
- Variables
- func AcquireUpToMax(ctx context.Context, currentProcessing *semaphore.Weighted) (uint32, error)
- func AddFileToZip(filePath, folderPath string, zipWriter *zip.Writer) error
- func Close(closer func() error)
- func ClosePreservingError(errPtr *error, closer io.Closer)
- func ConvertISO8601Duration(durationStr string) (time.Duration, error)
- func CreateDirectory(directoryPath string, permissions os.FileMode) error
- func EffectiveEnvironment(icmsEnvironment, spotEnvironment string) stringdeprecated
- func ExitReason(err error)
- func GetDirectorySize(dir string) (int64, error)
- func GetWriteBufferSize(conn net.Conn) int
- func LevelFromEnv() zap.AtomicLevel
- func MultipartReadToBuffer(src io.Reader, dst chan<- *bytebufferpool.ByteBuffer, maxPartSize int64) (int64, error)
- func NewProductionLogger() *logs.ZapLogger
- func PortSafeUrl(uri string) (*url.URL, error)
- func SanitizePath(path string) string
- func SleepWithContext(ctx context.Context, d time.Duration)
- func StringToDurationHookFunc() mapstructure.DecodeHookFunc
- func ZipFolder(folderPath string, target io.Writer) error
- type CloserFunc
Constants ¶
View Source
const ( OneKB = 1024 OneMB = 1024 * 1024 OneGB = 1024 * 1024 * 1024 )
Variables ¶
View Source
var ErrNotInKubernetesEnv = errors.New("not running in Kubernetes environment")
View Source
var PublicLogMarker = zap.Bool("public", true)
View Source
var Version = "unknown"
Functions ¶
func AcquireUpToMax ¶
func ClosePreservingError ¶
func ConvertISO8601Duration ¶
func EffectiveEnvironment
deprecated
EffectiveEnvironment returns the environment to use, preferring icmsEnvironment over spotEnvironment.
Deprecated: Configs now normalize in setup (ICMSEnvironment is set from SpotEnvironment when unset). Use the config's ICMSEnvironment field after setup instead of calling this.
func ExitReason ¶
func ExitReason(err error)
func GetDirectorySize ¶
Utility function to get the size of a directory.
func GetWriteBufferSize ¶
func LevelFromEnv ¶
func LevelFromEnv() zap.AtomicLevel
LevelFromEnv reads from env LOG_LEVEL and defaults to INFO
func MultipartReadToBuffer ¶
func MultipartReadToBuffer(src io.Reader, dst chan<- *bytebufferpool.ByteBuffer, maxPartSize int64) (int64, error)
Read content from reader into buffer and output them into a channel.
func NewProductionLogger ¶
func PortSafeUrl ¶
PortSafeUrl adds port 80 or 443 to http(s) urls for use with tcp or grpc dialers
func SanitizePath ¶
func SleepWithContext ¶
SleepWithContext https://stackoverflow.com/a/69291047
func StringToDurationHookFunc ¶
func StringToDurationHookFunc() mapstructure.DecodeHookFunc
Types ¶
type CloserFunc ¶
type CloserFunc func() error
func (CloserFunc) Close ¶
func (f CloserFunc) Close() error
Click to show internal directories.
Click to hide internal directories.