common

package
v0.0.0-...-85902bd Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//ModelURI represents model eval URI template
	ModelURI = "/v1/api/model/%s/eval"
	//MetaURI represents model meta URI template
	MetaURI = "/v1/api/model/%s/meta/"
	//MetaConfigURI represents model meta config URI template
	MetaConfigURI = "/v1/api/model/%s/meta/config"
	//MetaDictionaryURI represents model meta dictionary URI template
	MetaDictionaryURI = "/v1/api/model/%s/meta/dictionary"
)
View Source
const (
	//StatusOK response status ok
	StatusOK = "ok"
	//StatusError represents error status
	StatusError = "error"
	//StatusCached represents cache status
	StatusCached = "cached"
)
View Source
const (
	//HashBin represents hash bin
	HashBin = "dictHash"
)
View Source
const KeyDelimiter = '/'

KeyDelimiter key delimiter

View Source
const (
	//MetricURI represents metric URI
	MetricURI = "/v1/api/metric/"
)

Variables

View Source
var ErrNodeDown = errors.New("node is down")

ErrNodeDown node down error

Functions

func DataType

func DataType(dataType string) (reflect.Type, error)

DataType return reflect.Type for supplied data type

func Hash

func Hash(source interface{}) int

Hash returns hash or zero

func IsAuthorized

func IsAuthorized(request *http.Request, allowedSubset []string) bool

IsAuthorized checks if request is authorized

func IsInvalidNode

func IsInvalidNode(err error) bool

IsInvalidNode returns true is node/cluster is down

func IsKeyNotFound

func IsKeyNotFound(err error) bool

IsKeyNotFound returns true if key not found error

func IsTimeout

func IsTimeout(err error) bool

IsTimeout returns true if timeout error

func SetHash

func SetHash(dest interface{}, hash int)

SetHash sets hash

Types

type Hashed

type Hashed interface {
	Hash() int
	SetHash(hash int)
}

Hashed represent dictionary hash holder

type Iterator

type Iterator func(pair Pair) error

Iterator represents iterator

func MapToIterator

func MapToIterator(aMap map[string]interface{}) Iterator

MapToIterator create an iterator for supplied map

func (Iterator) ToMap

func (r Iterator) ToMap() (map[string]interface{}, error)

ToMap coverts iterator to map

type Pair

type Pair func(key string, value interface{}) error

Pair represents a pair

type Storable

type Storable interface {
	Iterator() Iterator
	Set(iter Iterator) error
}

Storable represents storable interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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