Documentation
¶
Overview ¶
Package flock provides a wrapper around syscall.Flock
Index ¶
- Constants
- type Flock
- type Handle
- type OpenerFunc
- type Options
- func (opt Options) JoinName(name string) string
- func (opt Options) Mkdir(name string, dmode fs.FileMode) error
- func (opt Options) MkdirAll(name string, dmode fs.FileMode) error
- func (opt Options) MkdirBase(dmode fs.FileMode) error
- func (opt Options) NameSplit(name string) (string, string)
- func (opt Options) New(name string, perm fs.FileMode) (*Flock, error)
- func (opt Options) NewOpener(perm fs.FileMode) func(string) (Handle, error)
- func (opt Options) ReadDir(name string) ([]fs.DirEntry, error)
- func (opt Options) ReadFile(name string, perm fs.FileMode) ([]byte, error)
- func (opt Options) WriteFile(name string, data []byte, perm fs.FileMode) error
Constants ¶
View Source
const ( // DefaultFileMode is the filemode used when a flock file is first created DefaultFileMode = 0666 // DefaultDirMode is the filemode used when a directory is created DefaultDirMode = 0777 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Flock ¶
type Flock struct {
// contains filtered or unexported fields
}
Flock implements a simple wrapper around syscall.Flock
func NewWithOpener ¶ added in v0.5.7
func NewWithOpener(filename string, opener OpenerFunc) *Flock
NewWithOpener instantiates a Flock for a given filename
type OpenerFunc ¶ added in v0.5.7
OpenerFunc is a function that opens a file
type Options ¶
type Options struct { Base string // optional prefix Create bool // create nodes if missing DirMode fs.FileMode // mode used for MkdirAll }
Options provides rules for Flock protected actions
func (Options) NewOpener ¶
NewOpener creates an opener funcion considering Options.Create and the given permissions
Click to show internal directories.
Click to hide internal directories.