github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/api/apc/multiobj.go (about)

     1  // Package apc: API control messages and constants
     2  /*
     3   * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved.
     4   */
     5  package apc
     6  
     7  type (
     8  	// List of object names _or_ a template specifying { optional Prefix, zero or more Ranges }
     9  	ListRange struct {
    10  		Template string   `json:"template"`
    11  		ObjNames []string `json:"objnames"`
    12  	}
    13  	PrefetchMsg struct {
    14  		ListRange
    15  		BlobThreshold   int64 `json:"blob-threshold"`
    16  		ContinueOnError bool  `json:"coer"`
    17  		LatestVer       bool  `json:"latest-ver"` // see also: QparamLatestVer, 'versioning.validate_warm_get'
    18  	}
    19  
    20  	// ArchiveMsg contains the parameters (all except the destination bucket)
    21  	// for archiving mutiple objects as one of the supported archive.FileExtensions types
    22  	// at the specified (bucket) destination.
    23  	// See also: api.PutApndArchArgs
    24  	// --------------------  terminology   ---------------------
    25  	// here and elsewhere "archive" is any (.tar, .tgz/.tar.gz, .zip, .tar.lz4) formatted object.
    26  	ArchiveMsg struct {
    27  		TxnUUID     string `json:"-"`        // internal use
    28  		FromBckName string `json:"-"`        // ditto
    29  		ArchName    string `json:"archname"` // one of the archive.FileExtensions
    30  		Mime        string `json:"mime"`     // user-specified mime type (NOTE: takes precedence if defined)
    31  		ListRange
    32  		InclSrcBname    bool `json:"isbn"` // include source bucket name into the names of archived objects
    33  		AppendIfExists  bool `json:"aate"` // adding a list or a range of objects to an existing archive
    34  		ContinueOnError bool `json:"coer"` // on err, keep running arc xaction in a any given multi-object transaction
    35  	}
    36  
    37  	//  Multi-object copy & transform (see also: TCBMsg)
    38  	TCObjsMsg struct {
    39  		ListRange
    40  		TxnUUID string // (plstcx client, internal use)
    41  		TCBMsg
    42  		ContinueOnError bool `json:"coer"`
    43  	}
    44  )
    45  
    46  ///////////////
    47  // ListRange //
    48  ///////////////
    49  
    50  // empty `ListRange{}` implies operating on an entire bucket ("all objects in the source bucket")
    51  
    52  func (lrm *ListRange) IsList() bool      { return len(lrm.ObjNames) > 0 }
    53  func (lrm *ListRange) HasTemplate() bool { return lrm.Template != "" }