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 ¶ added in v1.9.3
func LockExists ¶ added in v1.9.6
func LockFilePath ¶
func NewAlreadyExistError ¶ added in v1.9.8
func NewCompositeError ¶ added in v1.9.3
func NewContextCanceled ¶ added in v1.9.10
func NewContextCanceled() error
func NewContextDone ¶ added in v1.9.10
func NewForcedUnlockError ¶ added in v1.6.0
func NewIOError ¶
func NewLockError ¶
func NewNotExistError ¶ added in v1.9.8
func NewTimeoutError ¶
func ParseError ¶
func RLockExists ¶ added in v1.9.6
func RLockFilePath ¶ added in v1.9.6
func RandomString ¶ added in v1.17.8
func TempFilePath ¶ added in v1.6.0
Types ¶
type AlreadyExistError ¶ added in v1.9.8
type AlreadyExistError struct {
// contains filtered or unexported fields
}
func (AlreadyExistError) Error ¶ added in v1.9.8
func (e AlreadyExistError) Error() string
type CompositeError ¶ added in v1.9.3
type CompositeError struct {
// contains filtered or unexported fields
}
func (CompositeError) Error ¶ added in v1.9.3
func (e CompositeError) Error() string
type Container ¶ added in v1.9.3
type Container struct {
// contains filtered or unexported fields
}
func NewContainer ¶ added in v1.9.3
func NewContainer() *Container
func (*Container) CloseAllWithErrors ¶ added in v1.9.6
func (*Container) CloseWithErrors ¶ added in v1.9.3
func (*Container) CreateHandlerForCreate ¶ added in v1.17.9
func (*Container) CreateHandlerForRead ¶ added in v1.17.9
func (*Container) CreateHandlerForUpdate ¶ added in v1.17.9
func (*Container) CreateHandlerWithoutLock ¶ added in v1.17.9
type ContextCanceled ¶ added in v1.9.10
type ContextCanceled struct {
// contains filtered or unexported fields
}
func (ContextCanceled) Error ¶ added in v1.9.10
func (e ContextCanceled) Error() string
type ContextDone ¶ added in v1.9.10
type ContextDone struct {
// contains filtered or unexported fields
}
func (ContextDone) Error ¶ added in v1.9.10
func (e ContextDone) Error() string
type ControlFile ¶ added in v1.17.9
type ControlFile struct {
// contains filtered or unexported fields
}
func CreateControlFileContext ¶ added in v1.17.9
func CreateControlFileContext(ctx context.Context, filePath string, fileType ControlFileType, retryDelay time.Duration) (*ControlFile, error)
func NewControlFile ¶ added in v1.17.9
func NewControlFile(path string, fp *os.File) *ControlFile
func TryCreateLockFile ¶ added in v1.17.9
func TryCreateLockFile(filePath string) (*ControlFile, error)
func TryCreateRLockFile ¶ added in v1.17.9
func TryCreateRLockFile(filePath string) (controlFile *ControlFile, err error)
func TryCreateTempFile ¶ added in v1.17.9
func TryCreateTempFile(filePath string) (*ControlFile, error)
func (*ControlFile) Close ¶ added in v1.17.9
func (m *ControlFile) Close() error
func (*ControlFile) CloseWithErrors ¶ added in v1.17.9
func (m *ControlFile) CloseWithErrors() []error
type ControlFileType ¶ added in v1.17.9
type ControlFileType int
const ( RLock ControlFileType = iota Lock Temporary )
func (ControlFileType) String ¶ added in v1.17.9
func (t ControlFileType) String() string
type ForcedUnlockError ¶ added in v1.6.0
type ForcedUnlockError struct {
Errors []error
}
func (ForcedUnlockError) Error ¶ added in v1.6.0
func (e ForcedUnlockError) Error() string
type Handler ¶ added in v1.6.0
type Handler struct {
// contains filtered or unexported fields
}
func NewHandlerForCreate ¶ added in v1.6.0
func NewHandlerForRead ¶ added in v1.6.0
func NewHandlerForUpdate ¶ added in v1.6.0
func NewHandlerWithoutLock ¶ added in v1.9.8
func (*Handler) CreateControlFileContext ¶ added in v1.17.9
type NotExistError ¶ added in v1.9.8
type NotExistError struct {
// contains filtered or unexported fields
}
func (NotExistError) Error ¶ added in v1.9.8
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.