core

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2019 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package core provides a list of interface for Dispatcher and ConfigMgr

Index

Constants

View Source
const (
	Update        = "UPDATE"
	Delete        = "DELETE"
	Create        = "CREATE"
	InvalidAction = "INVALID-ACTION"
)

Event Constant

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigMgr

type ConfigMgr interface {
	AddSource(source ConfigSource, priority int) error
	GetConfigurations() map[string]interface{}
	GetConfigurationsByDimensionInfo(dimensionInfo string) (map[string]interface{}, error)
	AddDimensionInfo(dimensionInfo string) (map[string]string, error)
	GetConfigurationsByKey(key string) interface{}
	GetConfigurationsByKeyAndDimensionInfo(dimensionInfo, key string) interface{}
	IsKeyExist(string) bool
	Unmarshal(interface{}) error
	Refresh(sourceName string) error
	Cleanup()
}

ConfigMgr manager Source

type ConfigSource

type ConfigSource interface {
	GetSourceName() string
	GetConfigurations() (map[string]interface{}, error)
	GetConfigurationsByDI(dimensionInfo string) (map[string]interface{}, error)
	GetConfigurationByKey(string) (interface{}, error)
	GetConfigurationByKeyAndDimensionInfo(key, dimensionInfo string) (interface{}, error)
	AddDimensionInfo(dimensionInfo string) (map[string]string, error)
	DynamicConfigHandler(DynamicConfigCallback) error
	GetPriority() int
	SetPriority(priority int)
	Cleanup() error
}

ConfigSource should implement this interface

type Dispatcher

type Dispatcher interface {
	// Function to send Events to all listener
	DispatchEvent(event *Event) error
	//Function to Register all listener for different key changes
	RegisterListener(listenerObj EventListener, keys ...string) error
	// remove listener
	UnRegisterListener(listenerObj EventListener, keys ...string) error
}

Dispatcher is an interface for events Management

type DynamicConfigCallback

type DynamicConfigCallback interface {
	OnEvent(*Event)
}

DynamicConfigCallback is an interface for creating event on object change

type Event

type Event struct {
	EventSource string
	EventType   string
	Key         string
	Value       interface{}
}

Event generated when any config changes

type EventListener

type EventListener interface {
	Event(event *Event)
}

EventListener All EventListener should implement this Interface

Directories

Path Synopsis
Package cast provides the typeCasting of an object
Package cast provides the typeCasting of an object
Package configmanager provides functions to communicate to Config-Center Package configmanager provides deserializer
Package configmanager provides functions to communicate to Config-Center Package configmanager provides deserializer
Package eventsystem provides the different Listeners
Package eventsystem provides the different Listeners

Jump to

Keyboard shortcuts

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