fs

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2020 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package fs implements a key-value store that stores keys as file names and values as file content.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store added in v0.7.0

type Store struct {
	// Dir is the directory where key-value entries
	// are located. The store will read / write
	// values from / to files in this directory.
	Dir string

	// ErrorLog specifies an optional logger for errors
	// when files cannot be opened, deleted or contain
	// invalid content.
	// If nil, logging is done via the log package's
	// standard logger.
	ErrorLog *log.Logger
}

Store is a file system key-value store that stores keys as file names in a directory.

func (*Store) Create added in v0.7.0

func (s *Store) Create(key, value string) error

Create creates a new file in the directory if no file with the name 'key' does not exists and writes value to it. If such a file already exists it returns kes.ErrKeyExists.

func (*Store) Delete added in v0.7.0

func (s *Store) Delete(key string) error

Delete removes a the secret key with the given name from the key store and deletes the associated file, if it exists.

func (*Store) Get added in v0.7.0

func (s *Store) Get(key string) (string, error)

Get returns the secret key associated with the given name. If no entry for name exists, Get returns kes.ErrKeyNotFound.

In particular, Get reads the secret key from the associated file in KeyStore.Dir.

Jump to

Keyboard shortcuts

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