executorinfo

package
v1.4.4-beta.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2016 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package executorinfo provides a lru-based executor info registry as well as some utility methods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeResources

func DecodeResources(r io.Reader) (rs []*mesosproto.Resource, err error)

DecodeResources decodes a resource slice from the given reader. The format is expected to be the same as in EncodeResources.

func EncodeResources

func EncodeResources(w io.Writer, rs []*mesosproto.Resource) error

EncodeResources encodes the given resource slice to the given writer. The resource slice is encoded as a comma separated string of base64 encoded resource protobufs.

Types

type Cache

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

Cache is an LRU cache for executor info objects. It is not safe for concurrent use.

func NewCache

func NewCache(maxEntries int) (*Cache, error)

NewCache creates a new cache. If maxEntries is zero, an error is being returned.

func (*Cache) Add

func (c *Cache) Add(hostname string, e *mesosproto.ExecutorInfo)

Add adds an executor info associated with the given hostname to the cache.

func (*Cache) Get

func (c *Cache) Get(hostname string) (e *mesosproto.ExecutorInfo, ok bool)

Get looks up a hostname's executor info from the cache.

func (*Cache) Remove

func (c *Cache) Remove(hostname string)

Remove removes the provided hostname from the cache.

func (*Cache) RemoveOldest

func (c *Cache) RemoveOldest()

RemoveOldest removes the oldest item from the cache.

type Registry

type Registry interface {
	New(hostname string, resources []*mesosproto.Resource) *mesosproto.ExecutorInfo
	Get(hostname string) (*mesosproto.ExecutorInfo, error)
	Invalidate(hostname string)
}

Registry is the interface that provides methods for interacting with a registry of ExecutorInfo objects

Get looks up an ExecutorInfo object for the given hostname

New returns an ExecutorInfo object based on a given hostname and resources

Invalidate invalidates the given hostname from this registry. Note that a subsequent Get may recover the executor info.

func NewRegistry

func NewRegistry(
	lookupNode node.LookupFunc,
	prototype *mesosproto.ExecutorInfo,
	cache *Cache,
) (Registry, error)

NewRegistry returns a new executorinfo registry. The given prototype is being used for properties other than resources.

Jump to

Keyboard shortcuts

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