Documentation ¶
Index ¶
- Constants
- Variables
- func Register(name string, initFunc InitFunc) error
- func Shutdown()
- type Alert
- type AlertWatcherFunc
- type InitFunc
- type KvAlert
- func (kva *KvAlert) Clear(resourceType api.ResourceType, alertID int64, ttl uint64) error
- func (kva *KvAlert) ClearByUniqueTag(resourceType api.ResourceType, resourceId string, uniqueTag string, ttl uint64) errordeprecated
- func (kva *KvAlert) Enumerate(filter *api.Alert) ([]*api.Alert, error)
- func (kva *KvAlert) EnumerateWithinTimeRange(timeStart time.Time, timeEnd time.Time, resourceType api.ResourceType) ([]*api.Alert, error)
- func (kva *KvAlert) Erase(resourceType api.ResourceType, alertID int64) error
- func (kva *KvAlert) GetKvdbInstance() kvdb.Kvdb
- func (kva *KvAlert) Raise(a *api.Alert) error
- func (kva *KvAlert) RaiseIfNotExist(a *api.Alert) error
- func (kva *KvAlert) Retrieve(resourceType api.ResourceType, alertID int64) (*api.Alert, error)
- func (kva *KvAlert) Shutdown()
- func (kva *KvAlert) String() string
- func (kva *KvAlert) Subscribe(parentAlertType int64, childAlert *api.Alert) error
- func (kva *KvAlert) Watch(clusterID string, alertWatcherFunc AlertWatcherFunc) error
Constants ¶
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 ¶
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 ¶
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.
type AlertWatcherFunc ¶
AlertWatcherFunc is a function type used as a callback for KV WatchTree. Deprecated: Kept temporarily for backward compatibility.
type InitFunc ¶
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 ¶
Clear clears an alert. Deprecated: Kept temporarily for backward compatibility.
func (*KvAlert) ClearByUniqueTag
deprecated
func (*KvAlert) Enumerate ¶
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 ¶
GetKvdbInstance returns a kvdb instance associated with this alert client and clusterID combination. Deprecated: Kept temporarily for backward compatibility.
func (*KvAlert) Raise ¶
Raise raises an Alert. Deprecated: Kept temporarily for backward compatibility.
func (*KvAlert) RaiseIfNotExist ¶
Raise raises an Alert if does not exists yet. Deprecated: Kept temporarily for backward compatibility.
func (*KvAlert) Retrieve ¶
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) Subscribe ¶
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.