Documentation
¶
Index ¶
- Constants
- func DecodeHead(s string) ([]byte, error)
- func EncodeHead(head []byte) string
- func HashReader(r io.Reader) (string, error)
- func HexHashBlobPolicy() *tiedb.BlobPolicy
- func IsDirHead(head []byte) bool
- func IsHexHash(s string) bool
- func MediaType(head []byte) string
- func NewHash() (hash.Hash, error)
- type DirEntry
- type Media
Constants ¶
const DirHeader = "tiedir-v2\n---\n"
DirHeader prefixes every tie directory blob. A directory's hash changes whenever its contents change, which gives git-like versioning for free.
const MagicNumber = 261
MagicNumber is how many leading bytes of a file are needed to sniff its media type.
Variables ¶
This section is empty.
Functions ¶
func DecodeHead ¶
func EncodeHead ¶
func HashReader ¶
HashReader returns the tie content address of everything read from r.
func HexHashBlobPolicy ¶
func HexHashBlobPolicy() *tiedb.BlobPolicy
HexHashBlobPolicy returns the tiedb blob policy that stores content-address hashes as raw 32-byte entries instead of chunking their 64-char hex form into the trie. A hash is the worst case for the chunk trie (no shared prefixes, 3 entries per hash); this collapses it to one. Encode matches only well-formed hex hashes; Decode re-hex-encodes the raw bytes back to the stored string.
func IsDirHead ¶
IsDirHead reports whether head bytes belong to a tie directory blob (any tiedir version), used to classify an entry as a directory.
func IsHexHash ¶
IsHexHash reports whether s is a well-formed content address: exactly 64 lowercase hex characters. Enforced on parse so an untrusted manifest cannot smuggle a traversal or SSRF payload through the hash column.
Types ¶
type DirEntry ¶
DirEntry is one line of a tiedir blob. The head column stores the file's first bytes (rather than a derived media type) so classification stays recomputable as detectors improve.
func ParseDirLine ¶
ParseDirLine parses one tiedir-v2 line. It returns false for malformed lines. The filename must be a single path component: entries store a child's own name, never a path, so a crafted manifest cannot escape the checkout root via "..", an absolute path, or a nested separator.
type Media ¶
type Media struct {
Hash string
MediaType string
Title string
Artist string
Album string
Year int
Track int
Duration float64 // audio playing time in seconds, 0 when unknown
}
Media carries per-file media metadata extracted client-side at import time (audio tags via the vendored tie/tag fork of dhowden/tag). It feeds import-destination templates and per-file metadata triples; absent fields stay zero.