storage

package module
v0.0.0-...-82c7b44 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: Apache-2.0 Imports: 3 Imported by: 2

README

storage

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List() (s []string)

List 已注册的存储器列表

func Register

func Register(name string, driver Driver)

Register 注册storage名称, storage的构造函数

Types

type Data

type Data struct {
	Key   string
	Value interface{}
}

Data 配置存储器与Engine之间的交流数据

type Driver

type Driver interface {
	Open(log.Logger, map[string]interface{}) (Storage, error)
}

Driver 自定义Storage需要实现此接口进行注册

type Storage

type Storage interface {
	//Get 获取指定keys的信息
	Get(keys []string) (dataCh chan []Data, err error)
	//Stop 停止Storage
	Stop() error
	//Success 当key所在模板更新成功时使用此接口进行通知
	Success(template string, kvs []map[string]interface{})
	//Error 当key所在模板渲染失败时使用此接口进行通知storage
	Error(template string, kvs []map[string]interface{}, err error)
}

Storage 配置存储器的接口

func New

func New(name string, logger log.Logger, cfg map[string]interface{}) (Storage, error)

New 根据name从已注册的storages获取对应的构造函数,创建storage

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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