Documentation ¶
Overview ¶
Package cluster provides local access to cluster-level metadata
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Package cluster provides common interfaces and local access to cluster-level metadata
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Package cluster provides common interfaces and local access to cluster-level metadata
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Package cluster provides common interfaces and local access to cluster-level metadata
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Package cluster provides common interfaces and local access to cluster-level metadata
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Package cluster provides common interfaces and local access to cluster-level metadata
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Package cluster provides common interfaces and local access to cluster-level metadata
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Package cluster provides common interfaces and local access to cluster-level metadata
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Package cluster provides common interfaces and local access to cluster-level metadata
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Package cluster provides common interfaces and local access to cluster-level metadata
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Package cluster provides common interfaces and local access to cluster-level metadata
- Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
Package cluster provides common interfaces and local access to cluster-level metadata
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Package cluster provides local access to cluster-level metadata
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Package cluster provides local access to cluster-level metadata
- Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
Package cluster provides common interfaces and local access to cluster-level metadata
- Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.
Package cluster provides common interfaces and local access to cluster-level metadata
- Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.
Package cluster provides local access to cluster-level metadata
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Package cluster provides local access to cluster-level metadata
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Index ¶
- Constants
- func EvictLomCache(b *meta.Bck)
- func FreeCpObjParams(a *CopyObjectParams)
- func FreeLOM(lom *LOM)
- func FreePutObjParams(a *PutObjectParams)
- func HrwFQN(bck *cmn.Bck, contentType, objName string) (fqn string, digest uint64, err error)
- func HrwIC(smap *meta.Smap, uuid string) (pi *meta.Snode, err error)
- func HrwMpath(uname string) (mi *fs.Mountpath, digest uint64, err error)
- func HrwProxy(smap *meta.Smap, idToSkip string) (pi *meta.Snode, err error)
- func HrwTarget(uname string, smap *meta.Smap) (si *meta.Snode, err error)
- func HrwTargetAll(uname string, smap *meta.Smap) (si *meta.Snode, err error)
- func HrwTargetList(uname string, smap *meta.Smap, count int) (sis meta.Nodes, err error)
- func HrwTargetTask(uuid string, smap *meta.Smap) (si *meta.Snode, err error)
- func Init(t TargetLoc)
- func ParseObjLoc(loc string) (tname, mpname string)
- func RegLomCacheWithHK(t Target)
- func ResolveFQN(fqn string) (parsedFQN fs.ParsedFQN, hrwFQN string, err error)
- type BackendProvider
- type CT
- func (ct *CT) Bck() *meta.Bck
- func (ct *CT) Bucket() *cmn.Bck
- func (ct *CT) CacheIdx() int
- func (ct *CT) Clone(ctType string) *CT
- func (ct *CT) ContentType() string
- func (ct *CT) FQN() string
- func (ct *CT) LoadFromFS() error
- func (ct *CT) Lock(exclusive bool)
- func (ct *CT) Make(toType string, pref ...string) string
- func (ct *CT) Mountpath() *fs.Mountpath
- func (ct *CT) MtimeUnix() int64
- func (ct *CT) ObjectName() string
- func (ct *CT) SizeBytes() int64
- func (ct *CT) Uname() string
- func (ct *CT) Unlock(exclusive bool)
- func (ct *CT) Write(t Target, reader io.Reader, size int64, workFQN ...string) (err error)
- type CopyObjectParams
- type DP
- type DataMover
- type LDP
- type LIF
- type LOM
- func (lom *LOM) AcquireAtimefs() error
- func (lom *LOM) AddCopy(copyFQN string, mpi *fs.Mountpath) error
- func (lom *LOM) AllowDisconnectedBackend(loaded bool) (err error)
- func (lom *LOM) Atime() time.Time
- func (lom *LOM) AtimeUnix() int64
- func (lom *LOM) Bck() *meta.Bck
- func (lom *LOM) Bprops() *cmn.BucketProps
- func (lom *LOM) Bucket() *cmn.Bck
- func (lom *LOM) CacheIdx() int
- func (lom *LOM) Checksum() *cos.Cksum
- func (lom *LOM) CksumConf() *cmn.CksumConf
- func (lom *LOM) CksumType() string
- func (lom *LOM) CloneMD(fqn string) *LOM
- func (lom *LOM) Cname() string
- func (lom *LOM) ComputeCksum(cksumType string) (cksum *cos.CksumHash, err error)
- func (lom *LOM) ComputeSetCksum() (*cos.Cksum, error)
- func (lom *LOM) Copy(mi *fs.Mountpath, buf []byte) (err error)
- func (lom *LOM) Copy2FQN(dstFQN string, buf []byte) (dst *LOM, err error)
- func (lom *LOM) CopyAttrs(oah cos.OAH, skipCksum bool)
- func (lom *LOM) CreateFile(fqn string) (fh *os.File, err error)
- func (lom *LOM) DelAllCopies() (err error)
- func (lom *LOM) DelCopies(copiesFQN ...string) (err error)
- func (lom *LOM) DelExtraCopies(fqn ...string) (removed bool, err error)
- func (lom *LOM) DowngradeLock()
- func (lom *LOM) ECEnabled() bool
- func (lom *LOM) EqCksum(cksum *cos.Cksum) bool
- func (lom *LOM) Equal(rem cos.OAH) (equal bool)
- func (lom *LOM) FromFS() error
- func (lom *LOM) GetCopies() fs.MPI
- func (lom *LOM) GetCustomKey(key string) (string, bool)
- func (lom *LOM) GetCustomMD() cos.StrKVs
- func (lom *LOM) HasCopies() bool
- func (lom *LOM) HrwTarget(smap *meta.Smap) (tsi *meta.Snode, local bool, err error)
- func (lom *LOM) IncVersion() error
- func (lom *LOM) InitBck(bck *cmn.Bck) (err error)
- func (lom *LOM) InitCT(ct *CT)
- func (lom *LOM) InitFQN(fqn string, expbck *cmn.Bck) (err error)
- func (lom *LOM) IsCopy() bool
- func (lom *LOM) IsHRW() bool
- func (lom *LOM) IsLocked() (int, bool)
- func (lom *LOM) LBGet() (fqn string)
- func (lom *LOM) LIF() (lif LIF)
- func (lom *LOM) LeastUtilNoCopy() (mi *fs.Mountpath)
- func (lom *LOM) Load(cacheit, locked bool) (err error)
- func (lom *LOM) LoadMetaFromFS() error
- func (lom *LOM) Location() string
- func (lom *LOM) Lock(exclusive bool)
- func (lom *LOM) MirrorConf() *cmn.MirrorConf
- func (lom *LOM) Mountpath() *fs.Mountpath
- func (lom *LOM) NewDeferROC() (cos.ReadOpenCloser, error)
- func (lom *LOM) NumCopies() int
- func (lom *LOM) ObjAttrs() *cmn.ObjAttrs
- func (lom *LOM) ObjectName() string
- func (lom *LOM) Persist() (err error)
- func (lom *LOM) PersistMain() (err error)
- func (lom *LOM) Recache()
- func (lom *LOM) Remove(force ...bool) (err error)
- func (lom *LOM) RenameFrom(workfqn string) error
- func (lom *LOM) RestoreToLocation() (exists bool)
- func (lom *LOM) SetAtimeUnix(tu int64)
- func (lom *LOM) SetCksum(cksum *cos.Cksum)
- func (lom *LOM) SetCustomKey(key, value string)
- func (lom *LOM) SetCustomMD(md cos.StrKVs)
- func (lom *LOM) SetSize(size int64)
- func (lom *LOM) SetVersion(ver string)
- func (lom *LOM) SizeBytes(special ...bool) int64
- func (lom *LOM) String() string
- func (lom *LOM) StringEx() string
- func (lom *LOM) ToMpath() (mi *fs.Mountpath, isHrw bool)
- func (lom *LOM) TryLock(exclusive bool) bool
- func (lom *LOM) Uname() string
- func (lom *LOM) Uncache(delDirty bool)
- func (lom *LOM) Unlock(exclusive bool)
- func (lom *LOM) UpgradeLock() (finished bool)
- func (lom *LOM) ValidateContentChecksum() (err error)
- func (lom *LOM) ValidateMetaChecksum() error
- func (lom *LOM) Version(special ...bool) string
- func (lom *LOM) VersionConf() cmn.VersionConf
- func (lom *LOM) WritePolicy() (p apc.WritePolicy)
- type NLP
- type Node
- type NodeMemCap
- type Notif
- type NotifMsg
- type OnFinishObj
- type PromoteArgs
- type PromoteParams
- type PutObjectParams
- type QuiCB
- type QuiRes
- type RemAis
- type Remotes
- type Snap
- type Stats
- type Target
- type TargetExt
- type TargetLoc
- type TargetPut
- type Upon
- type Xact
Constants ¶
const ( XattrLOM = "user.ais.lom" // on-disk xattr name DumpLomEnvVar = "AIS_DUMP_LOM" )
const ( Targets = iota // 0 (cluster.Targets) used as default value for NewStreamBundle Proxies AllNodes )
const ( UponTerm = Upon(1 << iota) // success or fail is separately provided via error UponProgress // periodic (BytesCount, ObjCount) )
enum: when to notify
const ( QuiInactiveCB = QuiRes(iota) // e.g., no pending requests (NOTE: used exclusively by `quicb` callbacks) QuiActive // active (e.g., receiving data) QuiActiveRet // active that immediately breaks waiting for quiecscence QuiDone // all done QuiAborted // aborted QuiTimeout // timeout Quiescent // idle => quiescent )
Variables ¶
This section is empty.
Functions ¶
func EvictLomCache ¶
func FreeCpObjParams ¶
func FreeCpObjParams(a *CopyObjectParams)
func FreePutObjParams ¶
func FreePutObjParams(a *PutObjectParams)
func HrwTargetAll ¶
Include targets in maintenance
func HrwTargetList ¶
Sorts all targets in a cluster by their respective HRW (weights) in a descending order; returns resulting subset (aka slice) that has the requested length = count. Returns error if the cluster does not have enough targets. If count == length of Smap.Tmap, the function returns as many targets as possible.
func HrwTargetTask ¶
Returns a target for a given task. E.g. usage: list objects in a cloud bucket (we want only one target to do it).
func ParseObjLoc ¶
func RegLomCacheWithHK ¶
func RegLomCacheWithHK(t Target)
Types ¶
type BackendProvider ¶
type BackendProvider interface { Provider() string MaxPageSize() uint CreateBucket(bck *meta.Bck) (errCode int, err error) ListObjects(bck *meta.Bck, msg *apc.LsoMsg, lst *cmn.LsoResult) (errCode int, err error) ListBuckets(qbck cmn.QueryBcks) (bcks cmn.Bcks, errCode int, err error) PutObj(r io.ReadCloser, lom *LOM) (errCode int, err error) DeleteObj(lom *LOM) (errCode int, err error) // with context HeadBucket(ctx context.Context, bck *meta.Bck) (bckProps cos.StrKVs, errCode int, err error) HeadObj(ctx context.Context, lom *LOM) (objAttrs *cmn.ObjAttrs, errCode int, err error) GetObj(ctx context.Context, lom *LOM, owt cmn.OWT) (errCode int, err error) GetObjReader(ctx context.Context, lom *LOM) (r io.ReadCloser, expectedCksum *cos.Cksum, errCode int, err error) }
type CT ¶
type CT struct {
// contains filtered or unexported fields
}
func NewCTFromBO ¶
func NewCTFromLOM ¶
Construct CT from LOM and change ContentType and FQN
func (*CT) ContentType ¶
func (*CT) LoadFromFS ¶
func (*CT) ObjectName ¶
type CopyObjectParams ¶
type CopyObjectParams struct { DM DataMover DP DP // Data Provider (optional; see Transform/Copy Bucket (TCB)) Xact Xact BckTo *meta.Bck ObjNameTo string Buf []byte }
data path: control structures and types
func AllocCpObjParams ¶
func AllocCpObjParams() (a *CopyObjectParams)
type DataMover ¶
type DataMover interface { RegRecv() error GetXact() Xact Open() Close(err error) UnregRecv() Send(obj *transport.Obj, roc cos.ReadOpenCloser, tsi *meta.Snode) error ACK(hdr transport.ObjHdr, cb transport.ObjSentCB, tsi *meta.Snode) error OWT() cmn.OWT }
data path: control structures and types
type LOM ¶
type LOM struct { ObjName string FQN string HrwFQN string // (=> main replica) // contains filtered or unexported fields }
func AllocLomFromHdr ¶
lom <= transport.ObjHdr (NOTE: caller must call freeLOM)
func (*LOM) AllowDisconnectedBackend ¶
permission to overwrite objects that were previously read from: a) any remote backend that is currently not configured as the bucket's backend b) HTPP ("ht://") since it's not writable
func (*LOM) Bprops ¶
func (lom *LOM) Bprops() *cmn.BucketProps
func (*LOM) ComputeCksum ¶
func (*LOM) Copy ¶
increment the object's num copies by (well) copying the former (compare with lom.Copy2FQN below)
func (*LOM) Copy2FQN ¶
copy object => any local destination recommended for copying between different buckets (compare with lom.Copy() above) NOTE: `lom` source must be w-locked
func (*LOM) CreateFile ¶
(compare with cos.CreateFile)
func (*LOM) DelAllCopies ¶
func (*LOM) DelExtraCopies ¶
DelExtraCopies deletes obj replicas that are not part of the lom.md.copies metadata (cleanup)
func (*LOM) DowngradeLock ¶
func (lom *LOM) DowngradeLock()
func (*LOM) GetCopies ¶
GetCopies returns all copies (NOTE that copies include self) NOTE: caller must take a lock
func (*LOM) IncVersion ¶
func (*LOM) IsCopy ¶
given an existing (on-disk) object, determines whether it is a _copy_ (compare with isMirror below)
func (*LOM) LeastUtilNoCopy ¶
returns the least utilized mountpath that does _not_ have a copy of this `lom` yet (compare with leastUtilCopy())
func (*LOM) Load ¶
- locked: is locked by the immediate caller (or otherwise is known to be locked); if false, try Rlock temporarily *if and only when* reading from FS
func (*LOM) LoadMetaFromFS ¶
NOTE: used in tests, ignores `dirty`
func (*LOM) MirrorConf ¶
func (lom *LOM) MirrorConf() *cmn.MirrorConf
func (*LOM) NewDeferROC ¶
func (lom *LOM) NewDeferROC() (cos.ReadOpenCloser, error)
is called under rlock; unlocks on fail
func (*LOM) PersistMain ¶
func (*LOM) RestoreToLocation ¶
RestoreObjectFromAny tries to restore the object at its default location. Returns true if object exists, false otherwise TODO: locking vs concurrent restore: consider (read-lock object + write-lock meta) split
func (*LOM) SetAtimeUnix ¶
func (*LOM) SetCustomKey ¶
func (*LOM) SetCustomMD ¶
func (*LOM) SetVersion ¶
func (*LOM) ToMpath ¶
must be called under w-lock returns mountpath destination to copy this object, or nil if no copying is required - checks hrw location first, and - checks copies (if any) against the current configuation and available mountpaths; - does not check `fstat` in either case (TODO: configurable or scrub);
func (*LOM) UpgradeLock ¶
func (*LOM) ValidateContentChecksum ¶
ValidateDiskChecksum validates if checksum stored in lom's in-memory metadata matches object's content checksum. Use lom.ValidateMetaChecksum() to check lom's checksum vs on-disk metadata.
func (*LOM) ValidateMetaChecksum ¶
ValidateMetaChecksum validates whether checksum stored in lom's in-memory metadata matches checksum stored on disk. Use lom.ValidateContentChecksum() to recompute and check object's content checksum.
func (*LOM) VersionConf ¶
func (lom *LOM) VersionConf() cmn.VersionConf
func (*LOM) WritePolicy ¶
func (lom *LOM) WritePolicy() (p apc.WritePolicy)
type NLP ¶
type NLP interface { Lock() TryLock(timeout time.Duration) bool TryRLock(timeout time.Duration) bool Unlock() }
pair
type Node ¶
type Node interface { SID() string String() string Snode() *meta.Snode Bowner() meta.Bowner Sowner() meta.Sowner ClusterStarted() bool NodeStarted() bool }
cluster node
type NodeMemCap ¶
type Notif ¶
type Notif interface { OnFinishedCB() func(Notif, error) OnProgressCB() func(Notif) NotifyInterval() time.Duration // notify interval in secs LastNotifTime() int64 // time last notified SetLastNotified(now int64) Upon(u Upon) bool Subscribers() []string ToNotifMsg() NotifMsg }
intra-cluster notification interface
type NotifMsg ¶
type OnFinishObj ¶
data path: control structures and types
type PromoteArgs ¶
type PromoteArgs struct { DaemonID string `json:"tid,omitempty"` // target ID SrcFQN string `json:"src,omitempty"` // source file or directory (must be absolute pathname) ObjName string `json:"obj,omitempty"` // destination object name Recursive bool `json:"rcr,omitempty"` // recursively promote nested dirs // once successfully promoted: OverwriteDst bool `json:"ovw,omitempty"` // overwrite destination DeleteSrc bool `json:"dls,omitempty"` // remove source when (and after) successfully promoting // and _not_ to try to auto-detect if it is; // (auto-detection takes time, etc.) SrcIsNotFshare bool `json:"notshr,omitempty"` // the source is not a file share equally accessible by all targets }
common part that's used in `api.PromoteArgs` and `PromoteParams`(server side), both
type PromoteParams ¶
type PromoteParams struct { Bck *meta.Bck // destination bucket Cksum *cos.Cksum // checksum to validate Xact Xact // responsible xaction PromoteArgs // all of the above }
data path: control structures and types
type PutObjectParams ¶
type PutObjectParams struct { Reader io.ReadCloser Cksum *cos.Cksum // checksum to check Atime time.Time Xact Xact WorkTag string // (=> work fqn) OWT cmn.OWT SkipEncode bool // don't run erasure-code when finalizing }
data path: control structures and types
func AllocPutObjParams ¶
func AllocPutObjParams() (a *PutObjectParams)
type Snap ¶
type Snap struct { // xaction-specific stats counters Ext any `json:"ext"` // common static props StartTime time.Time `json:"start-time"` EndTime time.Time `json:"end-time"` Bck cmn.Bck `json:"bck"` SrcBck cmn.Bck `json:"src-bck"` DstBck cmn.Bck `json:"dst-bck"` ID string `json:"id"` Kind string `json:"kind"` // rebalance-only RebID int64 `json:"glob.id,string"` // common runtime: stats counters (above) and state Stats Stats `json:"stats"` AbortedX bool `json:"aborted"` IdleX bool `json:"is_idle"` }
type Stats ¶
type Stats struct { Objs int64 `json:"loc-objs,string"` // locally processed Bytes int64 `json:"loc-bytes,string"` // OutObjs int64 `json:"out-objs,string"` // transmit OutBytes int64 `json:"out-bytes,string"` // InObjs int64 `json:"in-objs,string"` // receive InBytes int64 `json:"in-bytes,string"` }
type Target ¶
type Target interface { TargetLoc // (for intra-cluster data-net comm - no streams) DataClient() *http.Client CompareObjects(ctx context.Context, lom *LOM) (equal bool, errCode int, err error) // core object (+ PutObject above) FinalizeObj(lom *LOM, workFQN string, xctn Xact) (errCode int, err error) EvictObject(lom *LOM) (errCode int, err error) DeleteObject(lom *LOM, evict bool) (errCode int, err error) CopyObject(lom *LOM, params *CopyObjectParams, dryRun bool) (int64, error) GetCold(ctx context.Context, lom *LOM, owt cmn.OWT) (errCode int, err error) Promote(params PromoteParams) (errCode int, err error) HeadObjT2T(lom *LOM, si *meta.Snode) bool }
all of the above; for implementations, see `ais/tgtimpl.go` and `ais/htrun.go`
type TargetLoc ¶
type TargetLoc interface { TargetPut // backend Backend(*meta.Bck) BackendProvider // FS health and Health FSHC(err error, path string) Health(si *meta.Snode, timeout time.Duration, query url.Values) (body []byte, errCode int, err error) }
local target node
var (
T TargetLoc
)
type TargetPut ¶
type TargetPut interface { NodeMemCap // local PUT PutObject(lom *LOM, params *PutObjectParams) (err error) }
a node that can also write objects
type Xact ¶
type Xact interface { Run(*sync.WaitGroup) ID() string Kind() string Bck() *meta.Bck FromTo() (*meta.Bck, *meta.Bck) StartTime() time.Time EndTime() time.Time Finished() bool Running() bool IsAborted() bool AbortErr() error AbortedAfter(time.Duration) error ChanAbort() <-chan error Quiesce(time.Duration, QuiCB) QuiRes Result() (any, error) Snap() *Snap // (struct below) // reporting: log, err String() string Name() string // modifiers Finish(error) Abort(error) bool AddNotif(n Notif) // common stats Objs() int64 ObjsAdd(int, int64) // locally processed OutObjsAdd(int, int64) // transmit InObjsAdd(int, int64) // receive InBytes() int64 OutBytes() int64 }