Documentation
¶
Index ¶
Constants ¶
const ( // Content-defined chunking parameters (Gearhash) TargetChunkSize = 65536 // 64 KiB MinChunkSize = 8192 // 8 KiB MaxChunkSize = 131072 // 128 KiB GearhashMask = 0xFFFF000000000000 // Merkle tree parameters MeanBranchingFactor = 4 MinChildren = 2 MaxChildren = 9 // Xorb parameters MaxChunksPerXorb = 8192 MaxXorbSize = 64 * 1024 * 1024 // 64 MiB maximum uncompressed chunk payload TargetChunksPerXorb = 1024 )
Algorithm Suite: XET-BLAKE3-GEARHASH-LZ4
Variables ¶
This section is empty.
Functions ¶
func ChunkData ¶
ChunkData reads data from the provided reader and invokes fn for each chunk. Note: the chunk data passed to fn is only valid for the duration of the callback, so fn should copy it if it needs to retain it. The offset parameter indicates the cumulative byte offset of the chunk within the stream, which can be used for tracking progress or associating chunks with file offsets.
Types ¶
type ChunkHash ¶
type ChunkHash hash
ChunkHash identifies an individual content-defined chunk.
func ComputeChunkHash ¶
ComputeChunkHash computes the hash of a chunk using DATA_KEY
func ParseChunkHash ¶
ParseChunkHash parses an XET hash string as a chunk hash.
type Chunker ¶
type Chunker struct {
// contains filtered or unexported fields
}
Chunker provides an iterator-like interface for chunking data from a reader using the Gearhash algorithm.
func NewChunker ¶
NewChunker creates a new Chunker for the given reader. The returned Chunker can be used to iteratively read chunks of data that are determined by the Gearhash algorithm, which provides content-defined chunking for better deduplication and compression efficiency.
func (*Chunker) Chunk ¶
Chunk returns the offset of the next chunk and advances the internal state to the following chunk. When the end of the stream is reached, it returns io.EOF. The offset can be used to track the position of each chunk within the original data stream, which is useful for associating chunks with file offsets or for progress tracking during processing.
type FileHash ¶
type FileHash hash
FileHash identifies a reconstructed file. It is intentionally a distinct type from ChunkHash so the two cannot be mixed accidentally.
func ComputeFileHash ¶
ComputeFileHash computes the file hash from chunk hashes and sizes. Non-empty files apply an additional keyed hash step to the Merkle root; an empty file is represented directly by ZERO_HASH.
func ParseFileHash ¶
ParseFileHash parses an XET hash string as a file hash.
type VerificationHash ¶
type VerificationHash hash
VerificationHash identifies a term verification hash for a file reconstruction term.
func ComputeVerificationHash ¶
func ComputeVerificationHash(chunkHashes []ChunkHash) VerificationHash
ComputeVerificationHash computes a term verification hash using VERIFICATION_KEY
func ParseVerificationHash ¶
func ParseVerificationHash(s string) (VerificationHash, error)
ParseVerificationHash parses an XET hash string as a verification hash.
func (VerificationHash) String ¶
func (h VerificationHash) String() string
type XorbHash ¶
type XorbHash hash
XorbHash identifies a content-addressed xorb containing one or more chunks.
func ComputeXorbHash ¶
ComputeXorbHash computes the xorb hash from chunk hashes and sizes
func ParseXorbHash ¶
ParseXorbHash parses an XET hash string as an xorb hash.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package auth defines the server-side authorization hook and a reference HMAC token issuer.
|
Package auth defines the server-side authorization hook and a reference HMAC token issuer. |
|
hf
Package hf is the xet client for Hugging Face hub repositories.
|
Package hf is the xet client for Hugging Face hub repositories. |
|
hf/hftest
Package hftest holds the recorded Hugging Face hub trace format: the redacted exchanges a tool made with a hub and the CAS it named, from which the regression tests model a private hub.
|
Package hftest holds the recorded Hugging Face hub trace format: the redacted exchanges a tool made with a hub and the CAS it named, from which the regression tests model a private hub. |
|
cmd
|
|
|
xetc
command
|
|
|
xetd
command
|
|
|
internal
|
|
|
pool
Package pool provides shared sync.Pool-backed buffers for hot paths.
|
Package pool provides shared sync.Pool-backed buffers for hot paths. |
|
xorbmap
Package xorbmap caches read-only memory mappings of whole xorb files, reference-counted so an evicted mapping lives until its last reader closes.
|
Package xorbmap caches read-only memory mappings of whole xorb files, reference-counted so an evicted mapping lives until its last reader closes. |
|
Package mirror implements the ingestion engine of a full-cache middle layer that sits between a hub upstream (huggingface.co, an HF mirror, modelscope.cn, ...) and downstream clients, bridging every combination of xet-capable and plain peers.
|
Package mirror implements the ingestion engine of a full-cache middle layer that sits between a hub upstream (huggingface.co, an HF mirror, modelscope.cn, ...) and downstream clients, bridging every combination of xet-capable and plain peers. |
|
spool
Package spool handles the protocol-agnostic spooling of downloaded bytes on the way into local storage: an append-only, tail-readable spool that buffers in memory and spills to a file named by content identity, and the verify-and-ingest step into storage.
|
Package spool handles the protocol-agnostic spooling of downloaded bytes on the way into local storage: an append-only, tail-readable spool that buffers in memory and spills to a file named by content identity, and the verify-and-ingest step into storage. |
|
hf
Package hf serves the Hugging Face hub front end of a mirror: hub-style resolve requests are answered from the local cache (ingesting on miss through the mirror engine), the token endpoints hand downstream clients their CAS credential, and tree listings are rewritten so xet clients stay on the mirror.
|
Package hf serves the Hugging Face hub front end of a mirror: hub-style resolve requests are answered from the local cache (ingesting on miss through the mirror engine), the token endpoints hand downstream clients their CAS credential, and tree listings are rewritten so xet clients stay on the mirror. |
|
internalapi
Package internalapi serves non-CAS management endpoints with Read or Write permission.
|
Package internalapi serves non-CAS management endpoints with Read or Write permission. |
|
local
Package local implements storage.Storage on a filesystem below the base directory given to NewStorage.
|
Package local implements storage.Storage on a filesystem below the base directory given to NewStorage. |
|
memory
Package memory implements storage.Storage over process memory, for tests and ephemeral servers.
|
Package memory implements storage.Storage over process memory, for tests and ephemeral servers. |
|
s3
Package s3 implements storage.Storage over an S3-compatible object store with the local backend's layout under an optional key prefix.
|
Package s3 implements storage.Storage over an S3-compatible object store with the local backend's layout under an optional key prefix. |
|
storagetest
Package storagetest runs the backend-independent storage tests against a Backend.
|
Package storagetest runs the backend-independent storage tests against a Backend. |
|
test
|
|
|
benchgate
module
|
|