nl

package
v1.3.13 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: MIT Imports: 10 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func OnFinished

func OnFinished(n cluster.Notif, err error)

func OnProgress

func OnProgress(n cluster.Notif)

Types

type NodeStats

type NodeStats struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewNodeStats

func NewNodeStats(sizes ...int) *NodeStats

func (*NodeStats) Len

func (ns *NodeStats) Len() (l int)

func (*NodeStats) Load

func (ns *NodeStats) Load(key string) (val any, ok bool)

func (*NodeStats) MarshalJSON

func (ns *NodeStats) MarshalJSON() (data []byte, err error)

func (*NodeStats) Range

func (ns *NodeStats) Range(f func(string, any) bool)

func (*NodeStats) Store

func (ns *NodeStats) Store(key string, stats any)

func (*NodeStats) UnmarshalJSON

func (ns *NodeStats) UnmarshalJSON(data []byte) (err error)

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 (notif *NotifBase) LastNotifTime() int64

func (*NotifBase) NotifyInterval

func (notif *NotifBase) NotifyInterval() time.Duration

func (*NotifBase) OnFinishedCB

func (notif *NotifBase) OnFinishedCB() func(cluster.Notif, error)

func (*NotifBase) OnProgressCB

func (notif *NotifBase) OnProgressCB() func(cluster.Notif)

func (*NotifBase) SetLastNotified

func (notif *NotifBase) SetLastNotified(now int64)

func (*NotifBase) Subscribers

func (notif *NotifBase) Subscribers() []string

func (*NotifBase) Upon

func (notif *NotifBase) Upon(u cluster.Upon) bool

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 NewNLB

func NewNLB(uuid, action string, smap *cluster.Smap, srcs cluster.NodeMap, progress time.Duration, bck ...*cmn.Bck) *NotifListenerBase

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 (nlb *NotifListenerBase) NodesTardy(durs ...time.Duration) (nodes cluster.NodeMap, tardy bool)

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

Jump to

Keyboard shortcuts

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