persistence

package
v1.0.86 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	// Returns the default filename for the persisent file
	DefaultFilename() string

	// Delay in writing to disk after modification
	WriteDelta() time.Duration

	// Path returns the path to the persistent file, or if empty
	// no writes happen to disk
	Path() string

	// Indent determines if the data should be written indented
	Indent() bool
}

Config interface to return configuration values

type File

type File struct {
	sync.Mutex
	event.Tasks
	// contains filtered or unexported fields
}

File implements filesystem persistence with JSON

func (*File) Close

func (this *File) Close() error

Close ends the persistence

func (*File) Init

func (this *File) Init(config Config, data interface{}, logger gopi.Logger) error

Init initializes the persistence, passing in configuration, the data to persist and the logging module

func (*File) Reader

func (this *File) Reader(fh io.Reader) error

Reader reads the configuration from an io.Reader object

func (*File) SetModified

func (this *File) SetModified()

SetModified sets the modified flag to true

func (*File) String

func (this *File) String() string

String stringifies

func (*File) Writer

func (this *File) Writer(fh io.Writer) error

Writer writes to io.Writer object

Jump to

Keyboard shortcuts

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