contract

package
v0.0.0-...-46b057c Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const AppKey = "hade:app"

AppKey 定义字符串凭证

View Source
const DistributedKey = "hade:distributed"

DistributedKey 定义字符串凭证

View Source
const KernelKey = "hade:kernel"

KernelKey 提供 kenel 服务凭证

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App interface {
	// AppID 表示当前这个app的唯一id, 可以用于分布式锁等
	AppID() string

	// Version 定义当前版本
	Version() string

	// BaseFolder 定义项目基础地址
	BaseFolder() string

	// ConfigFolder 定义了配置文件的路径
	ConfigFolder() string

	// LogFolder 定义了日志所在路径
	LogFolder() string

	// ProviderFolder 定义业务自己的服务提供者地址
	ProviderFolder() string

	// MiddlewareFolder 定义业务自己定义的中间件
	MiddlewareFolder() string

	// CommandFolder 定义业务定义的命令
	CommandFolder() string

	// RuntimeFolder 定义业务的运行中间态信息
	RuntimeFolder() string

	// TestFolder 存放测试所需要的信息
	TestFolder() string
}

App 定义接口

type Distributed

type Distributed interface {
	// Select 分布式选择器, 所有节点对某个服务进行抢占,只选择其中一个节点
	// ServiceName 服务名字
	// appID 当前的AppID
	// holdTime 分布式选择器hold住的时间
	// 返回值
	// selectAppID 分布式选择器最终选择的App
	// err 异常才返回,如果没有被选择,不返回err
	Select(serviceName string, appID string, holdTime time.Duration) (selectAppID string, err error)
}

Distributed 分布式服务

type Kernel

type Kernel interface {
	// HttpEngine http.Handler结构,作为net/http框架使用, 实际上是gin.Engine
	HttpEngine() http.Handler
}

Kernel 接口提供框架最核心的结构

Jump to

Keyboard shortcuts

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