sys

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DqliteSocket is the configurable location of the dqlite socket.
	DqliteSocket = "DQLITE_SOCKET"

	// StateDir is the location of the daemon state directory.
	StateDir = "STATE_DIR"

	// SchemaUpdate is the path to the schema update to run.
	SchemaUpdate = "SCHEMA_UPDATE"

	// SocketGroup is the configurable group of the socket.
	SocketGroup = "SOCKET_GROUP"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type OS

type OS struct {
	StateDir        string
	DatabaseDir     string
	TrustDir        string
	CertificatesDir string
	LogFile         string
}

OS contains fields and methods for interacting with the state directory.

func DefaultOS

func DefaultOS(stateDir string, createDir bool) (*OS, error)

DefaultOS returns a fresh uninitialized OS instance with default values.

func (*OS) ClusterCert

func (s *OS) ClusterCert() (*shared.CertInfo, error)

ClusterCert gets the local cluster certificate from the state directory.

func (*OS) ControlSocket

func (s *OS) ControlSocket() api.URL

ControlSocket returns the full path to the control.socket file that this daemon is listening on.

func (*OS) ControlSocketPath

func (s *OS) ControlSocketPath() string

ControlSocketPath returns the filesystem path to the control socket.

func (*OS) DatabasePath

func (s *OS) DatabasePath() string

DatabasePath returns the path of the database file managed by dqlite.

func (*OS) IsControlSocketPresent

func (s *OS) IsControlSocketPresent() (bool, error)

IsControlSocketPresent determines if the control socket is present and accessible.

func (*OS) ServerCert

func (s *OS) ServerCert() (*shared.CertInfo, error)

ServerCert gets the local server certificate from the state directory.

type Watcher

type Watcher struct {
	*fsnotify.Watcher
	// contains filtered or unexported fields
}

Watcher represents an fsnotify watcher.

func NewWatcher

func NewWatcher(ctx context.Context, root string) (*Watcher, error)

NewWatcher returns a watcher listening for fsnotify events down the given dir.

func (*Watcher) Watch

func (w *Watcher) Watch(path string, fileExt string, f func(path string, event fsnotify.Op) error)

Watch adds a hook to be executed on create/remove events on files with the given extension under the given path.

Jump to

Keyboard shortcuts

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