monitor

package
v0.0.0-...-9994f1b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2025 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Copyright 2023 The Chromium Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Monitor

type Monitor struct {
	// contains filtered or unexported fields
}

Monitor uses to run and schedule Some Tasks (Observable) that we want to keep observing it after some period.

func New

func New() Monitor

New a monitor

func (*Monitor) Register

func (m *Monitor) Register(obj Observable, interval time.Duration)

Register the Task (Observable). It will run the task immediately and then schedule it. After the interval, it will run and schedule it again.

func (*Monitor) Stop

func (m *Monitor) Stop()

Stop the monitor.

type Observable

type Observable interface {
	// Observe the behavior, which Monitor run it immediately and schedule the
	// behavior in later. After reaching the interval, Monitor will run and schedule it again
	Observe()
}

Observable provides the ability that Monitor want to observe.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL