mapstore

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mapstore keeps the learned site maps (internal/sitemap) on disk: one JSON file per host in a per-profile directory (~/.daisybell/maps/<profile>/<host>.json), private to the user (0700 directory, 0600 files), written atomically. Separate from sitemap, which is pure.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoMap = errors.New("no map")

ErrNoMap is returned for a host without a map.

Functions

func Decode

func Decode(data []byte) (*sitemap.Map, error)

Decode parses a map file, checks its version and reduces it to structure (sitemap.Map.Clean): a version 1 file, which kept every name, is read as the current version without them.

Types

type Entry

type Entry struct {
	Host    string
	Screens int
	Edges   int
	Path    string
	Err     error // unreadable file
}

Entry is one map in a listing.

type Store

type Store struct {
	Dir string
	// Now is the clock (tests); nil is time.Now.
	Now func() time.Time
}

Store reads and writes the maps of one profile.

func (Store) Clear

func (s Store) Clear(host string) error

Clear deletes a host's map (no error when there is none).

func (Store) Export

func (s Store) Export(host, to string) error

Export writes a host's map to a file (to share with a team).

func (Store) Import

func (s Store) Import(from string) (*sitemap.Map, error)

Import reads an exported map and saves it as its host's map (replacing the current one).

func (Store) List

func (s Store) List() ([]Entry, error)

List returns the profile's maps, by host.

func (Store) Load

func (s Store) Load(host string) (*sitemap.Map, error)

Load reads a host's map (empty when there is none), dropping what aged out (90 days) and anything that is not structure.

func (Store) Path

func (s Store) Path(host string) string

Path is the file of a host's map.

func (Store) Save

func (s Store) Save(m *sitemap.Map) error

Save writes a map (atomically: temp file and rename; 0600).

func (Store) Update

func (s Store) Update(host string, fn func(*sitemap.Map) bool) error

Update loads a host's map, applies fn and saves it when fn reports a change. A file that can't be read starts over empty (the map is a convenience: it never blocks an action).

Jump to

Keyboard shortcuts

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