interfaces

package
v0.0.0-...-315b7b0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthN

type AuthN interface {
	Register(string, string) (interface{}, error)
	Login(string, string) (interface{}, error)
	Logout(string) error
	Delete(string) error
	Reset(string, string) (interface{}, error)
}

type AuthNOption

type AuthNOption func(AuthN) error

type AuthZ

type AuthZ interface {
	NewToken(string) (string, error)
	RefreshToken(string) (string, error)
	RevokeToken(string) error
	CheckToken(string) error
}

type Broker

type Broker interface {
	Run() error
	Endpoint() string
	Connect() error
	Publish(string, interface{}) error
	Subscribe(string, interface{}) error
	Unsubscribe(string) error
	Close() error
}

type BrokerOption

type BrokerOption func(Broker) error

type Cache

type Cache interface {
	Init() error
	Close() error

	Put(string, interface{}) error
	Take(string) (interface{}, error)
	Exists(...string) (bool, error)
	Keys() (interface{}, error)
	Delete(...string) error

	Set(string) error
	IsMember(string) (bool, error)
}

type CacheOption

type CacheOption func(Cache) error

type Client

type Client interface {
	GET(interface{}) error
	POST(interface{}) error
	PUT(interface{}) error
	DELETE(interface{}) error
	HEAD(interface{}) error
	OPTIONS(interface{}) error
}

type ClientOption

type ClientOption func(Client) error

type Configuration

type Configuration interface {
	// Retrieve a configuration
	Open(...string) error
	// Save configuration
	Save(interface{}) error
	// Set based on key value
	Set(string, interface{}) error
	// Get based on key
	Get(string) (interface{}, error)

	GetIntOrDefault(string, int) int
	GetStringOrDefault(string, string) string
	GetBoolOrDefault(string, bool) bool
	GetFloat64OrDefault(string, float64) float64
	GetDurationOrDefault(string, time.Duration) time.Duration
	GetMapOfStringOrDefault(string, map[string]string) map[string]string
	GetArrayOfStringsOrDefault(string, []string) []string
}

type ConfigurationOption

type ConfigurationOption func(Configuration) error

type Processor

type Processor interface {
	Init(service Service) error
	Close() error
	Process(interface{}) (interface{}, error)
}

type ProcessorOption

type ProcessorOption func(Processor) error

type Registry

type Registry interface {
	Register() error
	WithPort(port int) error
}

type RegistryOption

type RegistryOption func(Registry) error

type Service

type Service interface {
	ID() string
	Name() string

	//Init(...ServiceOption)
	Run()
	Stop()
	IsRunning() bool
	HookShutDown(func())

	Registry() Registry
	Transport() Transport
	Broker() Broker
	Client() Client
	Store() Store
	Processor() Processor
	Configuration() Configuration
	AuthN() AuthN
	Cache() Cache

	//Transport Handler (rest) Helpers
	Handler(string, string, interface{}) error
	GET(string, interface{}) error
	POST(string, interface{}) error
	PUT(string, interface{}) error
	DELETE(string, interface{}) error

	//Broker Handler Helpers
	Subscribe(string, interface{}) error
	Unsubscribe(string) error
	Publish(string, interface{}) error

	//Log
	Info(interface{})
	Warn(interface{})
	Error(interface{})
	Fatal(interface{})
	Debug(interface{})
}

Basic Microservice interface ID() set/get unique Microservice identifier Name() set/get the Microservice name Run()

type Store

type Store interface {
	Create(string, interface{}) error
	Read(string) (interface{}, error)
	Update(string, interface{}) error
	Delete(string) error
	List(...interface{}) (interface{}, error)
}

type StoreOption

type StoreOption func(Store) error

type Transport

type Transport interface {
	Run() error
	Stop() error

	Handler(string, string, interface{}) error
	Middleware(interface{}) error
	StaticFilesFolder(string, string) error
	Router() (interface{}, error)
	Port() int
}

type TransportOption

type TransportOption func(Transport) error

Jump to

Keyboard shortcuts

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