store

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorReadOnly = fmt.Errorf("yaml :%w", eosc.ErrorStoreReadOnly)
)

Functions

func NewStore

func NewStore(file string) (eosc.IStore, error)

func Register

func Register()

Types

type Config

type Config struct {
	Include   []string `json:":include" yaml:":include"`
	Router    []Item   `json:"router" yaml:"router"`
	Service   []Item   `json:"service" yaml:"service"`
	Upstream  []Item   `json:"upstream" yaml:"upstream"`
	Discovery []Item   `json:"discovery" yaml:"discovery"`
	Auth      []Item   `json:"auth" yaml:"auth"`
}

Config yaml文件配置项

type Factory

type Factory struct {
}

func (*Factory) Create

func (f *Factory) Create(params map[string]string) (eosc.IStore, error)

type Item added in v0.0.4

type Item map[string]interface{}

Item 配置项

func (Item) Driver added in v0.0.4

func (i Item) Driver() (string, bool)

Driver 获取driver

func (Item) Id added in v0.0.4

func (i Item) Id() (string, bool)

Id 获取ID

func (Item) Name added in v0.0.4

func (i Item) Name() (string, bool)

Name 获取name

type Store

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

func (*Store) AddListen

func (s *Store) AddListen(h eosc.IStoreEventHandler) error

func (*Store) All

func (s *Store) All() []eosc.StoreValue

func (*Store) Del

func (s *Store) Del(id string) error

func (*Store) Get

func (s *Store) Get(id string) (eosc.StoreValue, bool)

func (*Store) GetListener

func (s *Store) GetListener() eosc.IStoreListener

func (*Store) Initialization

func (s *Store) Initialization() error

func (*Store) ReadLock

func (s *Store) ReadLock(ctx context.Context) (bool, error)

func (*Store) ReadOnly

func (s *Store) ReadOnly() bool

func (*Store) ReadUnLock

func (s *Store) ReadUnLock() error

func (*Store) Set

func (s *Store) Set(v eosc.StoreValue) error

func (*Store) TryLock

func (s *Store) TryLock(ctx context.Context, expire int) (bool, error)

func (*Store) UnLock

func (s *Store) UnLock() error

Jump to

Keyboard shortcuts

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