Documentation
¶
Overview ¶
Package notifications provides interfaces for AIStore notifications
- Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
Package notifications provides interfaces for AIStore notifications
- Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
Index ¶
- func OnFinished(n cluster.Notif, err error)
- func OnProgress(n cluster.Notif)
- type NodeStats
- func (ns *NodeStats) Len() (l int)
- func (ns *NodeStats) Load(key string) (val any, ok bool)
- func (ns *NodeStats) MarshalJSON() (data []byte, err error)
- func (ns *NodeStats) Range(f func(string, any) bool)
- func (ns *NodeStats) Store(key string, stats any)
- func (ns *NodeStats) UnmarshalJSON(data []byte) (err error)
- type NotifBase
- func (notif *NotifBase) LastNotifTime() int64
- func (notif *NotifBase) NotifyInterval() time.Duration
- func (notif *NotifBase) OnFinishedCB() func(cluster.Notif, error)
- func (notif *NotifBase) OnProgressCB() func(cluster.Notif)
- func (notif *NotifBase) SetLastNotified(now int64)
- func (notif *NotifBase) Subscribers() []string
- func (notif *NotifBase) Upon(u cluster.Upon) bool
- type NotifCallback
- type NotifListener
- type NotifListenerBase
- func (nlb *NotifListenerBase) Aborted() bool
- func (nlb *NotifListenerBase) ActiveCount() int
- func (nlb *NotifListenerBase) ActiveNotifiers() cluster.NodeMap
- func (nlb *NotifListenerBase) AddedTime() int64
- func (nlb *NotifListenerBase) Bcks() []*cmn.Bck
- func (nlb *NotifListenerBase) Callback(nl NotifListener, ts int64)
- func (nlb *NotifListenerBase) EndTime() int64
- func (nlb *NotifListenerBase) Err() error
- func (nlb *NotifListenerBase) FinCount() int
- func (nlb *NotifListenerBase) Finished() bool
- func (nlb *NotifListenerBase) GetOwner() string
- func (nlb *NotifListenerBase) HasFinished(node *cluster.Snode) bool
- func (nlb *NotifListenerBase) Kind() string
- func (nlb *NotifListenerBase) LastUpdated(si *cluster.Snode) int64
- func (nlb *NotifListenerBase) Lock()
- func (nlb *NotifListenerBase) MarkFinished(node *cluster.Snode)
- func (nlb *NotifListenerBase) NodeStats() *NodeStats
- func (nlb *NotifListenerBase) NodesTardy(durs ...time.Duration) (nodes cluster.NodeMap, tardy bool)
- func (nlb *NotifListenerBase) Notifiers() cluster.NodeMap
- func (nlb *NotifListenerBase) ProgressInterval() time.Duration
- func (nlb *NotifListenerBase) RLock()
- func (nlb *NotifListenerBase) RUnlock()
- func (nlb *NotifListenerBase) SetAborted()
- func (nlb *NotifListenerBase) SetAddedTime()
- func (nlb *NotifListenerBase) SetErr(err error)
- func (nlb *NotifListenerBase) SetHrwOwner(smap *cluster.Smap)
- func (nlb *NotifListenerBase) SetOwner(o string)
- func (nlb *NotifListenerBase) SetStats(daeID string, stats any)
- func (nlb *NotifListenerBase) Status() *NotifStatus
- func (nlb *NotifListenerBase) String() string
- func (nlb *NotifListenerBase) UUID() string
- func (nlb *NotifListenerBase) Unlock()
- type NotifStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OnFinished ¶
func OnProgress ¶
Types ¶
type NodeStats ¶
func NewNodeStats ¶
func (*NodeStats) MarshalJSON ¶
func (*NodeStats) UnmarshalJSON ¶
type NotifBase ¶
type NotifBase struct {
F func(n cluster.Notif, err error) // notification callback
P func(n cluster.Notif) // on progress notification callback
Dsts []string // node IDs to notify
When cluster.Upon // see the enum below
Interval time.Duration // interval at which progress needs to be updated
// contains filtered or unexported fields
}
func (*NotifBase) LastNotifTime ¶
func (*NotifBase) NotifyInterval ¶
func (*NotifBase) OnProgressCB ¶
func (*NotifBase) SetLastNotified ¶
func (*NotifBase) Subscribers ¶
type NotifCallback ¶
type NotifCallback func(n NotifListener)
type NotifListener ¶
type NotifListener interface {
Callback(nl NotifListener, ts int64)
UnmarshalStats(rawMsg []byte) (any, bool, bool, error)
Lock()
Unlock()
RLock()
RUnlock()
Notifiers() cluster.NodeMap
Kind() string
Bcks() []*cmn.Bck
SetErr(error)
Err() error
UUID() string
SetAborted()
Aborted() bool
Status() *NotifStatus
SetStats(daeID string, stats any)
NodeStats() *NodeStats
QueryArgs() cmn.HreqArgs
AbortArgs() cmn.HreqArgs
EndTime() int64
SetAddedTime()
AddedTime() int64
Finished() bool
String() string
GetOwner() string
SetOwner(string)
SetHrwOwner(smap *cluster.Smap)
LastUpdated(si *cluster.Snode) int64
ProgressInterval() time.Duration
// detailed ref-counting
ActiveNotifiers() cluster.NodeMap
FinCount() int
ActiveCount() int
HasFinished(node *cluster.Snode) bool
MarkFinished(node *cluster.Snode)
NodesTardy(durs ...time.Duration) (nodes cluster.NodeMap, tardy bool)
}
type NotifListenerBase ¶
type NotifListenerBase struct {
Common struct {
UUID string
Action string // async operation kind (see cmn/api_const.go)
Owned string // "": not owned | equalIC: IC | otherwise, pid + IC
SmapVersion int64 // smap version in which NL is added
Bck []*cmn.Bck
}
// construction
Srcs cluster.NodeMap // all notifiers
ActiveSrcs cluster.NodeMap // running notifiers
F NotifCallback `json:"-"` // optional listening-side callback
Stats *NodeStats // [daeID => Stats (e.g. cmn.SnapExt)]
// runtime
FinTime atomic.Int64 // timestamp when finished
AbortedX atomic.Bool // sets if the xaction is Aborted
ErrValue cos.ErrValue // reported error and count
// contains filtered or unexported fields
}
func (*NotifListenerBase) Aborted ¶
func (nlb *NotifListenerBase) Aborted() bool
func (*NotifListenerBase) ActiveCount ¶
func (nlb *NotifListenerBase) ActiveCount() int
func (*NotifListenerBase) ActiveNotifiers ¶
func (nlb *NotifListenerBase) ActiveNotifiers() cluster.NodeMap
func (*NotifListenerBase) AddedTime ¶
func (nlb *NotifListenerBase) AddedTime() int64
func (*NotifListenerBase) Bcks ¶
func (nlb *NotifListenerBase) Bcks() []*cmn.Bck
func (*NotifListenerBase) Callback ¶
func (nlb *NotifListenerBase) Callback(nl NotifListener, ts int64)
is called after all Notifiers will have notified OR on failure (err != nil)
func (*NotifListenerBase) EndTime ¶
func (nlb *NotifListenerBase) EndTime() int64
func (*NotifListenerBase) Err ¶
func (nlb *NotifListenerBase) Err() error
func (*NotifListenerBase) FinCount ¶
func (nlb *NotifListenerBase) FinCount() int
func (*NotifListenerBase) Finished ¶
func (nlb *NotifListenerBase) Finished() bool
func (*NotifListenerBase) GetOwner ¶
func (nlb *NotifListenerBase) GetOwner() string
func (*NotifListenerBase) HasFinished ¶
func (nlb *NotifListenerBase) HasFinished(node *cluster.Snode) bool
func (*NotifListenerBase) Kind ¶
func (nlb *NotifListenerBase) Kind() string
func (*NotifListenerBase) LastUpdated ¶
func (nlb *NotifListenerBase) LastUpdated(si *cluster.Snode) int64
func (*NotifListenerBase) Lock ¶
func (nlb *NotifListenerBase) Lock()
func (*NotifListenerBase) MarkFinished ¶
func (nlb *NotifListenerBase) MarkFinished(node *cluster.Snode)
func (*NotifListenerBase) NodeStats ¶
func (nlb *NotifListenerBase) NodeStats() *NodeStats
func (*NotifListenerBase) NodesTardy ¶
func (*NotifListenerBase) Notifiers ¶
func (nlb *NotifListenerBase) Notifiers() cluster.NodeMap
func (*NotifListenerBase) ProgressInterval ¶
func (nlb *NotifListenerBase) ProgressInterval() time.Duration
func (*NotifListenerBase) RLock ¶
func (nlb *NotifListenerBase) RLock()
func (*NotifListenerBase) RUnlock ¶
func (nlb *NotifListenerBase) RUnlock()
func (*NotifListenerBase) SetAborted ¶
func (nlb *NotifListenerBase) SetAborted()
func (*NotifListenerBase) SetAddedTime ¶
func (nlb *NotifListenerBase) SetAddedTime()
func (*NotifListenerBase) SetErr ¶
func (nlb *NotifListenerBase) SetErr(err error)
func (*NotifListenerBase) SetHrwOwner ¶
func (nlb *NotifListenerBase) SetHrwOwner(smap *cluster.Smap)
effectively, cache owner
func (*NotifListenerBase) SetOwner ¶
func (nlb *NotifListenerBase) SetOwner(o string)
func (*NotifListenerBase) SetStats ¶
func (nlb *NotifListenerBase) SetStats(daeID string, stats any)
func (*NotifListenerBase) Status ¶
func (nlb *NotifListenerBase) Status() *NotifStatus
func (*NotifListenerBase) String ¶
func (nlb *NotifListenerBase) String() string
func (*NotifListenerBase) UUID ¶
func (nlb *NotifListenerBase) UUID() string
func (*NotifListenerBase) Unlock ¶
func (nlb *NotifListenerBase) Unlock()
type NotifStatus ¶
type NotifStatus struct {
UUID string `json:"uuid"` // UUID of the xaction
ErrMsg string `json:"err"` // error
FinTime int64 `json:"end_time"` // time xaction ended
AbortedX bool `json:"aborted"` // true if aborted
}
func (*NotifStatus) Aborted ¶
func (xs *NotifStatus) Aborted() bool
func (*NotifStatus) Finished ¶
func (xs *NotifStatus) Finished() bool
Click to show internal directories.
Click to hide internal directories.