file

package
v0.0.0-...-552cffb Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// PrivateFileMode is the permission for service file
	PrivateFileMode = 0600
	// PrivateDirMode is the permission for service dir
	PrivateDirMode = 0700
)

Variables

View Source
var (
	// ErrLocked means that fail to get file lock
	ErrLocked = errors.New("pkg/file: file already locked")
)

Functions

This section is empty.

Types

type LockedFile

type LockedFile struct{ *os.File }

LockedFile wraps the file into a LockedFile concept simply

func LockFile

func LockFile(path string, flag int, perm os.FileMode) (*LockedFile, error)

LockFile opens file with the file lock, it's blocked

func TryLockFile

func TryLockFile(path string, flag int, perm os.FileMode) (*LockedFile, error)

TryLockFile tries to open the file with the file lock, it's unblock

Jump to

Keyboard shortcuts

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