source

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MPL-2.0 Imports: 8 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 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)

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