config

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// TtlInSecsUnsetSentinel is the value internally
	// set for metada-cache:ttl-secs
	// when it is not set in the gcsfuse mount config file.
	// The constant value has been chosen deliberately
	// to be improbable for a user to explicitly set.
	TtlInSecsUnsetSentinel int64 = math.MinInt64

	// The maximum multiple of seconds representable by time.Duration.
	MaxSupportedTtlInSeconds int64 = int64(math.MaxInt64 / int64(time.Second))

	// DefaultTypeCacheMaxSizeMB is the default vlaue of type-cache max-size for every directory in MiBs.
	// The value is set at the size needed for about 21k type-cache entries,
	// each of which is about 200 bytes in size.
	DefaultTypeCacheMaxSizeMB int = 4

	// StatCacheMaxSizeMBUnsetSentinel is the value internally
	// set for metada-cache:stat-cache-max-size-mb
	// when it is not set in the gcsfuse mount config file.
	StatCacheMaxSizeMBUnsetSentinel int64 = math.MinInt64

	DefaultFileCacheMaxSizeMB               int64 = -1
	DefaultEnableEmptyManagedFoldersListing       = false
)
View Source
const (
	TRACE   LogSeverity = "TRACE"
	DEBUG   LogSeverity = "DEBUG"
	INFO    LogSeverity = "INFO"
	WARNING LogSeverity = "WARNING"
	ERROR   LogSeverity = "ERROR"
	OFF     LogSeverity = "OFF"

	MetadataCacheTtlSecsInvalidValueError = "the value of ttl-secs for metadata-cache can't be less than -1"
	MetadataCacheTtlSecsTooHighError      = "the value of ttl-secs in metadata-cache is too high to be supported. Max is 9223372036"
	TypeCacheMaxSizeMBInvalidValueError   = "the value of type-cache-max-size-mb for metadata-cache can't be less than -1"
	StatCacheMaxSizeMBInvalidValueError   = "the value of stat-cache-max-size-mb for metadata-cache can't be less than -1"
	StatCacheMaxSizeMBTooHighError        = "the value of stat-cache-max-size-mb for metadata-cache is too high! Max supported: 17592186044415"
	MaxSupportedStatCacheMaxSizeMB        = util.MaxMiBsInUint64
)

Variables

This section is empty.

Functions

func IsFileCacheEnabled

func IsFileCacheEnabled(mountConfig *MountConfig) bool

func IsValidLogRotateConfig

func IsValidLogRotateConfig(config LogRotateConfig) error

func IsValidLogSeverity

func IsValidLogSeverity(severity LogSeverity) bool

func OverrideWithLoggingFlags

func OverrideWithLoggingFlags(mountConfig *MountConfig, logFile string, logFormat string,
	debugFuse bool, debugGCS bool, debugMutex bool)

OverrideWithLoggingFlags overwrites the configs with the flag values if the config values are empty.

Types

type CacheDir

type CacheDir string

type FileCacheConfig

type FileCacheConfig struct {
	MaxSizeMB             int64 `yaml:"max-size-mb"`
	CacheFileForRangeRead bool  `yaml:"cache-file-for-range-read"`
}

type ListConfig

type ListConfig struct {
	// This flag is specially added to handle the corner case in listing managed folders.
	// There are two corner cases (a) empty managed folder (b) nested managed folder which doesn't contain any descendent as object.
	// This flag always works in conjunction with ImplicitDirectories flag.
	//
	// (a) If only ImplicitDirectories is true, all managed folders are listed other than above two mentioned case.
	// (b) If both ImplicitDirectories and EnableEmptyManagedFolders are true, then all the managed folders are listed including the above mentioned corner case.
	// (c) If ImplicitDirectories is false then no managed folders are listed irrespective of EnableEmptyManagedFolders flag.
	EnableEmptyManagedFolders bool `yaml:"enable-empty-managed-folders"`
}

type LogConfig

type LogConfig struct {
	Severity        LogSeverity     `yaml:"severity"`
	Format          string          `yaml:"format"`
	FilePath        string          `yaml:"file-path"`
	LogRotateConfig LogRotateConfig `yaml:"log-rotate"`
}

type LogRotateConfig

type LogRotateConfig struct {
	MaxFileSizeMB   int  `yaml:"max-file-size-mb"`
	BackupFileCount int  `yaml:"backup-file-count"`
	Compress        bool `yaml:"compress"`
}

LogRotateConfig defines the parameters for log rotation. It consists of three configuration options: 1. max-file-size-mb: specifies the maximum size in megabytes that a log file can reach before it is rotated. The default value is 512 megabytes. 2. backup-file-count: determines the maximum number of backup log files to retain after they have been rotated. The default value is 10. When value is set to 0, all backup files are retained. 3. compress: indicates whether the rotated log files should be compressed using gzip. The default value is False.

func DefaultLogRotateConfig

func DefaultLogRotateConfig() LogRotateConfig

type LogSeverity

type LogSeverity string

type MetadataCacheConfig

type MetadataCacheConfig struct {
	// TtlInSeconds is the ttl
	// value in seconds, to be used for stat-cache and type-cache.
	// It can be set to -1 for no-ttl, 0 for
	// no cache and > 0 for ttl-controlled metadata-cache.
	// Any value set below -1 will throw an error.
	TtlInSeconds int64 `yaml:"ttl-secs,omitempty"`
	// TypeCacheMaxSizeMB is the upper limit
	// on the maximum size of type-cache maps,
	// which are currently
	// maintained at per-directory level.
	TypeCacheMaxSizeMB int `yaml:"type-cache-max-size-mb,omitempty"`

	// StatCacheMaxSizeMB is the maximum size of stat-cache
	// in MiBs.
	// It can also be set to -1 for no-size-limit, 0 for
	// no cache. Values below -1 are not supported.
	StatCacheMaxSizeMB int64 `yaml:"stat-cache-max-size-mb,omitempty"`
}

type MountConfig

type MountConfig struct {
	WriteConfig         `yaml:"write"`
	LogConfig           `yaml:"logging"`
	FileCacheConfig     `yaml:"file-cache"`
	CacheDir            `yaml:"cache-dir"`
	MetadataCacheConfig `yaml:"metadata-cache"`
	ListConfig          `yaml:"list"`
}

func NewMountConfig

func NewMountConfig() *MountConfig

func ParseConfigFile

func ParseConfigFile(fileName string) (mountConfig *MountConfig, err error)

type WriteConfig

type WriteConfig struct {
	CreateEmptyFile bool `yaml:"create-empty-file"`
}

Jump to

Keyboard shortcuts

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