utils

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDirAndMaxPerms

func EnsureDirAndMaxPerms(path string, perms os.FileMode) error

EnsureDirAndMaxPerms ensures that the given path exists, that it's a directory, and that it has permissions that are no more permissive than the given ones.

- If the path does not exist, it is created - If the path exists, but is not a directory, an error is returned - If the path exists, and is a directory, but has the wrong perms, it is chmod'ed

Types

type ByteSize

type ByteSize int64
const (
	KB ByteSize = 1 << (10 * iota)
	MB
	GB
	TB
	PB
)

func (ByteSize) String

func (b ByteSize) String() string

func (*ByteSize) UnmarshalText

func (b *ByteSize) UnmarshalText(text []byte) error

type Pool

type Pool[T any] struct {
	sync.Pool
	// contains filtered or unexported fields
}

func NewBytesPool

func NewBytesPool(size int, maxSize int) *Pool[[]byte]

func NewPool

func NewPool[T any](newF func() T, reset func(T) T, valid func(T) bool) *Pool[T]

func (*Pool[T]) Get

func (p *Pool[T]) Get() T

func (*Pool[T]) Put

func (p *Pool[T]) Put(x T)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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