source

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	Kind() artifactstore.SourceKind

	NormalizeConfig(
		ctx context.Context,
		raw json.RawMessage,
	) (json.RawMessage, error)

	Open(
		ctx context.Context,
		value Source,
	) (Snapshot, error)
}

type Draft

type Draft struct {
	Kind        artifactstore.SourceKind
	DisplayName string
	Enabled     bool
	Config      json.RawMessage
}

type Entry

type Entry struct {
	Locator     artifactstore.Locator
	Name        string
	SizeBytes   int64
	Mode        uint32
	ModifiedAt  time.Time
	IsDirectory bool
	IsRegular   bool
	IsSymlink   bool
}

func (Entry) Validate

func (e Entry) Validate() error

type LocalPathResolver added in v0.2.11

type LocalPathResolver interface {
	ResolveLocalPath(
		ctx context.Context,
		value Source,
		locator artifactstore.Locator,
	) (string, error)
}

LocalPathResolver is an optional trusted-internal capability exposed by a source adapter when a source-relative locator has a native local filesystem representation.

It is deliberately not part of Snapshot and is never exposed through public source summaries or Workspace API views. Consumers use it only after their own runtime policy has approved a selected record.

type LocalPathRuntime added in v0.2.11

type LocalPathRuntime interface {
	ResolveLocalPath(
		ctx context.Context,
		value Source,
		locator artifactstore.Locator,
	) (string, error)
}

LocalPathRuntime is an optional extension implemented by the trusted source runtime when its opener supports LocalPathResolver.

It intentionally accepts a full Source rather than a public Summary because source configuration remains internal to Artifact Store consumers.

type Opener

type Opener interface {
	Open(
		ctx context.Context,
		value Source,
	) (Snapshot, error)
}

type Reader

type Reader interface {
	Get(ctx context.Context, id artifactstore.SourceID) (Source, error)
}

type Registry

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

func NewRegistry

func NewRegistry(adapters ...Adapter) (*Registry, error)

func (*Registry) Kinds

func (r *Registry) Kinds() []artifactstore.SourceKind

func (*Registry) Open

func (r *Registry) Open(
	ctx context.Context,
	value Source,
) (Snapshot, error)

func (*Registry) ResolveLocalPath added in v0.2.11

func (r *Registry) ResolveLocalPath(
	ctx context.Context,
	value Source,
	locator artifactstore.Locator,
) (string, error)

ResolveLocalPath resolves a source-relative locator to a native absolute filesystem path when, and only when, the selected source adapter explicitly supports that capability.

This is intentionally a trusted internal capability. Public source APIs continue to expose Summary values only and never reveal source paths.

type Repository

type Repository interface {
	Reader

	Create(
		ctx context.Context,
		value Source,
	) error

	List(ctx context.Context) ([]Source, error)
	Update(
		ctx context.Context,
		value Source,
		expectedRevision uint64,
	) error
	Delete(
		ctx context.Context,
		id artifactstore.SourceID,
		expectedRevision uint64,
	) error
}

type Runtime

type Runtime interface {
	Get(
		ctx context.Context,
		id artifactstore.SourceID,
	) (Source, error)

	Open(
		ctx context.Context,
		value Source,
	) (Snapshot, error)
}

Runtime is a trusted internal capability for consumers that need an operational source, including its normalized adapter configuration.

It is intentionally separate from Service, whose query methods return Summary values and do not expose opaque source configuration.

func NewRuntime

func NewRuntime(
	reader Reader,
	opener Opener,
) (Runtime, error)

type Service

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

func NewService

func NewService(
	repository Repository,
	registry *Registry,
	ids artifactstore.IDGenerator,
	clock artifactstore.Clock,
) (*Service, error)

func (*Service) Create

func (s *Service) Create(
	ctx context.Context,
	draft Draft,
) (Summary, error)

func (*Service) Delete

func (s *Service) Delete(
	ctx context.Context,
	id artifactstore.SourceID,
	expectedRevision uint64,
) error

func (*Service) Get

func (s *Service) Get(
	ctx context.Context,
	id artifactstore.SourceID,
) (Summary, error)

func (*Service) Kinds

func (s *Service) Kinds() []artifactstore.SourceKind

func (*Service) List

func (s *Service) List(ctx context.Context) ([]Summary, error)

func (*Service) Update

func (s *Service) Update(
	ctx context.Context,
	id artifactstore.SourceID,
	update Update,
) (Summary, error)

type Snapshot

type Snapshot interface {
	Generation() string

	Stat(
		ctx context.Context,
		locator artifactstore.Locator,
	) (Entry, error)

	ReadDir(
		ctx context.Context,
		locator artifactstore.Locator,
	) ([]Entry, error)

	Open(
		ctx context.Context,
		locator artifactstore.Locator,
	) (io.ReadCloser, error)

	Confirm(ctx context.Context) error
	Close() error
}

type Source

type Source struct {
	ID          artifactstore.SourceID   `json:"id"`
	Kind        artifactstore.SourceKind `json:"kind"`
	DisplayName string                   `json:"displayName"`
	Enabled     bool                     `json:"enabled"`
	Config      json.RawMessage          `json:"config"`
	Revision    uint64                   `json:"revision"`
	CreatedAt   time.Time                `json:"createdAt"`
	ModifiedAt  time.Time                `json:"modifiedAt"`
}

func (Source) Clone

func (s Source) Clone() Source

func (Source) Summary

func (s Source) Summary() Summary

func (Source) Validate

func (s Source) Validate() error

type Summary

type Summary struct {
	ID          artifactstore.SourceID   `json:"id"`
	Kind        artifactstore.SourceKind `json:"kind"`
	DisplayName string                   `json:"displayName"`
	Enabled     bool                     `json:"enabled"`
	Revision    uint64                   `json:"revision"`
	CreatedAt   time.Time                `json:"createdAt"`
	ModifiedAt  time.Time                `json:"modifiedAt"`
}

type Update

type Update struct {
	ExpectedRevision uint64
	DisplayName      string
	Enabled          bool
	Config           json.RawMessage
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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