github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/xact/xreg/marker.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/fname"
    10  	"github.com/NVIDIA/aistore/fs"
    11  	"github.com/NVIDIA/aistore/xact"
    12  )
    13  
    14  func GetRebMarked() (out xact.Marked) {
    15  	dreg.entries.mtx.RLock()
    16  	entry := dreg.entries.findRunningKind(apc.ActRebalance)
    17  	dreg.entries.mtx.RUnlock()
    18  	if entry != nil {
    19  		out.Xact = entry.Get()
    20  	} else {
    21  		out.Interrupted = fs.MarkerExists(fname.RebalanceMarker)
    22  		out.Restarted = fs.MarkerExists(fname.NodeRestartedPrev)
    23  	}
    24  	return
    25  }
    26  
    27  func GetResilverMarked() (out xact.Marked) {
    28  	dreg.entries.mtx.RLock()
    29  	entry := dreg.entries.findRunningKind(apc.ActResilver)
    30  	dreg.entries.mtx.RUnlock()
    31  	if entry != nil {
    32  		out.Xact = entry.Get()
    33  	} else {
    34  		out.Interrupted = fs.MarkerExists(fname.ResilverMarker)
    35  	}
    36  	return
    37  }