package executorinfo
import "k8s.io/kubernetes/contrib/mesos/pkg/scheduler/executorinfo"
Package executorinfo provides a lru-based executor info registry as well as some utility methods.
Index ¶
- func DecodeResources(r io.Reader) (rs []*mesosproto.Resource, err error)
- func EncodeResources(w io.Writer, rs []*mesosproto.Resource) error
- func NewID(info *mesosproto.ExecutorInfo) *mesosproto.ExecutorID
- type Cache
- func NewCache(maxEntries int) (*Cache, error)
- func (c *Cache) Add(hostname string, e *mesosproto.ExecutorInfo)
- func (c *Cache) Get(hostname string) (e *mesosproto.ExecutorInfo, ok bool)
- func (c *Cache) Remove(hostname string)
- func (c *Cache) RemoveOldest()
- type Registry
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 NewCache ¶
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 ¶
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.
Source Files ¶
codec.go doc.go id.go lru_cache.go registry.go
- Version
- v1.4.0-beta.6
- Published
- Sep 16, 2016
- Platform
- js/wasm
- Imports
- 17 packages
- Last checked
- 26 minutes ago –
Tools for package owners.