conf

package
v0.0.0-...-aef646c Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Pull
	DefaultHealthbeatPeriod = util.Duration{1 * time.Second}
	// Client Side
	DefaultMemInfoPeriod        = util.Duration{5 * time.Second}
	DefaultCPUUtilizationPeriod = util.Duration{5 * time.Second}
	DefaultNetUsagePeriod       = util.Duration{5 * time.Second}
)

Defaults for Client Conf: if file doesn't exist.

Functions

func ClientAddCPUUtilizationPeriod

func ClientAddCPUUtilizationPeriod(builder *flatbuffers.Builder, CPUUtilizationPeriod int64)

func ClientAddDataCenter

func ClientAddDataCenter(builder *flatbuffers.Builder, DataCenter flatbuffers.UOffsetT)

func ClientAddHealthbeatPeriod

func ClientAddHealthbeatPeriod(builder *flatbuffers.Builder, HealthbeatPeriod int64)

func ClientAddHostname

func ClientAddHostname(builder *flatbuffers.Builder, Hostname flatbuffers.UOffsetT)

func ClientAddID

func ClientAddID(builder *flatbuffers.Builder, ID flatbuffers.UOffsetT)

func ClientAddMemInfoPeriod

func ClientAddMemInfoPeriod(builder *flatbuffers.Builder, MemInfoPeriod int64)

func ClientAddNetUsagePeriod

func ClientAddNetUsagePeriod(builder *flatbuffers.Builder, NetUsagePeriod int64)

func ClientAddRegion

func ClientAddRegion(builder *flatbuffers.Builder, Region flatbuffers.UOffsetT)

func ClientAddZone

func ClientAddZone(builder *flatbuffers.Builder, Zone flatbuffers.UOffsetT)

func ClientEnd

func ClientEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT

func ClientStart

func ClientStart(builder *flatbuffers.Builder)

func ClientStartIDVector

func ClientStartIDVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT

func SysInfAddCPU

func SysInfAddCPU(builder *flatbuffers.Builder, CPU byte)

func SysInfAddCPUFlags

func SysInfAddCPUFlags(builder *flatbuffers.Builder, CPUFlags byte)

func SysInfAddMem

func SysInfAddMem(builder *flatbuffers.Builder, Mem byte)

func SysInfAddNetInf

func SysInfAddNetInf(builder *flatbuffers.Builder, NetInf byte)

func SysInfEnd

func SysInfEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT

func SysInfStart

func SysInfStart(builder *flatbuffers.Builder)

Types

type Client

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

func GetRootAsClient

func GetRootAsClient(buf []byte, offset flatbuffers.UOffsetT) *Client

func (*Client) CPUUtilizationPeriod

func (rcv *Client) CPUUtilizationPeriod() int64

func (*Client) DataCenter

func (rcv *Client) DataCenter() []byte

func (*Client) Deserialize

func (c *Client) Deserialize(p []byte)

Deserialize deserializes the bytes into the current Client Conf.

func (*Client) HealthbeatPeriod

func (rcv *Client) HealthbeatPeriod() int64

func (*Client) Hostname

func (rcv *Client) Hostname() []byte

func (*Client) ID

func (rcv *Client) ID(j int) byte

func (*Client) IDBytes

func (rcv *Client) IDBytes() []byte

func (*Client) IDLength

func (rcv *Client) IDLength() int

func (*Client) Init

func (rcv *Client) Init(buf []byte, i flatbuffers.UOffsetT)

func (*Client) MemInfoPeriod

func (rcv *Client) MemInfoPeriod() int64

func (*Client) NetUsagePeriod

func (rcv *Client) NetUsagePeriod() int64

func (*Client) Region

func (rcv *Client) Region() []byte

func (*Client) Serialize

func (c *Client) Serialize() []byte

Serialize serializes the Client conf.

func (*Client) Zone

func (rcv *Client) Zone() []byte

type Collect

type Collect struct {
	HealthbeatPeriod     util.Duration `json:"healthbeat_period"`
	CPUUtilizationPeriod util.Duration `json:"cpuutilization_period"`
	MemInfoPeriod        util.Duration `json:"meminfo_period"`
	NetUsagePeriod       util.Duration `json:"netusage_period"`
	Filename             string        `json:"-"`
}

Collect defines the collection periods of various data.

func (*Collect) Deserialize

func (c *Collect) Deserialize(p []byte)

Deserialize deserializes serialized conf.Client into Collect.

func (*Collect) Load

func (c *Collect) Load(dir, name string) error

Load loads the Collect configuration from the specified file.

func (*Collect) SaveJSON

func (c *Collect) SaveJSON(dir string) error

func (*Collect) Serialize

func (c *Collect) Serialize() []byte

Serialize serializes the struct as a conf.Client.

func (*Collect) UseDefaults

func (c *Collect) UseDefaults()

Returns a Collect with application defaults. This is called when the collect file cannot be found.

type Conf

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

Conf is used to hold flag arguments passed on start

func (*Conf) Args

func (c *Conf) Args() []*flag.Flag

Args returns all of the args that were passed.

func (*Conf) Flag

func (c *Conf) Flag(s string) *flag.Flag

Flag returns the requested flag, if it was set, or nil.

func (*Conf) Visited

func (c *Conf) Visited(a *flag.Flag)

Visited builds a list of the names of the flags that were passed as args.

type Conn

type Conn struct {
	ID              []byte        `json:"id"`
	ServerAddress   string        `json:"server_address"`
	ServerPort      string        `json:"server_port"`
	ServerID        uint32        `json:"server_id"`
	ConnectInterval util.Duration `json:"connect_interval"`
	ConnectPeriod   util.Duration `json:"connect_period"`
	Filename        string        `json:"-"`
	Conf            `json:"-"`
}

Conn holds the connection information for a node. This is all that is persisted on a client node.

func (*Conn) Load

func (c *Conn) Load(name string) error

LoadConn loads the config file. The Conn's filename is set during this operation. TODO: revisit this design decision.

func (*Conn) Save

func (c *Conn) Save() error

type SysInf

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

func GetRootAsSysInf

func GetRootAsSysInf(buf []byte, offset flatbuffers.UOffsetT) *SysInf

func (*SysInf) CPU

func (rcv *SysInf) CPU() byte

func (*SysInf) CPUFlags

func (rcv *SysInf) CPUFlags() byte

func (*SysInf) Init

func (rcv *SysInf) Init(buf []byte, i flatbuffers.UOffsetT)

func (*SysInf) Mem

func (rcv *SysInf) Mem() byte

func (*SysInf) NetInf

func (rcv *SysInf) NetInf() byte

Jump to

Keyboard shortcuts

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