github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/xact/xreg/nonbck.go (about) 1 // Package xreg provides registry and (renew, find) functions for AIS eXtended Actions (xactions). 2 /* 3 * Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved. 4 */ 5 package xreg 6 7 import ( 8 "github.com/NVIDIA/aistore/api/apc" 9 "github.com/NVIDIA/aistore/cmn/debug" 10 "github.com/NVIDIA/aistore/core" 11 "github.com/NVIDIA/aistore/core/meta" 12 "github.com/NVIDIA/aistore/xact" 13 ) 14 15 func RegNonBckXact(entry Renewable) { 16 debug.Assert(!xact.IsSameScope(entry.Kind(), xact.ScopeB)) 17 dreg.nonbckXacts[entry.Kind()] = entry // no locking: all reg-s are done at init time 18 } 19 20 func RenewRebalance(id int64) RenewRes { 21 e := dreg.nonbckXacts[apc.ActRebalance].New(Args{UUID: xact.RebID2S(id)}, nil) 22 return dreg.renew(e, nil) 23 } 24 25 func RenewResilver(id string) core.Xact { 26 e := dreg.nonbckXacts[apc.ActResilver].New(Args{UUID: id}, nil) 27 rns := dreg.renew(e, nil) 28 debug.Assert(!rns.IsRunning()) // NOTE: resilver is always preempted 29 return rns.Entry.Get() 30 } 31 32 func RenewElection() RenewRes { 33 e := dreg.nonbckXacts[apc.ActElection].New(Args{}, nil) 34 return dreg.renew(e, nil) 35 } 36 37 func RenewLRU(id string) RenewRes { 38 e := dreg.nonbckXacts[apc.ActLRU].New(Args{UUID: id}, nil) 39 return dreg.renew(e, nil) 40 } 41 42 func RenewStoreCleanup(id string) RenewRes { 43 e := dreg.nonbckXacts[apc.ActStoreCleanup].New(Args{UUID: id}, nil) 44 return dreg.renew(e, nil) 45 } 46 47 func RenewDownloader(xid string, bck *meta.Bck) RenewRes { 48 e := dreg.nonbckXacts[apc.ActDownload].New(Args{UUID: xid, Custom: bck}, nil) 49 return dreg.renew(e, nil) 50 } 51 52 func RenewETL(msg any, xid string) RenewRes { 53 e := dreg.nonbckXacts[apc.ActETLInline].New(Args{UUID: xid, Custom: msg}, nil) 54 return dreg.renew(e, nil) 55 } 56 57 func RenewBckSummary(bck *meta.Bck, msg *apc.BsummCtrlMsg) RenewRes { 58 e := dreg.nonbckXacts[apc.ActSummaryBck].New(Args{UUID: msg.UUID, Custom: msg}, bck) 59 return dreg.renew(e, bck) 60 }