meta

package
v1.3.20 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package meta: cluster-level metadata

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

Package meta: cluster-level metadata

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

Package meta: cluster-level metadata

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

Package meta: cluster-level metadata

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

Package meta: cluster-level metadata

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

Index

Constants

View Source
const (
	SnodeNonElectable cos.BitFlags = 1 << iota
	SnodeIC
	SnodeMaint
	SnodeDecomm
	SnodeMaintPostReb
)

enum Snode.Flags

View Source
const (
	PnamePrefix = "p["
	TnamePrefix = "t["
	SnameSuffix = "]"
)
View Source
const DfltCountIC = 3

desirable gateway count in the Information Center (IC)

View Source
const SnodeMaintDecomm = SnodeMaint | SnodeDecomm

Variables

This section is empty.

Functions

func FreeNodes

func FreeNodes(nodes Nodes)

func MaxBcastParallel

func MaxBcastParallel() int

func N2ID

func N2ID(name string) string

func Pname

func Pname(pid string) string

func Tname

func Tname(tid string) string

Types

type BMD

type BMD struct {
	Ext       any       `json:"ext,omitempty"`  // within meta-version extensions
	Providers Providers `json:"providers"`      // (provider, namespace, bucket) hierarchy
	UUID      string    `json:"uuid"`           // unique & immutable
	Version   int64     `json:"version,string"` // gets incremented on every update
}

- BMD is the root of the (providers, namespaces, buckets) hierarchy - BMD (instance) can be obtained via Bowner.Get() - BMD is immutable and versioned - BMD versioning is monotonic and incremental

func (*BMD) Add

func (m *BMD) Add(bck *Bck)

func (*BMD) Del

func (m *BMD) Del(bck *Bck) (deleted bool)

func (*BMD) Exists

func (m *BMD) Exists(bck *Bck, bckID uint64) (exists bool)

func (*BMD) Get

func (m *BMD) Get(bck *Bck) (p *cmn.BucketProps, present bool)

func (*BMD) IsECUsed

func (m *BMD) IsECUsed() (yes bool)

func (*BMD) IsEmpty

func (m *BMD) IsEmpty() bool

func (*BMD) JspOpts

func (*BMD) JspOpts() jsp.Options

func (*BMD) Range

func (m *BMD) Range(providerQuery *string, nsQuery *cmn.Ns, callback func(*Bck) bool)

providerQuery == nil: all providers; nsQuery == nil: all namespaces

func (*BMD) Select

func (m *BMD) Select(qbck *cmn.QueryBcks) cmn.Bcks

func (*BMD) Set

func (m *BMD) Set(bck *Bck, p *cmn.BucketProps)

func (*BMD) String

func (m *BMD) String() string

func (*BMD) StringEx

func (m *BMD) StringEx() string

type Bck

type Bck cmn.Bck

func CloneBck

func CloneBck(bck *cmn.Bck) *Bck

func InitByNameOnly

func InitByNameOnly(bckName string, bowner Bowner) (bck *Bck, err error, errCode int)

to support s3 clients: find an already existing bucket by name (and nothing else) returns an error when name cannot be unambiguously resolved to a single bucket

func NewBck

func NewBck(name, provider string, ns cmn.Ns, optProps ...*cmn.BucketProps) *Bck

func (*Bck) AddToQuery

func (b *Bck) AddToQuery(q url.Values) url.Values

func (*Bck) AddUnameToQuery

func (b *Bck) AddUnameToQuery(q url.Values, uparam string) url.Values

func (*Bck) Allow

func (b *Bck) Allow(bit apc.AccessAttrs) error

func (*Bck) Backend

func (b *Bck) Backend() *Bck

func (*Bck) Bucket

func (b *Bck) Bucket() *cmn.Bck

cast *meta.Bck => *cmn.Bck

func (*Bck) CksumConf

func (b *Bck) CksumConf() (conf *cmn.CksumConf)

func (*Bck) Clone

func (b *Bck) Clone() cmn.Bck

clone (*meta.Bck | *cmn.Bck) <=> (cmn.Bck | meta.Bck) respectively

func (*Bck) Cname

func (b *Bck) Cname(name string) string

func (*Bck) Equal

func (b *Bck) Equal(other *Bck, sameID, sameBackend bool) bool

func (*Bck) HasProvider

func (b *Bck) HasProvider() bool

func (*Bck) Init

func (b *Bck) Init(bowner Bowner) (err error)

when the bucket is not present in the BMD: - always returns the corresponding *DoesNotExist error - Cloud bucket: fills in the props with defaults from config - AIS bucket: sets the props to nil - Remote (Cloud or Remote AIS) bucket: caller can type-cast err.(*cmn.ErrRemoteBckNotFound) and proceed

func (*Bck) InitFast

func (b *Bck) InitFast(bowner Bowner) (err error)

part of lom.init (compare with the above)

func (*Bck) InitNoBackend

func (b *Bck) InitNoBackend(bowner Bowner) error

func (*Bck) IsAIS

func (b *Bck) IsAIS() bool

func (*Bck) IsCloud

func (b *Bck) IsCloud() bool

func (*Bck) IsEmpty

func (b *Bck) IsEmpty() bool

func (*Bck) IsHDFS

func (b *Bck) IsHDFS() bool

func (*Bck) IsHTTP

func (b *Bck) IsHTTP() bool

func (*Bck) IsQuery

func (b *Bck) IsQuery() bool

func (*Bck) IsRemote

func (b *Bck) IsRemote() bool

func (*Bck) IsRemoteAIS

func (b *Bck) IsRemoteAIS() bool

func (*Bck) MakeUname

func (b *Bck) MakeUname(name string) string

func (*Bck) MaskBID

func (b *Bck) MaskBID(i int64) uint64

func (*Bck) RemoteBck

func (b *Bck) RemoteBck() *cmn.Bck

func (*Bck) String

func (b *Bck) String() string

func (*Bck) Validate

func (b *Bck) Validate() error

func (*Bck) VersionConf

func (b *Bck) VersionConf() cmn.VersionConf

type Bowner

type Bowner interface {
	Get() (bmd *BMD)
}

interface to Get current (versioned, immutable) BMD instance (for implementation, see ais/bucketmeta.go)

type Buckets

type Buckets map[string]*cmn.BucketProps

type Namespaces

type Namespaces map[string]Buckets

type NetInfo

type NetInfo struct {
	Hostname string `json:"node_ip_addr"`
	Port     string `json:"daemon_port"`
	URL      string `json:"direct_url"`
	// contains filtered or unexported fields
}

Snode's networking info

func NewNetInfo

func NewNetInfo(proto, hostname, port string) *NetInfo

func (*NetInfo) String

func (ni *NetInfo) String() string

func (*NetInfo) TCPEndpoint

func (ni *NetInfo) TCPEndpoint() string

type NodeMap

type NodeMap map[string]*Snode // map of Snodes indexed by node ID (Pmap & Tmap below)

func (NodeMap) ActiveMap

func (m NodeMap) ActiveMap() (clone NodeMap)

func (NodeMap) ActiveNodes

func (m NodeMap) ActiveNodes() []*Snode

func (NodeMap) Add

func (m NodeMap) Add(snode *Snode)

func (NodeMap) Contains

func (m NodeMap) Contains(daeID string) (exists bool)

type Nodes

type Nodes []*Snode // slice of Snodes

func AllocNodes

func AllocNodes(capacity int) (nodes Nodes)

type Providers

type Providers map[string]Namespaces

type RMD

type RMD struct {
	Ext       any      `json:"ext,omitempty"` // within meta-version extensions
	Resilver  string   `json:"resilver,omitempty"`
	TargetIDs []string `json:"target_ids,omitempty"`
	Version   int64    `json:"version"`
}

RMD (Rebalance MetaData)

func (*RMD) JspOpts

func (*RMD) JspOpts() jsp.Options

type Slistener

type Slistener interface {
	String() string
	ListenSmapChanged()
}

Smap On-change listeners (see ais/clustermap.go for impl-s)

type Smap

type Smap struct {
	Ext          any     `json:"ext,omitempty"`
	Pmap         NodeMap `json:"pmap"` // [pid => Snode]
	Primary      *Snode  `json:"proxy_si"`
	Tmap         NodeMap `json:"tmap"`          // [tid => Snode]
	UUID         string  `json:"uuid"`          // assigned once at creation time and never change
	CreationTime string  `json:"creation_time"` // creation timestamp
	Version      int64   `json:"version,string"`
}

cluster map

func (*Smap) Compare

func (m *Smap) Compare(other *Smap) (uuid string, sameOrigin, sameVersion, eq bool)

func (*Smap) CompareTargets

func (m *Smap) CompareTargets(other *Smap) (equal bool)

func (*Smap) Count

func (m *Smap) Count() int

func (*Smap) CountActivePs

func (m *Smap) CountActivePs() (count int)

func (*Smap) CountActiveTs

func (m *Smap) CountActiveTs() (count int)

func (*Smap) CountNonElectable

func (m *Smap) CountNonElectable() (count int)

func (*Smap) CountProxies

func (m *Smap) CountProxies() int

func (*Smap) CountTargets

func (m *Smap) CountTargets() int

func (*Smap) GetActiveNode

func (m *Smap) GetActiveNode(sid string) (si *Snode)

(convenient, slightly redundant)

func (*Smap) GetNode

func (m *Smap) GetNode(id string) *Snode

func (*Smap) GetProxy

func (m *Smap) GetProxy(pid string) *Snode

func (*Smap) GetRandProxy

func (m *Smap) GetRandProxy(excludePrimary bool) (si *Snode, err error)

func (*Smap) GetRandTarget

func (m *Smap) GetRandTarget() (tsi *Snode, err error)

(random active)

func (*Smap) GetTarget

func (m *Smap) GetTarget(sid string) *Snode

func (*Smap) HasActiveTs

func (m *Smap) HasActiveTs(except string) bool

whether this target has active peers

func (*Smap) ICCount

func (m *Smap) ICCount() int

func (*Smap) InMaint

func (m *Smap) InMaint(si *Snode) bool

func (*Smap) InMaintOrDecomm

func (m *Smap) InMaintOrDecomm(si *Snode) bool

given Snode, check (usually, the current) Smap that it is present _and_ InMaintOrDecomm (see also GetActiveNode)

func (*Smap) InitDigests

func (m *Smap) InitDigests()

func (*Smap) IsDupNet

func (m *Smap) IsDupNet(nsi *Snode) (osi *Snode, err error)

whether IP is in use by a different node

func (*Smap) IsIC

func (m *Smap) IsIC(psi *Snode) (ok bool)

func (*Smap) IsPrimary

func (m *Smap) IsPrimary(si *Snode) bool

func (*Smap) JspOpts

func (*Smap) JspOpts() jsp.Options

func (*Smap) NewTmap

func (m *Smap) NewTmap(tids []string) (tmap NodeMap, err error)

func (*Smap) NonElectable

func (m *Smap) NonElectable(psi *Snode) (ok bool)

func (*Smap) PubNet2Node

func (m *Smap) PubNet2Node(hostport string) *Snode

checking pub net only

func (*Smap) StrIC

func (m *Smap) StrIC(node *Snode) string

func (*Smap) String

func (m *Smap) String() string

func (*Smap) StringEx

func (m *Smap) StringEx() string

type SmapListeners

type SmapListeners interface {
	Reg(sl Slistener)
	Unreg(sl Slistener)
}

type Snode

type Snode struct {
	Ext        any        `json:"ext,omitempty"` // within meta-version extensions
	LocalNet   *net.IPNet `json:"-"`
	PubNet     NetInfo    `json:"public_net"`        // cmn.NetPublic
	DataNet    NetInfo    `json:"intra_data_net"`    // cmn.NetIntraData
	ControlNet NetInfo    `json:"intra_control_net"` // cmn.NetIntraControl
	DaeType    string     `json:"daemon_type"`       // "target" or "proxy"
	DaeID      string     `json:"daemon_id"`

	Flags cos.BitFlags `json:"flags"` // enum { SnodeNonElectable, SnodeIC, ... }
	// contains filtered or unexported fields
}

Snode - a node (gateway or target) in a cluster

func NewSnode

func NewSnode(id, daeType string, publicNet, intraControlNet, intraDataNet NetInfo) (snode *Snode)

func (*Snode) Clone

func (d *Snode) Clone() *Snode

func (*Snode) Digest

func (d *Snode) Digest() uint64

func (*Snode) Equals

func (d *Snode) Equals(o *Snode) (eq bool)

func (*Snode) Fl2S added in v1.3.20

func (d *Snode) Fl2S() string

func (*Snode) ID

func (d *Snode) ID() string

func (*Snode) InMaint

func (d *Snode) InMaint() bool

func (*Snode) InMaintOrDecomm

func (d *Snode) InMaintOrDecomm() bool

node flags

func (*Snode) InMaintPostReb

func (d *Snode) InMaintPostReb() bool

func (*Snode) Init

func (d *Snode) Init(id, daeType string)

func (*Snode) IsIC

func (d *Snode) IsIC() bool

func (*Snode) IsProxy

func (d *Snode) IsProxy() bool

func (*Snode) IsTarget

func (d *Snode) IsTarget() bool

func (*Snode) Name

func (d *Snode) Name() string

func (*Snode) SetName

func (d *Snode) SetName()

func (*Snode) String

func (d *Snode) String() string

func (*Snode) StringEx

func (d *Snode) StringEx() string

func (*Snode) Type

func (d *Snode) Type() string

func (*Snode) URL

func (d *Snode) URL(network string) string

func (*Snode) Validate

func (d *Snode) Validate() error

type Sowner

type Sowner interface {
	Get() (smap *Smap)
	Listeners() SmapListeners
}

interface to Get current (immutable, versioned) cluster map (Smap) instance

Jump to

Keyboard shortcuts

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