descriptor

package
v0.5.16 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceAdded = iota + 1
	ServiceModify
	ServiceRemove
)

Variables

View Source
var (
	InvalidIdlPath      = errors.New("invalid idl file path")
	InvalidIteratorFunc = errors.New("no effective iterator function ")
)

Functions

This section is empty.

Types

type DataBase

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

func MakeDataBase

func MakeDataBase() *DataBase

func (*DataBase) AddWatcher

func (db *DataBase) AddWatcher(handle WatcherFunc)

func (*DataBase) GetMethodType added in v0.4.19

func (db *DataBase) GetMethodType(uuid uint64, methodId uint32) *MethodDescriptor

func (*DataBase) GetServiceType added in v0.4.19

func (db *DataBase) GetServiceType(uuid uint64) *ServiceDescriptor

func (*DataBase) Init

func (db *DataBase) Init(opts ...Option) error

func (*DataBase) RangeServices

func (db *DataBase) RangeServices(iterator IteratorFunc) error

func (*DataBase) ShutDown

func (db *DataBase) ShutDown()

func (*DataBase) Start

func (db *DataBase) Start() (err error)

type FileDescriptor

type FileDescriptor struct {
	BaseName string               `json:"-"`        //配置文件名
	IdlName  string               `json:"idlname"`  //idl 文件名
	Services []*ServiceDescriptor `json:"services"` //idl 文件中包含的服务
}

FileDescriptor 文件描述结构体

type IteratorFunc

type IteratorFunc func(uint64, *ServiceDescriptor, error) error

IteratorFunc 迭代方法,参数为服务数字uid ,服务描述,是否有错误; 如果希望终端迭代,返回非空错误

type MethodDescriptor

type MethodDescriptor struct {
	Index     uint32 `json:"index"`     //方法序号
	Name      string `json:"name"`      //方法名
	Oneway    bool   `json:"oneway"`    //是否oneway
	Public    bool   `json:"public"`    // 是否public 方法  与 protected 互斥
	Protected bool   `json:"protected"` // 是否protect 方法, 与 public 互斥
	TimeOut   uint32 `json:"timeout"`   // 超时时间
}

MethodDescriptor 方法描述结构

type Option

type Option func(option *Options)

func WithConfigPath

func WithConfigPath(path string) Option

func WithConfigSuffix

func WithConfigSuffix(suffix string) Option

func WithLogger

func WithLogger(logger slog.BoxLogger) Option

type Options

type Options struct {
	DescriptionPath string `json:"description_path"` //配置路径
	Suffix          string `json:"suffix"`           //配置文件后缀
	// contains filtered or unexported fields
}

Options 描述符

type ServiceDescriptor

type ServiceDescriptor struct {
	Uuid    string              `json:"uuid"`    // 服务UUID
	Name    string              `json:"name"`    // 服务名
	Methods []*MethodDescriptor `json:"methods"` // 服务方法名
}

ServiceDescriptor 服务描述结构

type WatcherFunc

type WatcherFunc func(int, []*ServiceDescriptor) error

WatcherFunc 监听器,用于监听文件变化

Jump to

Keyboard shortcuts

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