hadoopconf

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoSource = Source{}

Functions

This section is empty.

Types

type Conf

type Conf interface {
	Keys() []string
	Set(key, val string) (oldval string)
	Get(key string) string
}

type ConfSourcer

type ConfSourcer interface {
	Conf
	SourceGet(key string) (value string, src Source)
	Source() string
}

func ConfFromJar

func ConfFromJar(jar string, file string) (ConfSourcer, error)

func ConfsFromJar

func ConfsFromJar(jar string, files ...string) ([]ConfSourcer, error)

type ConfWithDefault

type ConfWithDefault struct {
	Conf    ConfSourcer
	Default ConfSourcer
}

func (*ConfWithDefault) Get

func (cwd *ConfWithDefault) Get(key string) (value string)

func (*ConfWithDefault) Keys

func (cwd *ConfWithDefault) Keys() []string

func (*ConfWithDefault) Set

func (cwd *ConfWithDefault) Set(key, value string) (oldval string)

func (*ConfWithDefault) Source

func (cwd *ConfWithDefault) Source() string

func (*ConfWithDefault) SourceGet

func (cwd *ConfWithDefault) SourceGet(key string) (value string, src Source)

type Configuration

type Configuration struct {
	XMLName  xml.Name    `xml:"configuration"`
	Property []*Property `xml:"property"`
}

func NewConfigurationFromByte

func NewConfigurationFromByte(b []byte) (*Configuration, error)

func NewConfigurationFromFile

func NewConfigurationFromFile(path string) (*Configuration, error)

func NewConfigurationFromString

func NewConfigurationFromString(txt string) (*Configuration, error)

func (*Configuration) Bytes

func (c *Configuration) Bytes() []byte

func (*Configuration) Get

func (c *Configuration) Get(key string) string

func (*Configuration) Set

func (c *Configuration) Set(key, val string) (oldval string)

func (*Configuration) String

func (c *Configuration) String() string

type Env

type Env struct {
	Path string
	Vars []*Var
}

an evironment variable is a line of the form export FOO_OPT="-a -b -c" in a bash environment file.

func NewEnvFromFile

func NewEnvFromFile(path string) (*Env, error)

func (*Env) Get

func (env *Env) Get(name string) *Var

func (*Env) GetValue

func (env *Env) GetValue(name string) string

func (*Env) Keys

func (env *Env) Keys() []string

func (*Env) Save

func (env *Env) Save() error

type Envs

type Envs []*Env

func NewEnv

func NewEnv(path string) (Envs, error)

func (Envs) Get

func (envs Envs) Get(name string) *Var

func (Envs) Keys

func (envs Envs) Keys() []string

func (Envs) Save

func (envs Envs) Save() error

type FileConfiguration

type FileConfiguration struct {
	*Configuration
	Path string
	// contains filtered or unexported fields
}

func NewFileConfiguration

func NewFileConfiguration(path string) (*FileConfiguration, error)

func (*FileConfiguration) Keys

func (fc *FileConfiguration) Keys() []string

func (*FileConfiguration) Save

func (fc *FileConfiguration) Save() error

func (*FileConfiguration) Set

func (fc *FileConfiguration) Set(key, val string) (oldval string)

func (*FileConfiguration) Source

func (fc *FileConfiguration) Source() string

func (*FileConfiguration) SourceGet

func (fc *FileConfiguration) SourceGet(key string) (value string, source Source)

type GeneratedConf

type GeneratedConf struct {
	*Configuration
	ConfSource Source
}

func NewGeneratedConf

func NewGeneratedConf(source Source, conf *Configuration) *GeneratedConf

func NewGeneratedConfFromBytes

func NewGeneratedConfFromBytes(source Source, b []byte) (*GeneratedConf, error)

func NewGeneratedConfFromString

func NewGeneratedConfFromString(source Source, s string) (*GeneratedConf, error)

func (*GeneratedConf) Keys

func (gc *GeneratedConf) Keys() []string

func (*GeneratedConf) Source

func (gc *GeneratedConf) Source() string

func (*GeneratedConf) SourceGet

func (gc *GeneratedConf) SourceGet(key string) (value string, source Source)

type HadoopConf

type HadoopConf struct {
	CoreSite   *ConfWithDefault
	HdfsSite   *ConfWithDefault
	MapredSite *ConfWithDefault
	YarnSite   *ConfWithDefault
	// contains filtered or unexported fields
}

func FromConf

func FromConf(coreSite *ConfWithDefault, hdfsSite *ConfWithDefault,
	mapredSite *ConfWithDefault, yarnSite *ConfWithDefault) *HadoopConf

func New

func New(basedir string, defaultConf *HadoopDefaultConf) (conf *HadoopConf, err error)

func (HadoopConf) Keys

func (msc HadoopConf) Keys() []string

func (*HadoopConf) Save

func (c *HadoopConf) Save() error

func (HadoopConf) SetIfExist

func (msc HadoopConf) SetIfExist(key, value string) (oldval string, src ConfSourcer)

func (HadoopConf) SourceGet

func (msc HadoopConf) SourceGet(key string) (string, Source)

type HadoopDefaultConf

type HadoopDefaultConf struct {
	CoreSite   ConfSourcer
	HdfsSite   ConfSourcer
	MapredSite ConfSourcer
	YarnSite   ConfSourcer
}

func Jars

func Jars(basedir string) (*HadoopDefaultConf, error)

type Property

type Property struct {
	Name        string `xml:"name"`
	Value       string `xml:"value"`
	Description string `xml:"description"`
}

type Source

type Source struct {
	Source     string
	SourceType SourceType
}

type SourceType

type SourceType int
const (
	LocalFile SourceType = iota
	FileFromJar
	Generated
)

type Var

type Var struct {
	Source string
	Name   string
	Val    string
	// contains filtered or unexported fields
}

func (*Var) Append

func (v *Var) Append(tok string)

func (*Var) Del

func (v *Var) Del(val string)

Del deletes value from the variable

func (*Var) Prepend

func (v *Var) Prepend(tok string)

func (*Var) Update

func (v *Var) Update(update, newval string)

Update adds a toadd, only if there's no tocheck already in the value. Use case is

v.Update("-Xmx=", "-Xmx=1g")

which updates occurences of -Xmx=... to -Xmx=1g

Jump to

Keyboard shortcuts

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