Documentation
¶
Overview ¶
Package shard provides Extract(shard), Create(shard), and associated methods across all supported archival formats (see cmn/archive/mime.go)
- Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.
Package shard provides Extract(shard), Create(shard), and associated methods across all supported archival formats (see cmn/archive/mime.go)
- Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved.
Package shard provides Extract(shard), Create(shard), and associated methods across all supported archival formats (see cmn/archive/mime.go)
- Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.
Package shard provides Extract(shard), Create(shard), and associated methods across all supported archival formats (see cmn/archive/mime.go)
- Copyright (c) 2023-2025, NVIDIA CORPORATION. All rights reserved.
Package shard provides Extract(shard), Create(shard), and associated methods across all supported archival formats (see cmn/archive/mime.go)
- Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.
Package shard provides Extract(shard), Create(shard), and associated methods across all supported archival formats (see cmn/archive/mime.go)
- Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.
msgp -file <path to dsort/shard/record_gen.go> -tests=false -marshal=false -unexported Code generated by the command above; see docs/msgp.md. DO NOT EDIT.
Package shard provides Extract(shard), Create(shard), and associated methods across all supported archival formats (see cmn/archive/mime.go)
- Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.
Package shard provides Extract(shard), Create(shard), and associated methods across all supported archival formats (see cmn/archive/mime.go)
- Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.
msgp -file <path to dsort/shard/shard.go> -tests=false -marshal=false -unexported Code generated by the command above; see docs/msgp.md. DO NOT EDIT.
Package shard provides Extract(shard), Create(shard), and associated methods across all supported archival formats (see cmn/archive/mime.go)
- Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.
Package shard provides Extract(shard), Create(shard), and associated methods across all supported archival formats (see cmn/archive/mime.go)
- Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved.
Package shard provides Extract(shard), Create(shard), and associated methods across all supported archival formats (see cmn/archive/mime.go)
- Copyright (c) 2023-2025, NVIDIA CORPORATION. All rights reserved.
Package shard provides Extract(shard), Create(shard), and associated methods across all supported archival formats (see cmn/archive/mime.go)
- Copyright (c) 2024-2025, NVIDIA CORPORATION. All rights reserved.
Package shard provides Extract(shard), Create(shard), and associated methods across all supported archival formats (see cmn/archive/mime.go)
- Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.
Index ¶
- Constants
- Variables
- func IsCompressed(ext string) bool
- func ValidateContentKeyTy(ty string) error
- type ContentLoader
- type ErrSortingKeyType
- type ExternalKeyMap
- type KeyExtractor
- type RW
- type Record
- type RecordExtractor
- type RecordManager
- func (recm *RecordManager) Cleanup()
- func (recm *RecordManager) EnqueueRecords(records *Records)
- func (recm *RecordManager) ExtractionPaths() *sync.Map
- func (recm *RecordManager) FreeMem(fullContentPath, newStoreType string, value any, buf []byte) int64
- func (recm *RecordManager) FullContentPath(obj *RecordObj) string
- func (recm *RecordManager) MergeEnqueuedRecords()
- func (recm *RecordManager) RecordContents() *sync.Map
- func (recm *RecordManager) RecordWithBuffer(args *extractRecordArgs) (size int64, err error)
- type RecordObj
- type Records
- func (r *Records) All() []*Record
- func (z *Records) DecodeMsg(dc *msgp.Reader) (err error)
- func (r *Records) DeleteDup(name, ext string)
- func (r *Records) Drain()
- func (z *Records) EncodeMsg(en *msgp.Writer) (err error)
- func (r *Records) Exists(name, ext string) (exists bool)
- func (r *Records) Find(name string) (record *Record, exists bool)
- func (r *Records) Insert(records ...*Record)
- func (r *Records) Len() int
- func (r *Records) Less(i, j int, keyType string) (bool, error)
- func (*Records) MarshalJSON() ([]byte, error)
- func (z *Records) Msgsize() (s int)
- func (r *Records) RecordMemorySize() (size uint64)
- func (r *Records) Slice(start, end int) *Records
- func (r *Records) Swap(i, j int)
- func (r *Records) TotalObjectCount() int
- func (*Records) UnmarshalJSON([]byte) error
- type Shard
- type SingleKeyExtractor
Constants ¶
const ( ContentKeyInt = "int" ContentKeyFloat = "float" ContentKeyString = "string" )
const ( // Extract methods ExtractToMem bits = 1 << iota ExtractToDisk ExtractToWriter )
const ( // Values are small to save memory. OffsetStoreType = "o" SGLStoreType = "s" DiskStoreType = "d" )
Variables ¶
Functions ¶
func IsCompressed ¶
func ValidateContentKeyTy ¶ added in v1.3.22
Types ¶
type ContentLoader ¶
loads content from local or remote target
type ErrSortingKeyType ¶ added in v1.3.22
type ErrSortingKeyType struct {
// contains filtered or unexported fields
}
func (*ErrSortingKeyType) Error ¶ added in v1.3.22
func (e *ErrSortingKeyType) Error() string
type ExternalKeyMap ¶ added in v1.3.24
type ExternalKeyMap map[string]struct { // contains filtered or unexported fields }
represents a map where keys are regex patterns and values are associated strings.
func NewExternalKeyMap ¶ added in v1.3.24
func NewExternalKeyMap(n int) ExternalKeyMap
func (ExternalKeyMap) Add ¶ added in v1.3.24
func (ekm ExternalKeyMap) Add(key, value string) error
func (ExternalKeyMap) All ¶ added in v1.3.24
func (ekm ExternalKeyMap) All() (result []string)
type KeyExtractor ¶
type KeyExtractor interface {
PrepareExtractor(name string, r cos.ReadSizer, ext string) (cos.ReadSizer, *SingleKeyExtractor, bool)
// ExtractKey extracts key from either name or reader (file/sgl)
ExtractKey(ske *SingleKeyExtractor) (any, error)
}
func NewContentKeyExtractor ¶
func NewContentKeyExtractor(ty, ext string) (KeyExtractor, error)
func NewMD5KeyExtractor ¶
func NewMD5KeyExtractor() (KeyExtractor, error)
func NewNameKeyExtractor ¶
func NewNameKeyExtractor() (KeyExtractor, error)
type RW ¶
type RW interface {
Extract(lom *core.LOM, r cos.ReadReaderAt, extractor RecordExtractor, toDisk bool) (int64, int, error)
Create(s *Shard, w io.Writer, loader ContentLoader) (int64, error)
IsCompressed() bool
SupportsOffset() bool
MetadataSize() int64
}
func NewTargzRW ¶
func NewTarlz4RW ¶
func NewTarlz4RW() RW
type Record ¶
type Record struct {
Key any `msg:"k" json:"k"` // Used to determine the sorting order.
Name string `msg:"n" json:"n"` // Name that uniquely identifies record across all shards.
DaemonID string `msg:"d" json:"d"` // ID of the target which maintains the contents for this record.
// All objects associated with given record. Record can be composed of
// multiple objects which have the same name but different extension.
Objects []*RecordObj `msg:"o" json:"o"`
}
Record represents the metadata corresponding to a single file from a shard.
func (*Record) MakeUniqueName ¶
type RecordExtractor ¶
type RecordManager ¶
type RecordManager struct {
Records *Records
// contains filtered or unexported fields
}
func NewRecordManager ¶
func NewRecordManager(bck cmn.Bck, extractCreator RW, keyExtractor KeyExtractor, onDupRecs func(string) error) *RecordManager
func (*RecordManager) Cleanup ¶
func (recm *RecordManager) Cleanup()
func (*RecordManager) EnqueueRecords ¶
func (recm *RecordManager) EnqueueRecords(records *Records)
func (*RecordManager) ExtractionPaths ¶
func (recm *RecordManager) ExtractionPaths() *sync.Map
func (*RecordManager) FreeMem ¶
func (recm *RecordManager) FreeMem(fullContentPath, newStoreType string, value any, buf []byte) int64
func (*RecordManager) FullContentPath ¶
func (recm *RecordManager) FullContentPath(obj *RecordObj) string
func (*RecordManager) MergeEnqueuedRecords ¶
func (recm *RecordManager) MergeEnqueuedRecords()
func (*RecordManager) RecordContents ¶
func (recm *RecordManager) RecordContents() *sync.Map
func (*RecordManager) RecordWithBuffer ¶
func (recm *RecordManager) RecordWithBuffer(args *extractRecordArgs) (size int64, err error)
type RecordObj ¶
type RecordObj struct {
// Can represent, one of the following:
// * Shard name - in case offset is used.
// * Key for extractCreator's RecordContents - records stored in SGLs.
// * Location (full path) on disk where extracted record has been placed.
//
// To get path for given object you need to use `FullContentPath` method.
ContentPath string `msg:"p" json:"p"`
// Filesystem file type where the shard is stored - used to determine
// location for content path when asking filesystem.
ObjectFileType string `msg:"ft" json:"ft"`
// Determines where the record has been stored, can be either: OffsetStoreType,
// SGLStoreType, DiskStoreType.
StoreType string `msg:"st" json:"st"`
// If set, determines the offset in shard file where the record begins.
Offset int64 `msg:"f,omitempty" json:"f,string,omitempty"`
MetadataSize int64 `msg:"ms" json:"ms,string"`
Size int64 `msg:"s" json:"s,string"`
Extension string `msg:"e" json:"e"`
}
RecordObj describes single object of record. Objects inside a single record have different extensions.
type Records ¶
Records abstract array of records. It safe to be used concurrently.
func NewRecords ¶
NewRecords creates new instance of Records struct and allocates n places for the actual Record's
func (*Records) MarshalJSON ¶
func (*Records) Msgsize ¶
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*Records) RecordMemorySize ¶
func (*Records) TotalObjectCount ¶
func (*Records) UnmarshalJSON ¶
type Shard ¶
type Shard struct {
// Size is total size of shard to be created.
Size int64 `msg:"s"`
// Records contains all metadata to construct the shard.
Records *Records `msg:"r"`
// Name determines the output name of the shard.
Name string `msg:"n"`
}
Shard represents the metadata required to construct a single shard (aka an archive file).
func (*Shard) MarshalJSON ¶
func (*Shard) Msgsize ¶
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*Shard) UnmarshalJSON ¶
type SingleKeyExtractor ¶
type SingleKeyExtractor struct {
// contains filtered or unexported fields
}