lockss

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package lockss assists with LOCKSS related configuration settings.

The plan is to export this package at some point for external project use, but only once the API has settled.

Index

Constants

View Source
const (

	// DefaultConfigFile represents the path to the local LOCKSS configuration
	// file. This is not the properties or parameters file, but is instead the
	// configuration file that the LOCKSS daemon reads at startup to determine
	// core operational parameters.
	//
	// Among other settings, this file specifies the LOCKSS_PROPS_URL value
	// which the daemon uses to retrieve the LOCKSS Properties (Parameters)
	// file for further configuration. This path is hard-coded in LOCKSS v1
	// tooling, so this path should be fairly stable.
	DefaultConfigFile string = "/etc/lockss/config.dat"

	// PropertiesURLVarName is the name of the configuration file variable that we
	// will use to retrieve the LOCKSS Properties (Parameters) URL.
	PropertiesURLVarName string = "LOCKSS_PROPS_URL"

	// ConfigFileCommentChar is the character used to indicate that a line is
	// commented out in the local LOCKSS configuration file.
	ConfigFileCommentChar string = "#"

	// PropertiesGroupName is the group defined in the local LOCKSS daemon
	// configuration file that the node is a member of. Membership in this
	// group is required in order to receive certain settings, including
	// collections of peer nodes. Not all LOCKSS networks will filter settings
	// based on this group.
	PropertiesGroupName string = "LOCKSS_TEST_GROUP"
)
View Source
const DefaultConfigLoadURLTimeout = 7 * time.Second

DefaultConfigLoadURLTimeout specifies the default timeout for retrieving the LOCKSS properties/configuration file from the LOCKSS network configuration server.

Variables

This section is empty.

Functions

func DisableLogging

func DisableLogging()

DisableLogging reapplies default package-level logging settings of muting all logging output.

func EnableLogging

func EnableLogging()

EnableLogging enables logging output from this package. Output is muted by default unless explicitly requested (by calling this function).

Types

type Config

type Config struct {

	// IDInitialV3Peers is the list of V3 peers for this LOCKSS node. This
	// field also provides a user-facing API surface for peer nodes.
	IDInitialV3Peers IDInitialV3Peers
	// contains filtered or unexported fields
}

Config represents the values retrieved from provided LOCKSS configuration files. Due to the large number of possible parameters, we only pull in the settings that we actually require for our use.

func New

func New() (*Config, error)

New attempts to automatically provide an initialized configuration using the default path to the local LOCKSS node configuration file. Any error that occurs is returned.

func NewFromFile

func NewFromFile(filename string) (*Config, error)

NewFromFile attempts to provide an initialized configuration using a user-specified path to a local LOCKSS Properties (Parameters) XML file. Any error that occurs is returned. This function is usually reserved for testing purposes as live nodes will read their configuration using a provided URL.

func NewFromURL

func NewFromURL(url string) (*Config, error)

NewFromURL attempts to provide an initialized configuration using a user-specified URL to a LOCKSS Properties (Parameters) XML file. Any error that occurs is returned.

func NewFromURLWithContext

func NewFromURLWithContext(ctx context.Context, url string) (*Config, error)

NewFromURLWithContext attempts to provide an initialized configuration using a user-specified context and a URL to a LOCKSS Properties (Parameters) XML file. Any error that occurs is returned.

func (Config) LocalConfigFile

func (c Config) LocalConfigFile() string

LocalConfigFile is the local copy of the configuration file required for the LOCKSS daemon to operate. This file can be thought of as the "bootstrap" configuration file which enables the daemon to startup and retrieve further configuration settings from the network property/configuration server.

func (Config) PreservationGroup added in v0.1.2

func (c Config) PreservationGroup() string

PreservationGroup is the group defined in the local LOCKSS daemon configuration file that the node is a member of. Membership in this group is required in order to receive certain settings, including collections of peer nodes. Not all LOCKSS networks will filter settings based on this group.

func (Config) PropsURL

func (c Config) PropsURL() string

PropsURL returns the URL for the LOCKSS properties/configuration file. If the user provided the URL, that URL is returned, otherwise the URL specified by the local LOCKSS daemon configuration file is returned.

func (*Config) SetXMLDoc added in v0.1.2

func (c *Config) SetXMLDoc(xmlDoc *xmlquery.Node)

SetXMLDoc is used by config loading methods to set the parse tree for later processing

type IDInitialV3Peers

type IDInitialV3Peers struct {
	// contains filtered or unexported fields
}

IDInitialV3Peers represents the initial list of V3 peers for a LOCKSS node.

func (IDInitialV3Peers) List

func (l IDInitialV3Peers) List() ([]V3Peer, error)

List returns a slice of initial peers.

type Proxy

type Proxy struct {
	NoManifestIndexResponses string
	Port                     int
	AuditPort                int
	Access                   ProxyAccess
}

Proxy represents the parent proxy element containing settings related to the content proxy support in LOCKSS

type ProxyAccess

type ProxyAccess struct {
	IPLogForbidden bool
	IPInclude      []string
}

ProxyAccess represents access control settings for the content proxy support in LOCKSS

type V3Peer

type V3Peer struct {

	// Protocol represents the network type (for example, "tcp", "udp")
	Protocol string

	// IPAddress is the IP Address of the LOCKSS node/peer that this node will
	// try to communicate with
	IPAddress string

	// LCAPPort is the LCAP (Library Content Audit Protocol) TCP port used to
	// make connections to remote LOCKSS nodes for content voting, polling and
	// repairing purposes.
	LCAPPort int
}

V3Peer represents a peer LOCKSS node in the network. This type implements the net.Addr interface (https://golang.org/pkg/net/#Addr).

func (V3Peer) Network

func (v3p V3Peer) Network() string

Network returns the name of the network (for example, "tcp", "udp") in order to implement the net.Addr interface.

func (V3Peer) String

func (v3p V3Peer) String() string

String returns the string from of the address, port pair in order to implement the net.Addr interface.

Jump to

Keyboard shortcuts

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