artifactio

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: LGPL-2.1 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ETag

func ETag(artifactObj core.ArtifactObj) string

ETag returns a stable artifact ETag from metadata or the quoted blake3-24 body hash.

func KindLabel

func KindLabel(artifactObj core.ArtifactObj) string

KindLabel returns the schema/UI artifact kind label for a materializer and kind.

func LocateGlobalFormatKey added in v0.3.0

func LocateGlobalFormatKey(ctx context.Context, store StoreInterface, materializerID string, kind string, key string, version string, formatVersion uint32) (core.ArtifactObj, core.ArtifactKeyObj, bool, error)

LocateGlobalFormatKey finds a global-scope artifact only when its format version matches the current descriptor. It is used for host-independent universal archives so stale listener-specific or older-format rows cannot shadow current global metadata before background reconciliation has cleaned them up.

func LocateKey

func LocateKey(ctx context.Context, store StoreInterface, materializerID string, kind string, key string, version string, listenerID stcode.ListenerType) (core.ArtifactObj, core.ArtifactKeyObj, bool, error)

LocateKey finds a registered artifact from listener-specific to global scope without materialization, returning both metadata and the matched key. Metadata first lets callers answer 304 before expensive builds; the returned key lets a follow-up open reuse the resolved scope instead of re-querying it (OpenResolved).

func NameSuffix

func NameSuffix(artifactObj core.ArtifactObj) (name string, suffix string)

NameSuffix returns the artifact file name and key-relative suffix. The caller builds URLs with its link builder, so host context does not enter this package.

Types

type BodyObj

type BodyObj struct {
	// contains filtered or unexported fields
}

BodyObj streams an artifact body directly from *os.File without RAM buffering. Close delegates to HotFileObj.Close, closing the fd and releasing the shared-file refcount. ogen calls Close after io.Copy through io.Closer, so the refcount is released.

func (*BodyObj) Close

func (obj *BodyObj) Close() error

Close closes the descriptor and releases the shared hot-file refcount.

func (*BodyObj) Read

func (obj *BodyObj) Read(bufArr []byte) (int, error)

Read streams body bytes from disk.

func (*BodyObj) Seek

func (obj *BodyObj) Seek(offset int64, whence int) (int64, error)

Seek positions the body for http.ServeContent range handling by delegating to *os.File. The type stays opaque, so Close remains the only path that releases the refcount.

type OpenObj

type OpenObj struct {
	Body    *BodyObj
	ModTime time.Time
}

OpenObj is the result of open: streaming body plus its modification time. ETag is decided by the caller from the located metadata, not carried here.

func OpenResolved

func OpenResolved(ctx context.Context, store StoreInterface, keyObj core.ArtifactKeyObj, builderObj storage.ArtifactBuilderInterface, modTime time.Time) (OpenObj, error)

OpenResolved materializes the hot file for an artifact key already resolved by a locate helper, so a full GET does not re-query GetArtifact. Missing/failed materialization returns serr.ErrUnavailable; context cancellation is passed through. On success OpenObj.Body owns the file and the caller must close it.

type StoreInterface

type StoreInterface interface {
	GetArtifact(ctx context.Context, keyObj core.ArtifactKeyObj) (core.ArtifactObj, bool, error)
	EnsureArtifactFile(ctx context.Context, keyObj core.ArtifactKeyObj, builderObj storage.ArtifactBuilderInterface) (*storage.HotFileObj, error)
}

StoreInterface is the narrow storage surface for artifact lookup and materialization. The caller builds the EnsureArtifactFile builder.

Jump to

Keyboard shortcuts

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