config

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoZetaDir               = ""
	FragmentThreshold int64 = 1 * strengthen.GiByte //1G
	FragmentSize      int64 = 1 * strengthen.GiByte //1G
)
View Source
const (
	UNSPECIFIED = ""
	BOOLEAN     = "bool"
	INTEGER     = "int"
	BOOLORINT   = "bool-or-int"
	PATH        = "path"
	DATETIME    = "datetime"
)
View Source
const (
	BOOLEAN_UNSET = 0
	BOOLEAN_TRUE  = 1
	BOOLEAN_FALSE = 2
)
View Source
const (
	ENV_ZETA_CONFIG_SYSTEM = "ZETA_CONFIG_SYSTEM"
)
View Source
const (
	NUL = '\x00'
)

Variables

View Source
var (
	True  = Boolean{/* contains filtered or unexported fields */}
	False = Boolean{/* contains filtered or unexported fields */}
)
View Source
var (
	ErrInvalidArgument = errors.New("invalid argument")
)
View Source
var (
	ErrKeyNotFound = errors.New("key not found")
)

Functions

func DisplayGlobal

func DisplayGlobal(opts *DisplayOptions) error

func DisplayLocal

func DisplayLocal(opts *DisplayOptions, zetaDir string) error

func DisplaySystem

func DisplaySystem(opts *DisplayOptions) error

func Encode

func Encode(zetaDir string, config *Config) error

func EncodeGlobal

func EncodeGlobal(config *Config) error

func Get

func Get(opts *GetOptions, zetaDir string, found bool) error

func GetGlobal

func GetGlobal(opts *GetOptions) error

func GetLocal

func GetLocal(opts *GetOptions, zetaDir string) error

func GetSystem

func GetSystem(opts *GetOptions) error

func IsErrBadConfigKey

func IsErrBadConfigKey(err error) bool

func UnsetGlobal

func UnsetGlobal(keys ...string) error

func UnsetLocal

func UnsetLocal(zetaDir string, keys ...string) error

func UnsetSystem

func UnsetSystem(keys ...string) error

func UpdateGlobal

func UpdateGlobal(opts *UpdateOptions) error

func UpdateLocal

func UpdateLocal(zetaDir string, opts *UpdateOptions) error

func UpdateSystem

func UpdateSystem(opts *UpdateOptions) error

Types

type Accelerator

type Accelerator string
const (
	Direct    Accelerator = "direct"
	Dragonfly Accelerator = "dragonfly"
	Aria2     Accelerator = "aria2" // https://github.com/aria2/aria2
)

type Boolean

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

func (*Boolean) False

func (b *Boolean) False() bool

func (*Boolean) IsUnset

func (b *Boolean) IsUnset() bool

func (*Boolean) Merge

func (b *Boolean) Merge(other *Boolean)

func (*Boolean) Set

func (b *Boolean) Set(v bool) bool

func (*Boolean) True

func (b *Boolean) True() bool

func (*Boolean) UnmarshalTOML

func (b *Boolean) UnmarshalTOML(a any) error

func (*Boolean) Unset

func (b *Boolean) Unset()

type Config

type Config struct {
	Core      Core      `toml:"core,omitempty"`
	User      User      `toml:"user,omitempty"`
	Fragment  Fragment  `toml:"fragment,omitempty"`
	HTTP      HTTP      `toml:"http,omitempty"`
	Transport Transport `toml:"transport,omitempty"`
}

func Load

func Load(zetaDir string) (*Config, error)

func LoadBaseline

func LoadBaseline() (*Config, error)

func LoadGlobal

func LoadGlobal() (*Config, error)

func LoadSystem

func LoadSystem() (*Config, error)

func (*Config) Overwrite

func (c *Config) Overwrite(co *Config)

Overwrite: use local config overwrite config

type Core

type Core struct {
	SharingRoot         string      `toml:"sharingRoot,omitempty"` // GLOBAL
	HooksPath           string      `toml:"hooksPath,omitempty"`   // GLOBAL
	Remote              string      `toml:"remote,omitempty"`
	Snapshot            bool        `toml:"snapshot,omitempty"`
	SparseDirs          StringArray `toml:"sparse,omitempty"`
	HashALGO            string      `toml:"hash-algo,omitempty"`
	CompressionALGO     string      `toml:"compression-algo,omitempty"`
	Editor              string      `toml:"editor,omitempty"`
	OptimizeStrategy    Strategy    `toml:"optimizeStrategy,omitempty"`   // zeta config core.optimizeStrategy eager OR ZETA_CORE_OPTIMIZE_STRATEGY="eager"
	Accelerator         Accelerator `toml:"accelerator,omitempty"`        // zeta config core.accelerator dragonfly OR ZETA_CORE_ACCELERATOR="dragonfly"
	ConcurrentTransfers int         `toml:"concurrenttransfers,omitzero"` // zeta config core.concurrenttransfers 8 OR ZETA_CORE_CONCURRENT_TRANSFERS=8
}

func (*Core) IsExtreme

func (c *Core) IsExtreme() bool

IsExtreme: Extreme cleanup strategy to delete large object snapshots in the repository. Typically used in AI scenarios, it is no longer necessary to save blobs when downloading models.

func (*Core) Overwrite

func (c *Core) Overwrite(o *Core)

type Display

type Display interface {
	Show(a any, keys ...string) error
}

type DisplayOptions

type DisplayOptions struct {
	io.Writer
	Z       bool
	Verbose bool
}

func (*DisplayOptions) DbgPrint

func (opts *DisplayOptions) DbgPrint(format string, args ...any)

func (*DisplayOptions) Show

func (opts *DisplayOptions) Show(a any, keys ...string) error

type ErrBadConfigKey

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

ErrNotExist commit not exist error

func (*ErrBadConfigKey) Error

func (err *ErrBadConfigKey) Error() string

type Fragment

type Fragment struct {
	ThresholdRaw Size `toml:"threshold,omitempty"`
	SizeRaw      Size `toml:"size,omitempty"`
}

func (*Fragment) Overwrite

func (f *Fragment) Overwrite(o *Fragment)

func (Fragment) Size

func (f Fragment) Size() int64

func (Fragment) Threshold

func (f Fragment) Threshold() int64

type GetOptions

type GetOptions struct {
	io.Writer
	Keys    []string
	ALL     bool
	Z       bool
	Verbose bool
}

func (*GetOptions) DbgPrint

func (opts *GetOptions) DbgPrint(format string, args ...any)

type HTTP

type HTTP struct {
	ExtraHeader StringArray `toml:"extraHeader,omitempty"`
	SSLVerify   Boolean     `toml:"sslVerify,omitempty"`
}

func (*HTTP) Overwrite

func (h *HTTP) Overwrite(o *HTTP)

type Section

type Section map[string]any

type Sections

type Sections map[string]Section

type Size

type Size struct {
	Size int64
}

func (*Size) UnmarshalText

func (s *Size) UnmarshalText(text []byte) (err error)

type Strategy

type Strategy string // Prune strategy
const (
	STRATEGY_UNSPECIFIED Strategy = "unspecified"
	STRATEGY_HEURISTICAL Strategy = "heuristical"
	STRATEGY_EAGER       Strategy = "eager"
	STRATEGY_EXTREME     Strategy = "extreme"
)

type StringArray

type StringArray []string

func (*StringArray) UnmarshalTOML

func (a *StringArray) UnmarshalTOML(data any) error

type Transport

type Transport struct {
	MaxEntries   int  `toml:"maxEntries,omitempty"`
	LargeSizeRaw Size `toml:"largeSize,omitempty"`
}

func (Transport) LargeSize

func (t Transport) LargeSize() int64

func (*Transport) Overwrite

func (t *Transport) Overwrite(o *Transport)

type UpdateOptions

type UpdateOptions struct {
	Values map[string]any
	Append bool
}

type User

type User struct {
	Name  string `toml:"name,omitempty"`
	Email string `toml:"email,omitempty"`
}

func (*User) Empty

func (u *User) Empty() bool

func (*User) Overwrite

func (u *User) Overwrite(o *User)

Jump to

Keyboard shortcuts

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