Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrMClockSchedulerClosed = errors.New("mClock scheduler is closed") ErrMClockSchedulerRequestLimitExceeded = errors.New("mClock scheduler request limit exceeded") ErrMClockSchedulerUnknownTag = errors.New("unknown tag") ErrInvalidTagInfo = errors.New("invalid tag info: shares, limit and reservation must be greater than zero") ErrInvalidRunLimit = errors.New("invalid run limit: must be greater than zero") ErrTagRequestsProhibited = errors.New("tag requests are prohibited") )
Functions ¶
This section is empty.
Types ¶
type MClock ¶
type MClock struct {
// contains filtered or unexported fields
}
MClock is mClock scheduling algorithm implementation.
See https://www.usenix.org/legacy/event/osdi10/tech/full_papers/Gulati.pdf for details.
func NewMClock ¶
func NewMClock(runLimit, waitLimit uint64, tagInfo map[string]TagInfo, idleTimeout time.Duration) (*MClock, error)
NewMClock creates new MClock scheduler instance with runLimit maximum allowed count of running requests and waitLimit maximum allowed count of waiting requests for tags specified by tagInfo. The value of idleTimeout defines the difference between the current time and the time of the previous request, at which the tag considered idle. If idleTimeout is negative, it means that there is no idle tags allowed. If waitLimit equals zero, it means that there is no limit on the number of waiting requests.
func (*MClock) Close ¶
func (q *MClock) Close()
Close closes MClock scheduler. No new requests for scheduling will be accepted after the closing.
func (*MClock) RequestArrival ¶
RequestArrival schedules new request with tag value. Method call is blocked until one of the following events occurs: request with the tag is scheduled for execution, context ctx is canceled or the scheduler is closed. If the method call returned non-nil ReleaseFunc, then it must be called after the request is completed.
type ReleaseFunc ¶
type ReleaseFunc func()
ReleaseFunc is the type of function that should be called after the request is completed.