Documentation
¶
Index ¶
- Constants
- Variables
- func CopyWithCtx(ctx context.Context, dst io.Writer, src io.Reader) (readN int64, err error)
- func CreateCacheFile(key string, path string) (*os.File, error)
- func DeleteCacheFiles(paths ...string)
- func FilterPathIdent(ident string) string
- func FixSeparators(path string) string
- func GetItemPath(dir string, pathGenerator PathGeneratorFn, key string, forMeta bool, ...) string
- func IsExpired(createdAt time.Time, ttl time.Duration) bool
- func ItemFilesValid(itemPath string, metaPath string) bool
- func PrepareDir(dir string) error
- func ReadAll(ctx context.Context, r io.Reader) ([]byte, error)
- type KeyLocker
- type KeysLocker
- type PathGeneratorFn
- type ReaderFunc
Constants ¶
Variables ¶
View Source
var ( ErrDirNotExists = errors.New("directory does not exist") ErrNotADir = errors.New("not a directory") )
Functions ¶
func CopyWithCtx ¶
CopyWithCtx is a wrapper for the io.CopyWithCtx function with context handling.
func FilterPathIdent ¶
FilterPathIdent remove path separators from the path part.
func FixSeparators ¶
FixSeparators replaces all path separators with the OS-correct.
func GetItemPath ¶
func GetItemPath(dir string, pathGenerator PathGeneratorFn, key string, forMeta bool, createDirs bool) string
GetItemPath returns full item's path.
func ItemFilesValid ¶
ItemFilesValid checks if itemPath & metaPath are a valid files' paths.
func PrepareDir ¶
PrepareDir checks if dir exists and creates it otherwise.
Types ¶
type KeysLocker ¶
type KeysLocker struct {
// contains filtered or unexported fields
}
func NewKeysLocker ¶
func NewKeysLocker() *KeysLocker
func (*KeysLocker) Lock ¶
func (k *KeysLocker) Lock(key string)
func (*KeysLocker) Unlock ¶
func (k *KeysLocker) Unlock(key string)
type PathGeneratorFn ¶
Click to show internal directories.
Click to hide internal directories.