예제 #1
0
func (t *removeTask) Do(repo watchdb.WatchProvider) (err error) {
	var removed bool

	if t.id == FLUSH_DB {
		repo.Clear()
		removed = true
	} else if ok := repo.Remove(t.id); ok {
		removed = true
	}

	t.ch <- removed
	return
}
예제 #2
0
func (t *createTask) Do(repo watchdb.WatchProvider) (err error) {
	id, _ := repo.Add(t.w)
	t.ch <- &createTaskResponse{id, t.w.Tag}
	return
}
예제 #3
0
func (t *statusTask) Do(repo watchdb.WatchProvider) (err error) {
	size := repo.Size()
	t.ch <- &status{size}
	return
}
예제 #4
0
func (t *matchTask) Do(repo watchdb.WatchProvider) (err error) {
	m, _ := repo.Match(t.expr)
	t.ch <- m
	return
}