nl

package
v1.3.22 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package notifications provides interfaces for AIStore notifications

  • Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved.

Package notifications provides interfaces for AIStore notifications

  • Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OnFinished

func OnFinished(n core.Notif, err error, aborted bool)

func OnProgress

func OnProgress(n core.Notif)

Types

type Base added in v1.3.16

type Base struct {
	F func(n core.Notif, err error, aborted bool) // notification callback
	P func(n core.Notif)                          // on progress notification callback

	Dsts []string // node IDs to notify

	When     core.Upon     // see the enum below
	Interval time.Duration // interval at which progress needs to be updated
	// contains filtered or unexported fields
}

func (*Base) LastNotifTime added in v1.3.16

func (base *Base) LastNotifTime() int64

func (*Base) NotifyInterval added in v1.3.16

func (base *Base) NotifyInterval() time.Duration

func (*Base) OnFinishedCB added in v1.3.16

func (base *Base) OnFinishedCB() func(core.Notif, error, bool)

func (*Base) OnProgressCB added in v1.3.16

func (base *Base) OnProgressCB() func(core.Notif)

func (*Base) SetLastNotified added in v1.3.16

func (base *Base) SetLastNotified(now int64)

func (*Base) Subscribers added in v1.3.16

func (base *Base) Subscribers() []string

func (*Base) Upon added in v1.3.16

func (base *Base) Upon(u core.Upon) bool

type Callback added in v1.3.16

type Callback func(n Listener)

type Listener added in v1.3.16

type Listener interface {
	Callback(nl Listener, ts int64)
	UnmarshalStats(rawMsg []byte) (any, bool, bool, error)
	Lock()
	Unlock()
	RLock()
	RUnlock()
	Notifiers() meta.NodeMap
	Kind() string
	Cause() string
	Bcks() []*cmn.Bck
	AddErr(error)
	Err() error
	ErrCnt() int
	UUID() string
	SetAborted()
	Aborted() bool
	Status() *Status
	SetStats(daeID string, stats any)
	NodeStats() *NodeStats
	QueryArgs() cmn.HreqArgs
	EndTime() int64
	SetAddedTime()
	AddedTime() int64
	Finished() bool
	Name() string
	String() string
	GetOwner() string
	SetOwner(string)
	LastUpdated(*meta.Snode) int64
	ProgressInterval() time.Duration

	// detailed ref-counting
	ActiveNotifiers() meta.NodeMap
	FinCount() int
	ActiveCount() int
	HasFinished(*meta.Snode) bool
	MarkFinished(*meta.Snode)
	NodesTardy(periodicNotifTime time.Duration) (nodes meta.NodeMap, tardy bool)
}

type ListenerBase added in v1.3.16

type ListenerBase struct {
	Common struct {
		UUID  string
		Kind  string // async operation kind (see api/apc/actmsg.go)
		Cause string // causal action (e.g. decommission => rebalance)
		Owned string // "": not owned | equalIC: IC | otherwise, pid + IC
		Bck   []*cmn.Bck
	}
	// construction
	Srcs       meta.NodeMap // all notifiers
	ActiveSrcs meta.NodeMap // running notifiers
	F          Callback     `json:"-"` // optional listening-side callback
	Stats      *NodeStats   // [daeID => Stats (e.g. cmn.SnapExt)]

	// runtime
	EndTimeX atomic.Int64 // timestamp when finished
	AbortedX atomic.Bool  // sets if the xaction is Aborted
	Errs     cos.Errs     // reported error and count
	// contains filtered or unexported fields
}

func NewNLB

func NewNLB(uuid, action, cause string, srcs meta.NodeMap, progress time.Duration, bck ...*cmn.Bck) *ListenerBase

func (*ListenerBase) Aborted added in v1.3.16

func (nlb *ListenerBase) Aborted() bool

func (*ListenerBase) ActiveCount added in v1.3.16

func (nlb *ListenerBase) ActiveCount() int

func (*ListenerBase) ActiveNotifiers added in v1.3.16

func (nlb *ListenerBase) ActiveNotifiers() meta.NodeMap

func (*ListenerBase) AddErr added in v1.3.18

func (nlb *ListenerBase) AddErr(err error)

func (*ListenerBase) AddedTime added in v1.3.16

func (nlb *ListenerBase) AddedTime() int64

func (*ListenerBase) Bcks added in v1.3.16

func (nlb *ListenerBase) Bcks() []*cmn.Bck

func (*ListenerBase) Callback added in v1.3.16

func (nlb *ListenerBase) Callback(nl Listener, ts int64)

is called after all Notifiers will have notified OR on failure (err != nil)

func (*ListenerBase) Cause added in v1.3.21

func (nlb *ListenerBase) Cause() string

func (*ListenerBase) EndTime added in v1.3.16

func (nlb *ListenerBase) EndTime() int64

func (*ListenerBase) Err added in v1.3.16

func (nlb *ListenerBase) Err() error

func (*ListenerBase) ErrCnt added in v1.3.18

func (nlb *ListenerBase) ErrCnt() int

func (*ListenerBase) FinCount added in v1.3.16

func (nlb *ListenerBase) FinCount() int

func (*ListenerBase) Finished added in v1.3.16

func (nlb *ListenerBase) Finished() bool

func (*ListenerBase) GetOwner added in v1.3.16

func (nlb *ListenerBase) GetOwner() string

func (*ListenerBase) HasFinished added in v1.3.16

func (nlb *ListenerBase) HasFinished(node *meta.Snode) bool

func (*ListenerBase) Kind added in v1.3.16

func (nlb *ListenerBase) Kind() string

func (*ListenerBase) LastUpdated added in v1.3.16

func (nlb *ListenerBase) LastUpdated(si *meta.Snode) int64

func (*ListenerBase) Lock added in v1.3.16

func (nlb *ListenerBase) Lock()

func (*ListenerBase) MarkFinished added in v1.3.16

func (nlb *ListenerBase) MarkFinished(node *meta.Snode)

func (*ListenerBase) Name added in v1.3.22

func (nlb *ListenerBase) Name() string

func (*ListenerBase) NodeStats added in v1.3.16

func (nlb *ListenerBase) NodeStats() *NodeStats

func (*ListenerBase) NodesTardy added in v1.3.16

func (nlb *ListenerBase) NodesTardy(periodicNotifTime time.Duration) (nodes meta.NodeMap, tardy bool)

under rlock

func (*ListenerBase) Notifiers added in v1.3.16

func (nlb *ListenerBase) Notifiers() meta.NodeMap

func (*ListenerBase) ProgressInterval added in v1.3.16

func (nlb *ListenerBase) ProgressInterval() time.Duration

func (*ListenerBase) RLock added in v1.3.16

func (nlb *ListenerBase) RLock()

func (*ListenerBase) RUnlock added in v1.3.16

func (nlb *ListenerBase) RUnlock()

func (*ListenerBase) SetAborted added in v1.3.16

func (nlb *ListenerBase) SetAborted()

func (*ListenerBase) SetAddedTime added in v1.3.16

func (nlb *ListenerBase) SetAddedTime()

func (*ListenerBase) SetOwner added in v1.3.16

func (nlb *ListenerBase) SetOwner(o string)

func (*ListenerBase) SetStats added in v1.3.16

func (nlb *ListenerBase) SetStats(daeID string, stats any)

func (*ListenerBase) Status added in v1.3.16

func (nlb *ListenerBase) Status() *Status

func (*ListenerBase) String added in v1.3.16

func (nlb *ListenerBase) String() string

func (*ListenerBase) UUID added in v1.3.16

func (nlb *ListenerBase) UUID() string

func (*ListenerBase) Unlock added in v1.3.16

func (nlb *ListenerBase) Unlock()

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 Status added in v1.3.16

type Status struct {
	Kind     string `json:"kind"`     // xaction kind
	UUID     string `json:"uuid"`     // xaction UUID
	ErrMsg   string `json:"err"`      // error
	EndTimeX int64  `json:"end_time"` // time xaction ended
	AbortedX bool   `json:"aborted"`  // true if aborted
}

func (*Status) Aborted added in v1.3.16

func (ns *Status) Aborted() bool

func (*Status) Finished added in v1.3.16

func (ns *Status) Finished() bool

func (*Status) String added in v1.3.16

func (ns *Status) String() (s string)

type StatusVec added in v1.3.16

type StatusVec []Status

func (StatusVec) String added in v1.3.16

func (nsv StatusVec) String() (s string)

Jump to

Keyboard shortcuts

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