store

package
v0.0.0-...-d744151 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = fmt.Errorf("not found")

Functions

func GetConsumer

func GetConsumer(id string) (resource.Consumer, error)

func GetConsumerByPluginKey

func GetConsumerByPluginKey(pluginName string, key string) (resource.Consumer, error)

func GetConsumerGroup

func GetConsumerGroup(id string) (resource.ConsumerGroup, error)

func GetPluginConfigRule

func GetPluginConfigRule(id string) (resource.PluginConfigRule, error)

func GetPluginMetadata

func GetPluginMetadata(id string, v any) error

func GetService

func GetService(id string) (resource.Service, error)

func GetUpstream

func GetUpstream(id string) (resource.Upstream, error)

func ListGlobalRules

func ListGlobalRules() ([]resource.GlobalRule, error)

func ListRoutes

func ListRoutes() ([]resource.Route, error)

func ParseConsumer

func ParseConsumer(config []byte) (resource.Consumer, error)

func ParseConsumerGroup

func ParseConsumerGroup(config []byte) (resource.ConsumerGroup, error)

func ParseGlobalRule

func ParseGlobalRule(config []byte) (resource.GlobalRule, error)

func ParsePluginConfigRule

func ParsePluginConfigRule(config []byte) (resource.PluginConfigRule, error)

func ParseRoute

func ParseRoute(config []byte) (resource.Route, error)

func ParseService

func ParseService(config []byte) (resource.Service, error)

func ParseUpstream

func ParseUpstream(config []byte) (resource.Upstream, error)

func PutBack

func PutBack(event *Event)

Types

type Event

type Event struct {
	// Type is the type of event, create, update, delete
	Type EventType
	// Key is the key of the event
	Key []byte
	// Value is the value of the event
	Value []byte
}

func NewEvent

func NewEvent() *Event

func (*Event) String

func (e *Event) String() string

type EventType

type EventType int
const (
	EventTypePut    EventType = 0
	EventTypeDelete EventType = 1
)

func (EventType) String

func (et EventType) String() string

type EventUpdateHook

type EventUpdateHook func(event *Event)

eventUpdateHook is a function that is called when an event is updated.

type Store

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

func NewStore

func NewStore(dbPath string, events chan *Event) *Store

func (*Store) AddEventUpdateHook

func (s *Store) AddEventUpdateHook(hook EventUpdateHook)

func (*Store) GetBucketData

func (s *Store) GetBucketData(bucketName string) [][]byte

func (*Store) GetConsumerNameByPluginKey

func (s *Store) GetConsumerNameByPluginKey(pluginName string, key string) ([]byte, error)

func (*Store) GetFromBucket

func (s *Store) GetFromBucket(bucketName string, id []byte) []byte

get specific key from bucket

func (*Store) InitBuckets

func (s *Store) InitBuckets()

func (*Store) Start

func (s *Store) Start()

func (*Store) Stop

func (s *Store) Stop()

Jump to

Keyboard shortcuts

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