config

package
v2.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Server struct {
		Port                             int   `yaml:"port"`
		MaxCommitRetryTimeout            int64 `yaml:"maxCommitRetryTimeout"`
		MaxRollbackRetryTimeout          int64 `yaml:"maxRollbackRetryTimeout"`
		RollbackDeadSeconds              int64 `yaml:"rollback_dead_seconds"`
		RollbackRetryTimeoutUnlockEnable bool  `yaml:"rollbackRetryTimeoutUnlockEnable"`

		AsyncCommittingRetryPeriod time.Duration `yaml:"asyncCommittingRetryPeriod"`
		CommittingRetryPeriod      time.Duration `yaml:"committingRetryPeriod"`
		RollingBackRetryPeriod     time.Duration `yaml:"rollingBackRetryPeriod"`
		TimeoutRetryPeriod         time.Duration `yaml:"timeoutRetryPeriod"`

		StreamMessageTimeout time.Duration `yaml:"streamMessageTimeout"`
	} `yaml:"server"`

	EnforcementPolicy struct {
		MinTime             time.Duration `yaml:"minTime"`
		PermitWithoutStream bool          `yaml:"permitWithoutStream"`
	} `yaml:"enforcementPolicy"`

	ServerParameters struct {
		MaxConnectionIdle     time.Duration `yaml:"maxConnectionIdle"`
		MaxConnectionAge      time.Duration `yaml:"maxConnectionAge"`
		MaxConnectionAgeGrace time.Duration `yaml:"maxConnectionAgeGrace"`
		Time                  time.Duration `yaml:"time"`
		Timeout               time.Duration `yaml:"timeout"`
	} `yaml:"serverParameters"`

	ServerTLS struct {
		Enable       bool   `yaml:"enable"`
		CertFilePath string `yaml:"certFilePath"`
		KeyFilePath  string `yaml:"keyFilePath"`
	} `yaml:"serverTLS"`

	// Storage is the configuration for the storage driver
	Storage Storage `yaml:"storage"`

	Log struct {
		LogPath  string    `yaml:"logPath"`
		LogLevel log.Level `yaml:"logLevel"`
	} `yaml:"log"`
}

Configuration is a versioned registry configuration, intended to be provided by a yaml file, and optionally modified by environment variables.

Note that yaml field names should never include _ characters, since this is the separator used in environment variable names.

func Parse

func Parse(rd io.Reader) (*Configuration, error)

Parse parses an input configuration yaml document into a Configuration struct

Environment variables may be used to override configuration parameters other than version, following the scheme below: Configuration.Abc may be replaced by the value of SEATA_ABC, Configuration.Abc.Xyz may be replaced by the value of SEATA_ABC_XYZ, and so forth

func (*Configuration) GetEnforcementPolicy

func (configuration *Configuration) GetEnforcementPolicy() keepalive.EnforcementPolicy

func (*Configuration) GetServerParameters

func (configuration *Configuration) GetServerParameters() keepalive.ServerParameters

func (*Configuration) GetServerTLS added in v2.0.7

func (configuration *Configuration) GetServerTLS() credentials.TransportCredentials

type Parameters

type Parameters map[string]interface{}

Parameters defines a key-value parameters mapping

type Storage

type Storage map[string]Parameters

Storage defines the configuration for registry object storage

func (Storage) MarshalYAML

func (storage Storage) MarshalYAML() (interface{}, error)

MarshalYAML implements the yaml.Marshaler interface

func (Storage) Parameters

func (storage Storage) Parameters() Parameters

Parameters returns the Parameters map for a Storage configuration

func (Storage) Type

func (storage Storage) Type() string

Type returns the storage driver type, such as filesystem or s3

func (*Storage) UnmarshalYAML

func (storage *Storage) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface Unmarshals a single item map into a Storage or a string into a Storage type with no parameters

Jump to

Keyboard shortcuts

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