jsonfile

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRegistryService

func NewRegistryService(site midas.Site) midas.RegistryService

Types

type RegistryService

type RegistryService struct {
	Site midas.Site
	// contains filtered or unexported fields
}

func (*RegistryService) CloseStorage

func (r *RegistryService) CloseStorage()

CloseStorage closes the file handler.

func (*RegistryService) CreateEntry

func (r *RegistryService) CreateEntry(id, filename string) error

CreateEntry appends a new id to filename mapping to the registry.

func (*RegistryService) CreateStorage

func (r *RegistryService) CreateStorage() error

CreateStorage creates the registry file. Equivalent of calling OpenStorage in this case.

func (*RegistryService) DeleteEntry

func (r *RegistryService) DeleteEntry(id string) error

DeleteEntry removes entry with given id from the registry.

func (*RegistryService) Flush

func (r *RegistryService) Flush() error

Flush writes the working changes on registry to the file.

func (*RegistryService) OpenStorage

func (r *RegistryService) OpenStorage() error

OpenStorage opens the registry file (and creates it if it doesn't exist) and then unmarshals the file content into the registry.

func (*RegistryService) ReadEntry

func (r *RegistryService) ReadEntry(id string) (string, error)

ReadEntry returns filename attached to given id from the registry.

func (*RegistryService) RemoveStorage

func (r *RegistryService) RemoveStorage() error

RemoveStorage closes file handle and removes the registry file.

func (*RegistryService) UpdateEntry

func (r *RegistryService) UpdateEntry(id, newFilename string) error

UpdateEntry sets a new filename for the id in the registry.

Jump to

Keyboard shortcuts

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