Documentation
¶
Index ¶
- Constants
- func Exists(path string) bool
- func GetTimeoutContext(ctx context.Context, waitTimeOut time.Duration) (context.Context, context.CancelFunc)
- func LockExists(path string) bool
- func LockFilePath(path string) string
- func NewAlreadyExistError(message string) error
- func NewCompositeError(err1 error, err2 error) error
- func NewContextCanceled() error
- func NewContextDone(message string) error
- func NewForcedUnlockError(errs []error) error
- func NewIOError(message string) error
- func NewLockError(message string) error
- func NewNotExistError(message string) error
- func NewTimeoutError(path string) error
- func ParseError(err error) error
- func RLockExists(path string) bool
- func RLockFilePath(path string) string
- func RandomString(length int) string
- func TempFilePath(path string) string
- type AlreadyExistError
- type CompositeError
- type Container
- func (c *Container) Add(path string, handler *Handler) error
- func (c *Container) Close(h *Handler) error
- func (c *Container) CloseAll() error
- func (c *Container) CloseAllWithErrors() error
- func (c *Container) CloseWithErrors(h *Handler) (err error)
- func (c *Container) Commit(h *Handler) error
- func (c *Container) CreateHandlerForCreate(path string) (*Handler, error)
- func (c *Container) CreateHandlerForRead(ctx context.Context, path string, defaultWaitTimeout time.Duration, ...) (*Handler, error)
- func (c *Container) CreateHandlerForUpdate(ctx context.Context, path string, defaultWaitTimeout time.Duration, ...) (*Handler, error)
- func (c *Container) CreateHandlerWithoutLock(ctx context.Context, path string, defaultWaitTimeout time.Duration, ...) (*Handler, error)
- func (c *Container) Keys() []string
- func (c *Container) Remove(path string)
- type ContextCanceled
- type ContextDone
- type ControlFile
- func CreateControlFileContext(ctx context.Context, filePath string, fileType ControlFileType, ...) (*ControlFile, error)
- func NewControlFile(path string, fp *os.File) *ControlFile
- func TryCreateLockFile(filePath string) (*ControlFile, error)
- func TryCreateRLockFile(filePath string) (controlFile *ControlFile, err error)
- func TryCreateTempFile(filePath string) (*ControlFile, error)
- type ControlFileType
- type ForcedUnlockError
- type Handler
- func NewHandlerForCreate(path string) (*Handler, error)
- func NewHandlerForRead(ctx context.Context, path string, defaultWaitTimeout time.Duration, ...) (*Handler, error)
- func NewHandlerForUpdate(ctx context.Context, path string, defaultWaitTimeout time.Duration, ...) (*Handler, error)
- func NewHandlerWithoutLock(ctx context.Context, path string, defaultWaitTimeout time.Duration, ...) (*Handler, error)
- type IOError
- type LockError
- type NotExistError
- type OpenType
- type Reader
- type TimeoutError
Constants ¶
View Source
const ( RLockFileSuffix = ".rlock" LockFileSuffix = ".lock" TempFileSuffix = ".temp" )
View Source
const DefaultRetryDelay = 10 * time.Millisecond
View Source
const DefaultWaitTimeout = 10 * time.Second
Variables ¶
This section is empty.
Functions ¶
func GetTimeoutContext ¶
func LockExists ¶
func LockFilePath ¶
func NewAlreadyExistError ¶
func NewCompositeError ¶
func NewContextCanceled ¶
func NewContextCanceled() error
func NewContextDone ¶
func NewForcedUnlockError ¶
func NewIOError ¶
func NewLockError ¶
func NewNotExistError ¶
func NewTimeoutError ¶
func ParseError ¶
func RLockExists ¶
func RLockFilePath ¶
func RandomString ¶
func TempFilePath ¶
Types ¶
type AlreadyExistError ¶
type AlreadyExistError struct {
// contains filtered or unexported fields
}
func (AlreadyExistError) Error ¶
func (e AlreadyExistError) Error() string
type CompositeError ¶
type CompositeError struct {
// contains filtered or unexported fields
}
func (CompositeError) Error ¶
func (e CompositeError) Error() string
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
func NewContainer ¶
func NewContainer() *Container
func (*Container) CloseAllWithErrors ¶
func (*Container) CloseWithErrors ¶
func (*Container) CreateHandlerForCreate ¶
func (*Container) CreateHandlerForRead ¶
func (*Container) CreateHandlerForUpdate ¶
func (*Container) CreateHandlerWithoutLock ¶
type ContextCanceled ¶
type ContextCanceled struct {
// contains filtered or unexported fields
}
func (ContextCanceled) Error ¶
func (e ContextCanceled) Error() string
type ContextDone ¶
type ContextDone struct {
// contains filtered or unexported fields
}
func (ContextDone) Error ¶
func (e ContextDone) Error() string
type ControlFile ¶
type ControlFile struct {
// contains filtered or unexported fields
}
func CreateControlFileContext ¶
func CreateControlFileContext(ctx context.Context, filePath string, fileType ControlFileType, retryDelay time.Duration) (*ControlFile, error)
func NewControlFile ¶
func NewControlFile(path string, fp *os.File) *ControlFile
func TryCreateLockFile ¶
func TryCreateLockFile(filePath string) (*ControlFile, error)
func TryCreateRLockFile ¶
func TryCreateRLockFile(filePath string) (controlFile *ControlFile, err error)
func TryCreateTempFile ¶
func TryCreateTempFile(filePath string) (*ControlFile, error)
func (*ControlFile) Close ¶
func (m *ControlFile) Close() error
func (*ControlFile) CloseWithErrors ¶
func (m *ControlFile) CloseWithErrors() []error
type ControlFileType ¶
type ControlFileType int
const ( RLock ControlFileType = iota Lock Temporary )
func (ControlFileType) String ¶
func (t ControlFileType) String() string
type ForcedUnlockError ¶
type ForcedUnlockError struct {
Errors []error
}
func (ForcedUnlockError) Error ¶
func (e ForcedUnlockError) Error() string
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandlerForCreate ¶
func NewHandlerForRead ¶
func NewHandlerForUpdate ¶
func NewHandlerWithoutLock ¶
func (*Handler) CreateControlFileContext ¶
type NotExistError ¶
type NotExistError struct {
// contains filtered or unexported fields
}
func (NotExistError) Error ¶
func (e NotExistError) Error() string
type TimeoutError ¶
type TimeoutError struct {
// contains filtered or unexported fields
}
func (TimeoutError) Error ¶
func (e TimeoutError) Error() string
Click to show internal directories.
Click to hide internal directories.