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