Documentation ¶
Overview ¶
Package atylar is an opinionated file storage system with version history. It uses a flat directory structure (no subdirectories). To start, initialize a new Store using the function New(), supplying the store's root directory path as the argument. All functions which may be used to modify the files automatically copy the current file to the `.history` directory in the current store. Historic versions are marked with an @ sign and the version number after the file name. The numbers are designated based on the generation, an always-increasing counter characteristic for the store.
Index ¶
- type Store
- func (S *Store) Copy(from, to string) error
- func (S *Store) GetGeneration(increment bool) uint64
- func (S *Store) History(file string) ([]uint64, error)
- func (S *Store) List(history bool) ([]string, error)
- func (S *Store) Move(from, to string) error
- func (S *Store) Open(file string, generation uint64) (*os.File, error)
- func (S *Store) Overwrite(file string) (*os.File, error)
- func (S *Store) Remove(file string) error
- func (S *Store) Stat(file string, history bool) (fs.FileInfo, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct { Directory string // Path to store root Generation uint64 // Used to set files' versions }
func (*Store) GetGeneration ¶
GetGeneration increments current generation if the argument is true and returns it.
func (*Store) History ¶
History returns generations available for the given file. The name is normalized
func (*Store) List ¶
List lists all files. If history is true, returns all backed up files' names, without the version string.
func (*Store) Open ¶
Open opens given file for reading. If generation is non-zero, it opens a historic version.