metadata

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestReader

func TestReader(t *testing.T, factory ReaderFactory)

TestReader tests Reader returns correct file metadata.

Types

type Attr

type Attr struct {
	// Size, for regular files, is the logical size of the file.
	Size int64

	// ModTime is the modification time of the node.
	ModTime time.Time

	// LinkName, for symlinks, is the link target.
	LinkName string

	// Mode is the permission and mode bits.
	Mode os.FileMode

	// UID is the user ID of the owner.
	UID int

	// GID is the group ID of the owner.
	GID int

	// DevMajor is the major device number for device.
	DevMajor int

	// DevMinor is the major device number for device.
	DevMinor int

	// Xattrs are the extended attribute for the node.
	Xattrs map[string][]byte

	// NumLink is the number of names pointing to this node.
	NumLink int
}

Attr reprensents the attributes of a node.

type File

type File interface {
	GetUncompressedFileSize() compression.Offset
	GetUncompressedOffset() compression.Offset
}

type MeasureLatencyHook

type MeasureLatencyHook func(time.Time)

A func which takes start time and records the diff

type Option

type Option func(o *Options) error

Option is an option to configure the behaviour of reader.

func WithTelemetry

func WithTelemetry(telemetry *Telemetry) Option

WithTelemetry option specifies the telemetry hooks

type Options

type Options struct {
	Telemetry *Telemetry
}

type Reader

type Reader interface {
	RootID() uint32

	GetAttr(id uint32) (attr Attr, err error)
	GetChild(pid uint32, base string) (id uint32, attr Attr, err error)
	ForeachChild(id uint32, f func(name string, id uint32, mode os.FileMode) bool) error
	OpenFile(id uint32) (File, error)

	Clone(sr *io.SectionReader) (Reader, error)
	Close() error
}

Reader provides access to file metadata of a blob.

type ReaderFactory

type ReaderFactory func(sr *io.SectionReader, ztoc *ztoc.Ztoc, opts ...Option) (r TestableReader, err error)

type Store

type Store func(sr *io.SectionReader, ztoc *ztoc.Ztoc, opts ...Option) (Reader, error)

Store reads the provided blob and creates a metadata reader.

type Telemetry

type Telemetry struct {
	InitMetadataStoreLatency MeasureLatencyHook // measure time to initialize metadata store (in milliseconds)
}

A struct which defines telemetry hooks. By implementing these hooks you should be able to record the latency metrics of the respective steps of SOCI open operation.

type TestableReader

type TestableReader interface {
	Reader
	NumOfNodes() (i int, _ error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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