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: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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