alert

package
v9.4.33+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Name of this alert client implementation.
	Name = "alert_kvdb"
	// NameTest of this alert instance used only for unit tests.
	NameTest = "alert_kvdb_test"
)

Variables

View Source
var (
	// ErrNotSupported implemenation of a specific function is not supported.
	ErrNotSupported = errors.New("Implementation not supported")
	// ErrNotFound raised if Key is not found.
	ErrNotFound = errors.New("Key not found")
	// ErrExist raised if key already exists.
	ErrExist = errors.New("Key already exists")
	// ErrUnmarshal raised if Get fails to unmarshal value.
	ErrUnmarshal = errors.New("Failed to unmarshal value")
	// ErrIllegal raised if object is not valid.
	ErrIllegal = errors.New("Illegal operation")
	// ErrNotInitialized raised if alert not initialized.
	ErrNotInitialized = errors.New("Alert not initialized")
	// ErrAlertClientNotFound raised if no client implementation found.
	ErrAlertClientNotFound = errors.New("Alert client not found")
	// ErrResourceNotFound raised if ResourceType is not found>
	ErrResourceNotFound = errors.New("Resource not found in Alert")
	// ErrSubscribedRaise raised if unable to raise a subscribed alert
	ErrSubscribedRaise = errors.New("Could not raise alert and its subscribed alerts")
)

Functions

func Register

func Register(name string, initFunc InitFunc) error

Register an alert interface. Deprecated: Kept temporarily for backward compatibility.

func Shutdown

func Shutdown()

Shutdown the alert instance. Deprecated: Kept temporarily for backward compatibility.

Types

type Alert

type Alert interface {
	fmt.Stringer

	// Shutdown.
	// Deprecated: Kept temporarily for backward compatibility.
	Shutdown()

	// GetKvdbInstance.
	// Deprecated: Kept temporarily for backward compatibility.
	GetKvdbInstance() kvdb.Kvdb

	// Raise raises an Alert.
	// Deprecated: Kept temporarily for backward compatibility.
	Raise(alert *api.Alert) error

	// Raise raises an Alert only if another alert with given resource type,
	// resource id, and unqiue_tage doesnt exists already.
	// Deprecated: Kept temporarily for backward compatibility.
	RaiseIfNotExist(alert *api.Alert) error

	// Subscribe allows a child (dependent) alert to subscribe to a parent alert
	// Deprecated: Kept temporarily for backward compatibility.
	Subscribe(parentAlertType int64, childAlert *api.Alert) error

	// Retrieve retrieves specific Alert.
	// Deprecated: Kept temporarily for backward compatibility.
	Retrieve(resourceType api.ResourceType, id int64) (*api.Alert, error)

	// Enumerate enumerates Alert.
	// Deprecated: Kept temporarily for backward compatibility.
	Enumerate(filter *api.Alert) ([]*api.Alert, error)

	// EnumerateWithinTimeRange enumerates Alert between timeStart and timeEnd.
	// Deprecated: Kept temporarily for backward compatibility.
	EnumerateWithinTimeRange(
		timeStart time.Time,
		timeEnd time.Time,
		resourceType api.ResourceType,
	) ([]*api.Alert, error)

	// Erase erases an Alert.
	// Deprecated: Kept temporarily for backward compatibility.
	Erase(resourceType api.ResourceType, alertID int64) error

	// Clear an Alert.
	// Deprecated: Kept temporarily for backward compatibility.
	Clear(resourceType api.ResourceType, alertID int64, ttl uint64) error

	// Clear an Alert for a resource with unique tag.
	// Deprecated: Kept temporarily for backward compatibility.
	ClearByUniqueTag(
		resourceType api.ResourceType,
		resourceId string,
		uniqueTag string,
		ttl uint64,
	) error

	// Watch on all Alerts for the given clusterID. It uses the global kvdb
	// options provided while creating the alertClient object to access this
	// cluster
	// Deprecated: Kept temporarily for backward compatibility.
	Watch(clusterID string, alertWatcher AlertWatcherFunc) error
}

Alert interface for Alert API. Deprecated: Kept temporarily for backward compatibility.

func Init

func Init(kv kvdb.Kvdb, clusterID string) (Alert, error)

Init initializes a AlertClient interface implementation. Deprecated: Kept temporarily for backward compatibility.

func New

func New(name string, clusterID string, kv kvdb.Kvdb) (Alert, error)

New returns a new alert instance tied with a clusterID and kvdb. Deprecated: Kept temporarily for backward compatibility.

type AlertWatcherFunc

type AlertWatcherFunc func(*api.Alert, api.AlertActionType, string, string) error

AlertWatcherFunc is a function type used as a callback for KV WatchTree. Deprecated: Kept temporarily for backward compatibility.

type InitFunc

type InitFunc func(kv kvdb.Kvdb, clusterID string) (Alert, error)

InitFunc initialization function for alert. Deprecated: Kept temporarily for backward compatibility.

type KvAlert

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

KvAlert is used for managing the alerts and its kvdb instance Deprecated: Kept temporarily for backward compatibility.

func (*KvAlert) Clear

func (kva *KvAlert) Clear(resourceType api.ResourceType, alertID int64, ttl uint64) error

Clear clears an alert. Deprecated: Kept temporarily for backward compatibility.

func (*KvAlert) ClearByUniqueTag deprecated

func (kva *KvAlert) ClearByUniqueTag(
	resourceType api.ResourceType,
	resourceId string,
	uniqueTag string,
	ttl uint64,
) error

Deprecated: Kept temporarily for backward compatibility.

func (*KvAlert) Enumerate

func (kva *KvAlert) Enumerate(filter *api.Alert) ([]*api.Alert, error)

Enumerate enumerates alert Deprecated: Kept temporarily for backward compatibility.

func (*KvAlert) EnumerateWithinTimeRange

func (kva *KvAlert) EnumerateWithinTimeRange(
	timeStart time.Time,
	timeEnd time.Time,
	resourceType api.ResourceType,
) ([]*api.Alert, error)

EnumerateWithinTimeRange enumerates alert between timeStart and timeEnd. Deprecated: Kept temporarily for backward compatibility.

func (*KvAlert) Erase

func (kva *KvAlert) Erase(resourceType api.ResourceType, alertID int64) error

Erase erases an alert. Deprecated: Kept temporarily for backward compatibility.

func (*KvAlert) GetKvdbInstance

func (kva *KvAlert) GetKvdbInstance() kvdb.Kvdb

GetKvdbInstance returns a kvdb instance associated with this alert client and clusterID combination. Deprecated: Kept temporarily for backward compatibility.

func (*KvAlert) Raise

func (kva *KvAlert) Raise(a *api.Alert) error

Raise raises an Alert. Deprecated: Kept temporarily for backward compatibility.

func (*KvAlert) RaiseIfNotExist

func (kva *KvAlert) RaiseIfNotExist(a *api.Alert) error

Raise raises an Alert if does not exists yet. Deprecated: Kept temporarily for backward compatibility.

func (*KvAlert) Retrieve

func (kva *KvAlert) Retrieve(resourceType api.ResourceType, alertID int64) (*api.Alert, error)

Retrieve retrieves a specific alert. Deprecated: Kept temporarily for backward compatibility.

func (*KvAlert) Shutdown

func (kva *KvAlert) Shutdown()

Shutdown shutdown Deprecated: Kept temporarily for backward compatibility.

func (*KvAlert) String

func (kva *KvAlert) String() string

String Deprecated: Kept temporarily for backward compatibility.

func (*KvAlert) Subscribe

func (kva *KvAlert) Subscribe(parentAlertType int64, childAlert *api.Alert) error

Subscribe allows a child (dependent) alert to subscribe to a parent alert Deprecated: Kept temporarily for backward compatibility.

func (*KvAlert) Watch

func (kva *KvAlert) Watch(clusterID string, alertWatcherFunc AlertWatcherFunc) error

Watch on all Alerts for the given clusterID. It uses the global kvdb options provided while creating the alertClient object to access this cluster This way we ensure that the caller of the api is able to watch alerts on clusters that it is authorized for. Deprecated: Kept temporarily for backward compatibility.

Jump to

Keyboard shortcuts

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