Documentation ¶
Index ¶
- Variables
- func Load(meta Metadata, data interface{}, r io.Reader) error
- func LoadFile(meta Metadata, data interface{}, filename string) error
- func NewSafeFile(filename string) (*safeFile, error)
- func RandomSuffix() string
- func Save(meta Metadata, data interface{}, w io.Writer) error
- func SaveFile(meta Metadata, data interface{}, filename string) error
- type BoltDatabase
- type Logger
- type Metadata
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrBadVersion indicates that the version number of the file is not // compatible with the current codebase. ErrBadVersion = errors.New("incompatible version") // ErrBadHeader indicates that the file opened is not the file that was // expected. ErrBadHeader = errors.New("wrong header") )
Functions ¶
func NewSafeFile ¶ added in v1.0.0
NewSafeFile returns a file that can atomically be written to disk, minimizing the risk of corruption.
func RandomSuffix ¶ added in v1.0.0
func RandomSuffix() string
RandomSuffix returns a 20 character base32 suffix for a filename. There are 100 bits of entropy, and a very low probability of colliding with existing files unintentionally.
Types ¶
type BoltDatabase ¶ added in v1.0.0
BoltDatabase is a persist-level wrapper for the bolt database, providing extra information such as a version number.
func OpenDatabase ¶ added in v1.0.0
func OpenDatabase(md Metadata, filename string) (*BoltDatabase, error)
OpenDatabase opens a database filename and checks metadata
func (*BoltDatabase) Close ¶ added in v1.0.0
func (db *BoltDatabase) Close() error
CloseDatabase saves the bolt database to a file, and updates metadata
Click to show internal directories.
Click to hide internal directories.