frontgate

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2019 License: Apache-2.0 Imports: 39 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultEtcdMaxOpsPerTxn = 128

Variables

View Source
var (
	FrontgateVersion            = getShortVersion(version.ShortVersion)
	CheckInterval               = 10 * time.Second
	RetryInterval               = 3 * time.Second
	RetryCount                  = 5
	OpenPitrixReleaseUrlPattern = "https://github.com/openpitrix/openpitrix/releases/download/%s/openpitrix-%s-bin.tar.gz"
	HttpServePath               = "/opt/openpitrix/bin"
	DowloadPathPattern          = "/opt/openpitrix/bin/%s"
	DowloadFilePathPattern      = "/opt/openpitrix/bin/%s/%s"
	PilotVersionFilePath        = "/opt/openpitrix/conf/pilot-version"
	KeyPrefix                   = "/"
	KeyRegexp                   = regexp.MustCompile(`^\/\_metad\/mapping\/default\/(\d+\.\d+\.\d+\.\d+)\/host$`)
	EtcdEndpoints               = []string{"127.0.0.1:2379"}
)

Functions

func NewDefaultConfig

func NewDefaultConfig() *pbtypes.FrontgateConfig

func NewDefaultConfigString

func NewDefaultConfigString() string

func Serve

func Serve(cfg *ConfigManager, tlsPilotConfig *tls.Config)

func ServeReverseRpcServerForPilot

func ServeReverseRpcServerForPilot(
	cfg *pbtypes.FrontgateConfig, tlsConfig *tls.Config,
	service pbfrontgate.FrontgateService,
)

func WithFrontgateId

func WithFrontgateId(id string) func(opt *pbtypes.FrontgateConfig)

func WithFrontgateNodeList

func WithFrontgateNodeList(node ...*pbtypes.FrontgateEndpoint) func(opt *pbtypes.FrontgateConfig)

func WithListenPort

func WithListenPort(port int) func(opt *pbtypes.FrontgateConfig)

func WithPilotService

func WithPilotService(host string, port int) func(opt *pbtypes.FrontgateConfig)

Types

type ConfigManager

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

func NewConfigManager

func NewConfigManager(path string, cfg *pbtypes.FrontgateConfig, opts ...Options) *ConfigManager

func (*ConfigManager) Get

func (p *ConfigManager) Get() (cfg *pbtypes.FrontgateConfig)

func (*ConfigManager) Save

func (p *ConfigManager) Save() error

func (*ConfigManager) Set

func (p *ConfigManager) Set(cfg *pbtypes.FrontgateConfig) error

type EtcdClient

type EtcdClient struct {
	*clientv3.Client
	// contains filtered or unexported fields
}

func NewEtcdClient

func NewEtcdClient(endpoints []string, timeout time.Duration, maxTxnOps int) (*EtcdClient, error)

func NewEtcdClientWithConfig

func NewEtcdClientWithConfig(cfg clientv3.Config, maxTxnOps int) (*EtcdClient, error)

func (*EtcdClient) Clear

func (p *EtcdClient) Clear() error

func (*EtcdClient) Close

func (p *EtcdClient) Close() error

func (*EtcdClient) DelValues

func (p *EtcdClient) DelValues(keys ...string) error

func (*EtcdClient) DelValuesWithPrefix

func (p *EtcdClient) DelValuesWithPrefix(keyPrefixs ...string) error

func (*EtcdClient) DeregisterCmd

func (p *EtcdClient) DeregisterCmd(in *pbtypes.SubTask_DeregisterCmd) error

func (*EtcdClient) DeregisterMetadata

func (p *EtcdClient) DeregisterMetadata(in *pbtypes.SubTask_DeregisterMetadata) error

func (*EtcdClient) DeregisterMetadataMapping added in v0.2.3

func (p *EtcdClient) DeregisterMetadataMapping(in *pbtypes.SubTask_DeregisterMetadata) error

func (*EtcdClient) Get

func (p *EtcdClient) Get(key string) (val string, ok bool)

func (*EtcdClient) GetAllValues

func (p *EtcdClient) GetAllValues() (map[string]string, error)

func (*EtcdClient) GetStructValue

func (p *EtcdClient) GetStructValue(keyPrefix string, out interface{}) error

func (*EtcdClient) GetValues

func (p *EtcdClient) GetValues(keys ...string) (map[string]string, error)

func (*EtcdClient) GetValuesByPrefix

func (p *EtcdClient) GetValuesByPrefix(keyPrefix string) (map[string]string, error)

func (*EtcdClient) Ping added in v0.2.1

func (p *EtcdClient) Ping() error

func (*EtcdClient) RegisterCmd

func (p *EtcdClient) RegisterCmd(in *pbtypes.SubTask_RegisterCmd) error

func (*EtcdClient) RegisterMetadata

func (p *EtcdClient) RegisterMetadata(in *pbtypes.SubTask_RegisterMetadata) error

func (*EtcdClient) RegisterMetadataMapping added in v0.2.3

func (p *EtcdClient) RegisterMetadataMapping(in *pbtypes.SubTask_RegisterMetadata) error

func (*EtcdClient) Set

func (p *EtcdClient) Set(key, val string) error

func (*EtcdClient) SetStructValue

func (p *EtcdClient) SetStructValue(keyPrefix string, val interface{}) error

func (*EtcdClient) SetValues

func (p *EtcdClient) SetValues(m map[string]string) error

func (*EtcdClient) SetValuesWithPrefix added in v0.2.3

func (p *EtcdClient) SetValuesWithPrefix(prefix string, m map[string]string) error

type EtcdClientManager

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

func NewEtcdClientManager

func NewEtcdClientManager() *EtcdClientManager

func (*EtcdClientManager) Clear

func (p *EtcdClientManager) Clear()

func (*EtcdClientManager) ClearClient

func (p *EtcdClientManager) ClearClient(client *EtcdClient)

func (*EtcdClientManager) Get

func (p *EtcdClientManager) Get() (*EtcdClient, error)

func (*EtcdClientManager) GetClient

func (p *EtcdClientManager) GetClient(endpoints []string, timeout time.Duration, maxTxnOps int) (*EtcdClient, error)

type Options

type Options func(opt *pbtypes.FrontgateConfig)

type Server

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

func (*Server) ClosePilotChannel

func (p *Server) ClosePilotChannel(in *pbtypes.Empty, out *pbtypes.Empty) error

func (*Server) DeregisterCmd

func (p *Server) DeregisterCmd(in *pbtypes.SubTask_DeregisterCmd, out *pbtypes.Empty) error

func (*Server) DeregisterMetadata

func (p *Server) DeregisterMetadata(in *pbtypes.SubTask_DeregisterMetadata, out *pbtypes.Empty) error

func (*Server) DeregisterMetadataMapping added in v0.2.3

func (p *Server) DeregisterMetadataMapping(in *pbtypes.SubTask_DeregisterMetadata, out *pbtypes.Empty) error

func (*Server) GetConfdConfig

func (p *Server) GetConfdConfig(in *pbtypes.ConfdEndpoint, out *pbtypes.ConfdConfig) error

func (*Server) GetDroneConfig

func (p *Server) GetDroneConfig(in *pbtypes.DroneEndpoint, out *pbtypes.DroneConfig) error

func (*Server) GetDroneList

func (p *Server) GetDroneList(in *pbtypes.Empty, out *pbtypes.DroneIdList) error

func (*Server) GetDroneVersion added in v0.2.1

func (p *Server) GetDroneVersion(*pbtypes.DroneEndpoint, *pbtypes.Version) error

func (*Server) GetEtcdValues

func (p *Server) GetEtcdValues(in *pbtypes.StringList, out *pbtypes.StringMap) error

func (*Server) GetEtcdValuesByPrefix

func (p *Server) GetEtcdValuesByPrefix(in *pbtypes.String, out *pbtypes.StringMap) error

func (*Server) GetFrontgateConfig

func (p *Server) GetFrontgateConfig(in *pbtypes.Empty, out *pbtypes.FrontgateConfig) error

func (*Server) GetFrontgateVersion added in v0.2.1

func (p *Server) GetFrontgateVersion(*pbtypes.Empty, *pbtypes.Version) error

func (*Server) GetPilotConfig

func (p *Server) GetPilotConfig(in *pbtypes.Empty, out *pbtypes.PilotConfig) error

func (*Server) GetPilotVersion added in v0.2.1

func (p *Server) GetPilotVersion(*pbtypes.Empty, *pbtypes.Version) error

func (*Server) HeartBeat

func (p *Server) HeartBeat(in *pbtypes.Empty, out *pbtypes.Empty) error

func (*Server) IsConfdRunning

func (p *Server) IsConfdRunning(in *pbtypes.ConfdEndpoint, out *pbtypes.Bool) error

func (*Server) PingDrone

func (p *Server) PingDrone(in *pbtypes.DroneEndpoint, out *pbtypes.Empty) error

func (*Server) PingFrontgate

func (p *Server) PingFrontgate(in *pbtypes.Empty, out *pbtypes.Empty) error

func (*Server) PingFrontgateNode

func (p *Server) PingFrontgateNode(in *pbtypes.Empty, out *pbtypes.Empty) error

func (*Server) PingMetadataBackend added in v0.2.1

func (p *Server) PingMetadataBackend(*pbtypes.Empty, *pbtypes.Empty) error

func (*Server) PingPilot

func (p *Server) PingPilot(in *pbtypes.Empty, out *pbtypes.Empty) error

func (*Server) RegisterCmd

func (p *Server) RegisterCmd(in *pbtypes.SubTask_RegisterCmd, out *pbtypes.Empty) error

func (*Server) RegisterMetadata

func (p *Server) RegisterMetadata(in *pbtypes.SubTask_RegisterMetadata, out *pbtypes.Empty) error

func (*Server) RegisterMetadataMapping added in v0.2.3

func (p *Server) RegisterMetadataMapping(in *pbtypes.SubTask_RegisterMetadata, out *pbtypes.Empty) error

func (*Server) ReportSubTaskStatus

func (p *Server) ReportSubTaskStatus(in *pbtypes.SubTaskStatus, out *pbtypes.Empty) error

func (*Server) RunCommand

func (p *Server) RunCommand(arg *pbtypes.RunCommandOnFrontgateRequest, out *pbtypes.String) error

func (*Server) RunCommandOnDrone

func (p *Server) RunCommandOnDrone(in *pbtypes.RunCommandOnDroneRequest, out *pbtypes.String) error

func (*Server) SetDroneConfig

func (p *Server) SetDroneConfig(in *pbtypes.SetDroneConfigRequest, out *pbtypes.Empty) error

func (*Server) SetEtcdValues

func (p *Server) SetEtcdValues(in *pbtypes.StringMap, out *pbtypes.Empty) error

func (*Server) SetFrontgateConfig

func (p *Server) SetFrontgateConfig(cfg *pbtypes.FrontgateConfig, out *pbtypes.Empty) error

func (*Server) SetFrontgateNodeConfig

func (p *Server) SetFrontgateNodeConfig(cfg *pbtypes.FrontgateConfig, out *pbtypes.Empty) error

func (*Server) StartConfd

func (p *Server) StartConfd(in *pbtypes.ConfdEndpoint, out *pbtypes.Empty) error

func (*Server) StopConfd

func (p *Server) StopConfd(in *pbtypes.ConfdEndpoint, out *pbtypes.Empty) error

type Updater added in v0.2.3

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

func NewUpdater added in v0.2.3

func NewUpdater(conn *grpc.ClientConn, cfg *pbtypes.FrontgateConfig) *Updater

func (*Updater) Close added in v0.4.0

func (u *Updater) Close()

func (*Updater) SendQuitToMetad added in v0.4.0

func (u *Updater) SendQuitToMetad() error

func (*Updater) Serve added in v0.2.3

func (u *Updater) Serve()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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