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.
func NewID ¶
func NewID(info *mesosproto.ExecutorInfo) *mesosproto.ExecutorID
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 (*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) 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.