1 Star 0 Fork 0

zhuchance / kubernetes

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
interface.go 2.72 KB
一键复制 编辑 原始数据 按行查看 历史
James DeFelice 提交于 2015-06-10 20:58 . Kubernetes Mesos integration
/*
Copyright 2015 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package queue
import (
"time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/cache"
)
type EventType int
const (
ADD_EVENT EventType = 1 << iota
UPDATE_EVENT
DELETE_EVENT
POP_EVENT
)
type Entry interface {
Copyable
Value() UniqueCopyable
// types is a logically OR'd combination of EventType, e.g. ADD_EVENT|UPDATE_EVENT
Is(types EventType) bool
}
type Copyable interface {
// return an independent copy (deep clone) of the current object
Copy() Copyable
}
type UniqueID interface {
GetUID() string
}
type UniqueCopyable interface {
Copyable
UniqueID
}
type FIFO interface {
cache.Store
// Pop waits until an item is ready and returns it. If multiple items are
// ready, they are returned in the order in which they were added/updated.
// The item is removed from the queue (and the store) before it is returned,
// so if you don't succesfully process it, you need to add it back with Add().
Pop() interface{}
// Await attempts to Pop within the given interval; upon success the non-nil
// item is returned, otherwise nil
Await(timeout time.Duration) interface{}
// Is there an entry for the id that matches the event mask?
Poll(id string, types EventType) bool
}
type Delayed interface {
// return the remaining delay; a non-positive value indicates no delay
GetDelay() time.Duration
}
type Deadlined interface {
// when ok, returns the time when this object should be activated/executed/evaluated
Deadline() (deadline time.Time, ok bool)
}
// No objects are ever expected to be sent over this channel. References to BreakChan
// instances may be nil (always blocking). Signalling over this channel is performed by
// closing the channel. As such there can only ever be a single signal sent over the
// lifetime of the channel.
type BreakChan <-chan struct{}
// an optional interface to be implemented by Delayed objects; returning a nil
// channel from Breaker() results in waiting the full delay duration
type Breakout interface {
// return a channel that signals early departure from a blocking delay
Breaker() BreakChan
}
type UniqueDelayed interface {
UniqueID
Delayed
}
type UniqueDeadlined interface {
UniqueID
Deadlined
}
Go
1
https://gitee.com/meoom/kubernetes.git
git@gitee.com:meoom/kubernetes.git
meoom
kubernetes
kubernetes
v1.0.1

搜索帮助