bin

package
v0.0.0-...-f284434 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package bin exports functionality for working with files (CRUD) in a concurrent-safe fashion. Bin is an acronym for binary; don't struggle with file operations; focus on the binary. Note that the concurrent-safe guarantee is only valid when working with a filesystem that supports atomicity for common file operations (e.g. create, rename, remove, etc.).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefLckPath

func DefLckPath(path string) string

func ErrIfExists

func ErrIfExists(path string) error

func ErrIfNotExist

func ErrIfNotExist(path string) error

func Lck

func Lck(path string) (*os.File, error)

func New

func New(path string, b io.Reader) error

func NewBare

func NewBare(path string, b io.Reader) error

func NewLckPath

func NewLckPath(path string, b io.Reader, lckPath string) error

func Open

func Open(path string) (*os.File, error)

func Over

func Over(path string, b io.Reader) error

func OverBare

func OverBare(path string, b io.Reader) error

func OverLckPath

func OverLckPath(path string, b io.Reader, lckPath string) error

func Rm

func Rm(path string) (rErr error)

func RmBare

func RmBare(path string) error

func RmLckPath

func RmLckPath(path string, lckPath string) (rErr error)

func Unlck

func Unlck(path string, f *os.File) (rErr error)

Types

type Dir

type Dir string

Dir is just a fancy wrapper around global bin functions; a binary repository that saves all bins in a specified directory. Note that any name argument should be a valid file name (e.g. no filepath.Separator within); otherwise, strange things will happen.

func NewDir

func NewDir(d string) *Dir

func (*Dir) All

func (d *Dir) All() (rNs []string, rErr error)

func (*Dir) Dir

func (d *Dir) Dir() string

func (*Dir) New

func (d *Dir) New(name string, b io.Reader) error

func (*Dir) Open

func (d *Dir) Open(name string) (*os.File, error)

func (*Dir) Over

func (d *Dir) Over(name string, b io.Reader) error

func (*Dir) Path

func (d *Dir) Path(name string) string

func (*Dir) Rm

func (d *Dir) Rm(name string) (rErr error)

type ErrExists

type ErrExists string

func NewErrExists

func NewErrExists(path string) *ErrExists

func (*ErrExists) Error

func (e *ErrExists) Error() string

type ErrLcked

type ErrLcked string

func NewErrLcked

func NewErrLcked(path string) *ErrLcked

func (*ErrLcked) Error

func (e *ErrLcked) Error() string

func (*ErrLcked) Path

func (e *ErrLcked) Path() string

type ErrNotExist

type ErrNotExist string

func NewErrNotExist

func NewErrNotExist(path string) *ErrNotExist

func (*ErrNotExist) Error

func (e *ErrNotExist) Error() string

Jump to

Keyboard shortcuts

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