store

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 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 Cert

type Cert struct {
	Key string `json:"key" yaml:"key"`
	Crt string `json:"crt" yaml:"crt"`
}

type Config

type Config struct {
	Include []string  `json:"include" yaml:"router"`
	Router  []Router  `json:"router" yaml:"router"`
	Service []Service `json:"service" yaml:"service"`
}

type Factory

type Factory struct {
}

func (*Factory) Create

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

type Router

type Router struct {
	Name   string   `json:"name" yaml:"name"`
	Driver string   `json:"driver" yaml:"driver"`
	Listen int      `json:"listen" yaml:"listen"`
	Host   []string `json:"host" yaml:"host"`
	Cert   []Cert   `json:"cert" yaml:"cert"`
	Rules  []Rule   `json:"rules" yaml:"rule"`
}

func (*Router) Marshal

func (r *Router) Marshal() ([]byte, error)

func (*Router) UnMarshal

func (r *Router) UnMarshal(v interface{}) error

type Rule

type Rule struct {
	Target   string            `json:"target" yaml:"target"`
	RemoteIp string            `json:"ip" yaml:"ip"`
	Host     string            `json:"host" yaml:"host"`
	Location string            `json:"location" yaml:"location"`
	Header   map[string]string `json:"header" yaml:"header"`
	Query    map[string]string `json:"query" yaml:"query"`
	Cookie   map[string]string `json:"cookie" yaml:"cookie"`
}

type Service

type Service struct {
	Name   string `json:"name" yaml:"name"`
	Driver string `json:"driver" yaml:"driver"`
}

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