diskmonitor

package
v0.15.4 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiskEvent

type DiskEvent struct {
	DevName   string
	Action    EventAction
	Content   string
	Major     string
	Minor     string
	Subsystem string
	SeqNum    int
}

DiskEvent struct

type DiskMonitor

type DiskMonitor interface {
	Run(stopCh <-chan struct{})
}

DiskMonitor interface

func New

func New(queue *EventQueue) DiskMonitor

New a disk monitor instance

type EventAction

type EventAction string

EventAction type

const (
	ActionAdd    EventAction = "add"
	ActionRemove EventAction = "remove"
	ActionChange EventAction = "change"
)

consts

type EventQueue

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

EventQueue is rate limiting queue for event

func NewEventQueue

func NewEventQueue(queueName string) *EventQueue

NewEventQueue creates a queue

func (*EventQueue) Add

func (q *EventQueue) Add(event *DiskEvent)

Add a event into the queue

func (*EventQueue) AddRateLimited

func (q *EventQueue) AddRateLimited(event *DiskEvent)

AddRateLimited a event

func (*EventQueue) Done

func (q *EventQueue) Done(event *DiskEvent)

Done completes the event and remove from the queue

func (*EventQueue) Forget

func (q *EventQueue) Forget(event *DiskEvent)

Forget cleanup the rate limit on the event

func (*EventQueue) Get

func (q *EventQueue) Get() (*DiskEvent, bool)

Get a event from queue. It's a blocking call

func (*EventQueue) NumRequeues

func (q *EventQueue) NumRequeues(event *DiskEvent) int

NumRequeues get number of event retried

func (*EventQueue) Shutdown

func (q *EventQueue) Shutdown()

Shutdown the queue

Jump to

Keyboard shortcuts

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