base

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseConfig

type BaseConfig struct {
	Name              string                  // 配置模块名称
	FileName          string                  // 配置源文件名称
	ConfigEventBuffer chan common.ConfigEvent // 配置文件通道
}

BaseConfig 基础配置类

func NewBaseConfig

func NewBaseConfig(name, fileName string) BaseConfig

NewBaseConfig 新建基本配置对象

func (*BaseConfig) Listen

func (c *BaseConfig) Listen(ctx context.Context, timeout time.Duration) <-chan common.ConfigEventListenResult

Listen 外部调用的配置监听接口

func (*BaseConfig) ListenSource

func (c *BaseConfig) ListenSource(ctx context.Context, source common.ConfigSource, configInstance interface{})

ListenSource 监听配置源变更信息

type BaseInfra

type BaseInfra struct {
	InfraName  string                          // 基础设施名称
	StartFunc  func(ctx context.Context) error // 基础设施启动方法
	StopFunc   func() error                    // 基础设施停止方法
	ConfigImpl common.ConfigImpl               // 基础设施配置信息
	// contains filtered or unexported fields
}

BaseInfra 基础设施基类

func NewBaseInfra

func NewBaseInfra(infraName string, configImpl common.ConfigImpl, startFunc func(ctx context.Context) error, stopFunc func() error) BaseInfra

NewBaseInfra 创建新的基础设施基类

func (*BaseInfra) Restart

func (i *BaseInfra) Restart(ctx context.Context) error

Restart 重启基础设施

func (*BaseInfra) Start

func (i *BaseInfra) Start(ctx context.Context) error

Start 启动基础设施

func (*BaseInfra) Stop

func (i *BaseInfra) Stop() error

Stop 停止基础设施

Jump to

Keyboard shortcuts

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