configuration

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package configuration provides loading facilities for Mutagen's global configuration file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteSize added in v0.8.0

type ByteSize uint64

ByteSize is a uint64 value that supports unmarshalling from both human-friendly string representations and numeric representations. It can be cast to a uint64 value, where it represents a byte count.

func (*ByteSize) UnmarshalText added in v0.8.0

func (s *ByteSize) UnmarshalText(textBytes []byte) error

UnmarshalText implements the text unmarshalling interface used when loading from TOML files.

type Configuration

type Configuration struct {
	// Synchronization contains parameters related to synchronization behavior.
	Synchronization struct {
		// Mode specifies the default synchronization mode.
		Mode sync.SynchronizationMode `toml:"mode"`
		// MaximumEntryCount specifies the maximum number of filesystem entries
		// that endpoints will tolerate managing.
		MaximumEntryCount uint64 `toml:"maxEntryCount"`
		// MaximumStagingFileSize is the maximum (individual) file size that
		// endpoints will stage. It can be specified in human-friendly units.
		MaximumStagingFileSize ByteSize `toml:"maxStagingFileSize"`
	} `toml:"sync"`

	// Ignore contains parameters related to synchronization ignore
	// specifications.
	Ignore struct {
		// Default specifies the default list of ignore specifications.
		Default []string `toml:"default"`

		// VCS specifies the VCS ignore mode.
		VCS sync.IgnoreVCSMode `toml:"vcs"`
	} `toml:"ignore"`

	// Symlink contains parameters related to symlink handling.
	Symlink struct {
		// Mode specifies the symlink mode.
		Mode sync.SymlinkMode `toml:"mode"`
	} `toml:"symlink"`

	// Watch contains parameters related to filesystem monitoring.
	Watch struct {
		// Mode specifies the file watching mode.
		Mode filesystem.WatchMode `toml:"mode"`

		// PollingInterval specifies the interval (in seconds) for poll-based
		// file monitoring. A value of 0 specifies that Mutagen's internal
		// default interval should be used.
		PollingInterval uint32 `toml:"pollingInterval"`
	} `toml:"watch"`

	// Permissions contains parameters related to permission handling.
	Permissions struct {
		// DefaultFileMode specifies the default permission mode to use for new
		// files in "portable" permission propagation mode.
		DefaultFileMode filesystem.Mode `toml:"defaultFileMode"`

		// DefaultDirectoryMode specifies the default permission mode to use for
		// new files in "portable" permission propagation mode.
		DefaultDirectoryMode filesystem.Mode `toml:"defaultDirectoryMode"`

		// DefaultOwner specifies the default owner identifier to use when
		// setting ownership of new files and directories in "portable"
		// permission propagation mode.
		DefaultOwner string `toml:"defaultOwner"`

		// DefaultGroup specifies the default group identifier to use when
		// setting ownership of new files and directories in "portable"
		// permission propagation mode.
		DefaultGroup string `toml:"defaultGroup"`
	} `toml:"permissions"`
}

Configuration represents the global Mutagen configuration.

func Load

func Load() (*Configuration, error)

Load loads the Mutagen configuration file from disk and populates a Configuration structure. If the Mutagen configuration file does not exist, this method will return a structure with the default configuration values. The returned structure is not re-used, so its members can be freely mutated.

Jump to

Keyboard shortcuts

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