store

package
v0.8.3 Latest Latest
Warning

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

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

Documentation

Overview

Package store defines interfaces for types that handle storage of web page metadata, along with definitions of a few common errors.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCantCreateDatabase = errors.New("can't create the database")
	ErrorDatabaseNotFound = errors.New("database not found")
	ErrorResourceNotFound = errors.New("resource not found in data store")
	ErrorValueNotAllowed  = errors.New("value not allowed")
	ErrMappingNotFound    = errors.New("id mapping not found")
)

Functions

This section is empty.

Types

type Factory

type Factory func() (URLDataStore, error)

type Maintainable

type Maintainable interface {
	Create() error
	Clear() error
	Maintain() error
	Migrate() error
}

This interface adds create/clear/maintain methods to the URLDataStore interface. URLDataStores may support these methods to create, clear, and maintain the store.

type Observable added in v0.6.5

type Observable interface {
	Stats() (any, error)
}

This interface is to expose a method to supply data to healthchecks.

type URLDataStore

type URLDataStore interface {
	fetch.URLFetcher
	Save(*resource.WebPage) (uint64, error)
	Ping() error
	Delete(*nurl.URL) (bool, error)
}

This interface is the contract for storing and retrieving WebPage resources. It adds a Store() method to the fetch.URLFetcher interface. The fmt.Stringer interface is mainly to provide a way for the store to represent itself in log messages, e.g. a safe version of the DSN.

Jump to

Keyboard shortcuts

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