backend

package
v0.0.0-...-83adff0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseName

func ParseName(name string, defaultSel Selector) (target Target, sel Selector, err error)

ParseName parse qname get name and selector

func Registry

func Registry(name string, factory Factory)

Registry registry backdend

Types

type Backend

type Backend interface {
	Ping(ctx context.Context) error
	Query(ctx context.Context, target Target, sel Selector, md Metadata) ([]*Instance, error)
	Close(ctx context.Context) error
}

Backend provide service query

func New

func New(name string, conf map[string]interface{}) (Backend, error)

New backend

type Factory

type Factory func(map[string]interface{}) (Backend, error)

Factory backend factory

type Instance

type Instance struct {
	Region      string `json:"region"`
	Zone        string `json:"zone"`
	Env         string `json:"env"`
	Hostname    string `json:"hostname"`
	DiscoveryID string `json:"discovery_id"`
	TreeID      int64  `json:"tree_id"`
	IPAddr      net.IP `json:"ip_addr,omitempty"` // hacked field
}

Instance service instance struct

type Metadata

type Metadata struct {
	ClientHost       string
	LatestTimestamps string
}

Metadata metadata contain env, zone, region e.g.

type Selector

type Selector struct {
	Env      string
	Region   string
	Zone     string
	Hostname string
}

Selector selector

func (Selector) String

func (s Selector) String() string

type Target

type Target struct {
	Name string
}

Target global unique application identifier

func (Target) String

func (t Target) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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