Documentation ¶
Index ¶
- Constants
- type AsyncHandler
- type ViewBufferManager
- func (t *ViewBufferManager) Close()
- func (m *ViewBufferManager) GetTaskKey() string
- func (m *ViewBufferManager) NewCmdTask(start func() (*exec.Cmd, io.Reader), prefix string, linesToRead int, ...) func(chan struct{}) error
- func (m *ViewBufferManager) NewTask(f func(stop chan struct{}) error, key string) error
- func (m *ViewBufferManager) ReadLines(n int)
Constants ¶
const COMMAND_START_THRESHOLD = time.Millisecond * 10
we use this to check if the system is under stress right now. Hopefully this makes sense on other machines
const THROTTLE_TIME = time.Millisecond * 30
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncHandler ¶ added in v0.30.1
type AsyncHandler struct {
// contains filtered or unexported fields
}
the purpose of an AsyncHandler is to ensure that if we have multiple long-running requests, we only handle the result of the latest one. For example, if I am searching for 'abc' and I have to type 'a' then 'b' then 'c' and each keypress dispatches a request to search for things with the string so-far, we'll be searching for 'a', 'ab', and 'abc', and it may be that 'abc' comes back first, then 'ab', then 'a' and we don't want to display the result for 'a' just because it came back last. AsyncHandler keeps track of the order in which things were dispatched so that we can ignore anything that comes back late.
func NewAsyncHandler ¶ added in v0.30.1
func NewAsyncHandler() *AsyncHandler
func (*AsyncHandler) Do ¶ added in v0.30.1
func (self *AsyncHandler) Do(f func() func())
type ViewBufferManager ¶
func NewViewBufferManager ¶
func NewViewBufferManager( log *logrus.Entry, writer io.Writer, beforeStart func(), refreshView func(), onEndOfInput func(), onNewKey func(), ) *ViewBufferManager
func (*ViewBufferManager) Close ¶
func (t *ViewBufferManager) Close()
Close closes the task manager, killing whatever task may currently be running
func (*ViewBufferManager) GetTaskKey ¶ added in v0.30.1
func (m *ViewBufferManager) GetTaskKey() string
func (*ViewBufferManager) NewCmdTask ¶
func (m *ViewBufferManager) NewCmdTask(start func() (*exec.Cmd, io.Reader), prefix string, linesToRead int, onDone func()) func(chan struct{}) error
note: onDone may be called twice
func (*ViewBufferManager) NewTask ¶
func (m *ViewBufferManager) NewTask(f func(stop chan struct{}) error, key string) error
func (*ViewBufferManager) ReadLines ¶
func (m *ViewBufferManager) ReadLines(n int)