stone1

package
v0.0.0-...-092eee8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttributeRecord

type AttributeRecord struct {
	Key   []byte
	Value []byte
}

func (AttributeRecord) Kind

func (r AttributeRecord) Kind() RecordKind

Kind returns the kind of this record.

type Compression

type Compression uint8

Compression is the compression method of the archive content.

const (
	// Uncompressed indicates an uncompressed content.
	Uncompressed Compression = iota + 1
	// ZSTD indicates a compressed content using zstd.
	ZSTD
)

type ContentRecord

type ContentRecord struct {
	Data *io.LimitedReader
}

func (ContentRecord) Kind

func (r ContentRecord) Kind() RecordKind

Kind returns the kind of this record.

type Dependency

type Dependency struct {
	Kind DependencyKind
	Name string
}

func (Dependency) String

func (d Dependency) String() string

type DependencyKind

type DependencyKind uint8
const (
	// PackageName is the name of the package.
	PackageName DependencyKind = iota // name
	// SharedLibary is a soname based dependency.
	SharedLibary // soname
	// PkgConfig is a pkgconfig `.pc` based dependency.
	PkgConfig // pkgconfig
	// Interpreter is a special interpreter (PT_INTERP/etc) to run the binaries.
	Interpreter // interpreter
	// CMake is a CMake module.
	CMake // cmake
	// Python is a Python module.
	Python // python
	// Binary is a binary in /usr/bin.
	BinaryDep // binary
	// SystemBinary is a binary in /usr/sbin.
	SystemBinary // sysbinary
	// PkgConfig32 is a emul32-compatible pkgconfig .pc dependency (contained in lib32/*.pc).
	PkgConfig32 // pkgconfig32
)

func (DependencyKind) String

func (i DependencyKind) String() string

type Entry

type Entry struct {
	FileType FileType
	// contains filtered or unexported fields
}

func (Entry) Source

func (e Entry) Source() []byte

func (Entry) Target

func (e Entry) Target() []byte

type FileType

type FileType uint8
const (
	// Regular is a regular file.
	Regular FileType = iota + 1
	// Symlink is a symbolic link (source, target pair).
	Symlink
	// Directory is a directory node.
	Directory
	// CharacterDevice is a character device.
	CharacterDevice // Character device
	// BlockDevice is a block device.
	BlockDevice // Block device
	// FIFO is a FIFO node.
	FIFO
	// Socket is a UNIX socket.
	Socket
)

func (FileType) String

func (i FileType) String() string
type Header struct {
	// StoredSize is the compressed size, in bytes, of the payload.
	// If the payload is not compressed, StoredSize is equal to PlainSize.
	StoredSize uint64
	// PlainSize is the uncompressed size, in bytes, of the payload.
	PlainSize uint64
	// Checksum is the payload's checksum.
	Checksum uint64
	// NumRecords is the number of records contained in the payload.
	NumRecords uint32
	// Version is the version of the payload data format.
	Version uint16
	// Kind is the kind of payload's records.
	Kind RecordKind
	// Compression is the compression used for the payload.
	Compression Compression
}

Header is the payload's header.

type IndexRecord

type IndexRecord struct {
	// Start is the index where the content starts.
	Start uint64
	// End is the index where the content ends.
	End uint64
	// Hash is the XXH3_128 hash of the content.
	Hash xxh3.Uint128
}

IndexRecord records offsets to unique files within the content when decompressed. This is used to split the file into the content store on disk before promoting to a transaction.

func (IndexRecord) Kind

func (r IndexRecord) Kind() RecordKind

Kind returns the kind of this record.

type LayoutRecord

type LayoutRecord struct {
	// UID is the UNIX UID.
	UID uint32
	// GID is the UNIX GID.
	GID uint32
	// Mode is file's mode.
	Mode fs.FileMode
	Tag  uint32
	// Entry is the kind of file, with source
	// and target paths where necessary.
	Entry Entry
}

LayoutRecord contains information about a file that should be written to the mass memory.

func (LayoutRecord) Kind

func (r LayoutRecord) Kind() RecordKind

Kind returns the kind of this record.

type MetaField

type MetaField struct {
	Kind  MetaFieldKind
	Value any
}

func (MetaField) String

func (m MetaField) String() string

type MetaFieldKind

type MetaFieldKind uint8
const (
	Int8MetaField MetaFieldKind = iota + 1
	Uint8MetaField
	Int16MetaField
	Uint16MetaField
	Int32MetaField
	Uint32MetaField
	Int64MetaField
	Uint64MetaField
	StringMetaField
	DependencyMetaField
	ProviderMetaField
)

type MetaRecord

type MetaRecord struct {
	Tag   MetaTag
	Field MetaField
}

func (MetaRecord) Kind

func (r MetaRecord) Kind() RecordKind

Kind returns the kind of this record.

type MetaTag

type MetaTag uint16
const (
	// Name of the package
	Name MetaTag = iota + 1
	// Architecture is the architecture of the package.
	Architecture
	// Version is the version of the package.
	Version
	// Summary is the succint description of the package.
	Summary
	// Description is the description of the package.
	Description
	// Homepage is the homepage URL of the package.
	Homepage
	// SourceID is the ID of the source package used for grouping.
	SourceID // Source ID
	// Depends is one dependency of the package.
	Depends
	// Provides is one capability, or the name, of the package.
	Provides
	// Conflicts is one capability, or name, conflicting with this package.
	Conflicts
	// Release is the release number of the package.
	Release
	// SPDX lists the SPDX license identifiers of the package.
	License
	// BuildRelease is the currently recorded build number of the package.
	BuildRelease // Build release
	// PackageURI is the URI of the package.
	PackageURI // Package URI
	// PackageHash is the hash sum of the package.
	PackageHash // Package hash
	// PackageSize is the size of the package.
	PackageSize // Package size
	// Depends is one build-time dependency of the package.
	BuildDepends // Build dependencies
	// SourceURI is the URI of the source of the package.
	SourceURI // Source URI
	// SourcePath is the relative path for the source within the upstream URI.
	SourcePath // Source path
	// SourceRef is the ref (or commit) of the upstream source.
	SourceRef // Source ref
)

func (MetaTag) String

func (i MetaTag) String() string

type Prelude

type Prelude struct {
	NumPayloads uint16
	StoneType   StoneType
}

func NewPrelude

func NewPrelude(genericPre libstone.Prelude) (Prelude, error)

type Reader

type Reader struct {
	Header Header // Header is the header of the current payload.
	Record Record
	Err    error
	// contains filtered or unexported fields
}

Reader iterates over the content of a V1 stone archive.

func NewReader

func NewReader(pre Prelude, src io.Reader, cache io.ReadWriteSeeker) *Reader

NewReader creates a new Reader which continues to read a stone archive from src. pre is the previously-written Prelude of the archive. Since stone payloads may be big in size, a cache is required to temporarily store data.

func (*Reader) NextPayload

func (r *Reader) NextPayload() bool

NextPayload advances to the next payload Header. It returns true if it advanced to the next payload Header, false otherwise. If false was returned and r.Err is nil, it reached the end of the stone archive.

func (*Reader) NextRecord

func (r *Reader) NextRecord() bool

NextRecord advances to the next payload record. It returns true if it advanced to the next record, false otherwise. If false was returned and r.Err is nil, it reached the end of the current payload.

type Record

type Record interface {
	// Kind returns the kind of this record.
	Kind() RecordKind
	// contains filtered or unexported methods
}

Record is a payload record. There are multiple kinds of record: a type conversion is required to inspect the content.

type RecordKind

type RecordKind uint8

RecordKind is the kind of the payload's records.

const (
	// Meta indicates a [MetaRecord].
	Meta RecordKind = iota + 1
	// Content indicates a file.
	Content
	// Layout indicates a [LayoutRecord].
	Layout
	// Index indicates an [IndexRecord].
	Index
	// Attributes indicates an attribute store.
	Attributes
)

func (RecordKind) String

func (i RecordKind) String() string

type StoneType

type StoneType uint8
const (
	BinaryStone StoneType = iota + 1
	DeltaStone
	RepositoryStone
	BuildManifestStone
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL