Documentation
¶
Index ¶
- Constants
- func NewEtcdEventStream(kapi etcd.KeysAPI, keyPrefix string) pkg.EventStream
- type EtcdEventStream
- type EtcdRegistry
- func (r *EtcdRegistry) Bootstrap() (err error)
- func (r *EtcdRegistry) DeleteProcess(procID string) (*proc.ProcessStatus, error)
- func (r *EtcdRegistry) GenerateProcID() (string, error)
- func (r *EtcdRegistry) GetEtcdAddrs() string
- func (r *EtcdRegistry) IsBootstrapped(cfg *config.Config) bool
- func (r *EtcdRegistry) Machine(machID string) (*machine.MachineStatus, error)
- func (r *EtcdRegistry) Machines() (map[string]*machine.MachineStatus, error)
- func (r *EtcdRegistry) NewProcess(machID, svcName string, hostIP, hostName, hostRegion, hostIDC string, ...) error
- func (r *EtcdRegistry) Process(procID string) (*proc.ProcessStatus, error)
- func (r *EtcdRegistry) Processes() (map[string]*proc.ProcessStatus, error)
- func (r *EtcdRegistry) ProcessesOfService(svcName string) (map[string]*proc.ProcessStatus, error)
- func (r *EtcdRegistry) ProcessesOnMachine(machID string) (map[string]*proc.ProcessStatus, error)
- func (r *EtcdRegistry) RefreshMachine(machID string, machStat machine.MachineStat, ttl time.Duration) error
- func (r *EtcdRegistry) RegisterMachine(machID, hostName, hostRegion, hostIDC, publicIP string) error
- func (r *EtcdRegistry) UpdateProcessDesiredState(procID string, state proc.ProcessState) error
- func (r *EtcdRegistry) UpdateProcessState(procID, machID, svcName string, state proc.ProcessState, isAlive bool, ...) error
- type Registry
Constants ¶
View Source
const ( // Occurs when any Process's target state is touched ProcessTargetStateChangeEvent = pkg.Event("ProcessTargetStateChangeEvent") // Occurs when any Machine's state is touched MachineStateChangeEvent = pkg.Event("MachineStateChangeEvent") )
Variables ¶
This section is empty.
Functions ¶
func NewEtcdEventStream ¶
func NewEtcdEventStream(kapi etcd.KeysAPI, keyPrefix string) pkg.EventStream
Types ¶
type EtcdEventStream ¶
type EtcdEventStream struct {
// contains filtered or unexported fields
}
type EtcdRegistry ¶
type EtcdRegistry struct {
// contains filtered or unexported fields
}
EtcdRegistry implement the Registry interface and uses etcd as backend
func (*EtcdRegistry) Bootstrap ¶
func (r *EtcdRegistry) Bootstrap() (err error)
func (*EtcdRegistry) DeleteProcess ¶
func (r *EtcdRegistry) DeleteProcess(procID string) (*proc.ProcessStatus, error)
func (*EtcdRegistry) GenerateProcID ¶
func (r *EtcdRegistry) GenerateProcID() (string, error)
func (*EtcdRegistry) GetEtcdAddrs ¶
func (r *EtcdRegistry) GetEtcdAddrs() string
func (*EtcdRegistry) IsBootstrapped ¶
func (r *EtcdRegistry) IsBootstrapped(cfg *config.Config) bool
func (*EtcdRegistry) Machine ¶
func (r *EtcdRegistry) Machine(machID string) (*machine.MachineStatus, error)
func (*EtcdRegistry) Machines ¶
func (r *EtcdRegistry) Machines() (map[string]*machine.MachineStatus, error)
func (*EtcdRegistry) NewProcess ¶
func (*EtcdRegistry) Process ¶
func (r *EtcdRegistry) Process(procID string) (*proc.ProcessStatus, error)
func (*EtcdRegistry) Processes ¶
func (r *EtcdRegistry) Processes() (map[string]*proc.ProcessStatus, error)
func (*EtcdRegistry) ProcessesOfService ¶
func (r *EtcdRegistry) ProcessesOfService(svcName string) (map[string]*proc.ProcessStatus, error)
func (*EtcdRegistry) ProcessesOnMachine ¶
func (r *EtcdRegistry) ProcessesOnMachine(machID string) (map[string]*proc.ProcessStatus, error)
func (*EtcdRegistry) RefreshMachine ¶
func (r *EtcdRegistry) RefreshMachine(machID string, machStat machine.MachineStat, ttl time.Duration) error
func (*EtcdRegistry) RegisterMachine ¶
func (r *EtcdRegistry) RegisterMachine(machID, hostName, hostRegion, hostIDC, publicIP string) error
func (*EtcdRegistry) UpdateProcessDesiredState ¶
func (r *EtcdRegistry) UpdateProcessDesiredState(procID string, state proc.ProcessState) error
func (*EtcdRegistry) UpdateProcessState ¶
func (r *EtcdRegistry) UpdateProcessState(procID, machID, svcName string, state proc.ProcessState, isAlive bool, ttl time.Duration) error
type Registry ¶
type Registry interface {
GetEtcdAddrs() string
// Check whether tiadmin registry is bootstrapped normally
IsBootstrapped(*config.Config) bool
// Initialize the basic directory structure of tiadmin registry
Bootstrap() error
// Get Infomation of machine in cluster by the given machID
Machine(machID string) (*machine.MachineStatus, error)
// Retrieve all machines in Ti-Cluster,
// return a map of machID to machineStatus
Machines() (map[string]*machine.MachineStatus, error)
// Create new machine node in etcd
RegisterMachine(machID, hostName, hostRegion, hostIDC, publicIP string) error
// Update statistic info of machine and refresh the TTL of alive state in etcd
RefreshMachine(machID string, machStat machine.MachineStat, ttl time.Duration) error
// Return the status of process with specified procID
Process(procID string) (*proc.ProcessStatus, error)
// Retrieve all processes in Ti-Cluster,
// with either running or stopped state
// return a map of procID to processStatus
Processes() (map[string]*proc.ProcessStatus, error)
// Retrieve processes which scheduled at the specified host by given machID
// return a map of procID to status infomation of process
ProcessesOnMachine(machID string) (map[string]*proc.ProcessStatus, error)
// Retrieve all processes instantiated from the specified service
// return a map of procID to status infomation of process
ProcessesOfService(svcName string) (map[string]*proc.ProcessStatus, error)
// Create new process node of specified service in etcd
NewProcess(machID, svcName string, hostIP, hostName, hostRegion, hostIDC string,
executor []string, command string, args []string, env map[string]string, endpoints map[string]pkg.Endpoint) error
// Destroy the process, normally the process should be in stopped state
DeleteProcess(procID string) (*proc.ProcessStatus, error)
// Update process desirede state in etcd
UpdateProcessDesiredState(procID string, state proc.ProcessState) error
// Update process current state in etcd, notice that isAlive is real run state of the local process
UpdateProcessState(procID, machID, svcName string, state proc.ProcessState, isAlive bool, ttl time.Duration) error
}
Registry interface defined a set of operations to access a distributed key value store, which always organizes data as directory structure, simlilar to a file system. now we implemented a registry driving ETCD as backend
Click to show internal directories.
Click to hide internal directories.