hash

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package hash provides a simple API for managing service hashes.

Index

Constants

This section is empty.

Variables

View Source
var (
	ServiceHashHolderUninitialized = errors.New("ServiceHashHolder is not initialized")
)

Functions

This section is empty.

Types

type ServiceHash

type ServiceHash interface {
	// Get returns the service URL associated with the given key.
	Get([]byte) (string, error)
}

ServiceHash represents a component which can return URLs as strings based on arbitrary keys.

type ServiceHashHolder

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

ServiceHashHolder represents an atomic pointer to a ServiceHash. This pointer can be used without locking. This type implements ServiceHash. The current reference is used via the ServiceHash interface.

func (*ServiceHashHolder) Connected

func (holder *ServiceHashHolder) Connected() bool

Connected checks whether this holder has any hash entries. This implementations handler.Connection, which allows this holder to participate in request gating.

func (*ServiceHashHolder) Get

func (holder *ServiceHashHolder) Get(key []byte) (string, error)

func (*ServiceHashHolder) Update

func (holder *ServiceHashHolder) Update(newHash ServiceHash)

Update atomically updates the current ServiceHash instance. Subsequent calls to Get() will use the newHash instance.

Jump to

Keyboard shortcuts

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