Documentation
¶
Index ¶
- func ValidateManagedPackageDirectory(directory basespec.Locator) error
- type Adapter
- type Draft
- type Entry
- type LocalPathCapability
- type LocalPathResolver
- type LocalPathRuntime
- type ManagedPackageFile
- type ManagedPackagePublication
- type ManagedPackageWriter
- type ManagedSourceBootstrapper
- type Opener
- type Reader
- type Registry
- func (r *Registry) Kinds() []basespec.SourceKind
- func (r *Registry) Open(ctx context.Context, value Source) (Snapshot, error)
- func (r *Registry) PublishPackage(ctx context.Context, value Source, publication ManagedPackagePublication) (string, error)
- func (r *Registry) RemovePackage(ctx context.Context, value Source, directory basespec.Locator, ...) error
- func (r *Registry) ResolveLocalPath(ctx context.Context, value Source, locator basespec.Locator) (string, error)
- func (r *Registry) SupportsLocalPath(kind basespec.SourceKind) bool
- func (r *Registry) SupportsManagedPackages(kind basespec.SourceKind) bool
- type Repository
- type Runtime
- type Service
- func (s *Service) Create(ctx context.Context, rootID basespec.RootID, draft Draft) (Summary, error)
- func (s *Service) Discard(ctx context.Context, rootID basespec.RootID, id basespec.SourceID, ...) error
- func (s *Service) Get(ctx context.Context, rootID basespec.RootID, id basespec.SourceID) (Summary, error)
- func (s *Service) Kinds() []basespec.SourceKind
- func (s *Service) List(ctx context.Context, rootID basespec.RootID) ([]Summary, error)
- func (s *Service) MarkContentChanged(ctx context.Context, rootID basespec.RootID, id basespec.SourceID, ...) (Summary, error)
- func (s *Service) Purge(ctx context.Context, rootID basespec.RootID, id basespec.SourceID, ...) error
- func (s *Service) Retire(ctx context.Context, rootID basespec.RootID, id basespec.SourceID, ...) (Summary, error)
- func (s *Service) Update(ctx context.Context, rootID basespec.RootID, id basespec.SourceID, ...) (Summary, error)
- type Snapshot
- type Source
- type Summary
- type Update
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateManagedPackageDirectory ¶ added in v0.2.13
ValidateManagedPackageDirectory validates one managed package directory relative to its managed Source root.
Types ¶
type Adapter ¶
type Adapter interface {
Kind() basespec.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 basespec.SourceKind
DisplayName string
Enabled bool
Config json.RawMessage
}
type Entry ¶
type LocalPathCapability ¶ added in v0.2.13
type LocalPathCapability interface {
SupportsLocalPath(
kind basespec.SourceKind,
) bool
}
LocalPathCapability advertises which Source kinds can provide trusted native paths. It avoids consumer hard-coding of concrete adapter kinds.
type LocalPathResolver ¶ added in v0.2.11
type LocalPathResolver interface {
ResolveLocalPath(
ctx context.Context,
value Source,
locator basespec.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 basespec.Locator,
) (string, error)
SupportsLocalPath(
kind basespec.SourceKind,
) bool
}
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 ManagedPackageFile ¶ added in v0.2.13
type ManagedPackageFile struct {
Locator basespec.Locator `json:"locator"`
Content []byte `json:"content"`
}
ManagedPackageFile is one regular file relative to a managed package directory. Empty directories are deliberately not part of the managed package contract.
type ManagedPackagePublication ¶ added in v0.2.13
type ManagedPackagePublication struct {
Directory basespec.Locator `json:"directory"`
ExpectedGeneration string `json:"expectedGeneration,omitempty"`
Files []ManagedPackageFile `json:"files"`
}
ManagedPackagePublication atomically publishes one new package directory inside a managed Source.
ExpectedGeneration is optional. When supplied, it prevents publication against a Source snapshot other than the one observed by the caller. Repeating an already completed, byte-identical publication is idempotent even when ExpectedGeneration names the generation before that publication.
func NormalizeManagedPackagePublication ¶ added in v0.2.13
func NormalizeManagedPackagePublication( input ManagedPackagePublication, ) (ManagedPackagePublication, error)
NormalizeManagedPackagePublication validates and returns an independently owned deterministic managed package publication.
Files are relative to Directory. Empty directories are deliberately not represented because package publication is defined by its regular files.
type ManagedPackageWriter ¶ added in v0.2.13
type ManagedPackageWriter interface {
PublishPackage(
ctx context.Context,
value Source,
publication ManagedPackagePublication,
) (generation string, err error)
RemovePackage(
ctx context.Context,
value Source,
directory basespec.Locator,
expectedGeneration string,
) error
}
ManagedPackageWriter is the optional writable capability for an application-managed Source adapter.
It deliberately publishes complete package directories rather than arbitrary individual file mutations. This gives managed authoring a staged, source-side atomic publication boundary without pretending that the Source filesystem and metadata database share one transaction.
type ManagedSourceBootstrapper ¶ added in v0.2.13
type ManagedSourceBootstrapper interface {
BootstrapManagedSource(
ctx context.Context,
value Source,
) (generation string, err error)
DiscardBootstrappedManagedSource(
ctx context.Context,
value Source,
) error
}
ManagedSourceBootstrapper is an optional capability implemented by writable Source adapters that need to establish physical Source storage before the Source metadata row is published.
BootstrapManagedSource returns the initial snapshot generation that must be persisted with the new Source. DiscardBootstrappedManagedSource compensates only a failed metadata creation and must refuse to remove non-empty content.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func (*Registry) Kinds ¶
func (r *Registry) Kinds() []basespec.SourceKind
func (*Registry) PublishPackage ¶ added in v0.2.13
func (*Registry) RemovePackage ¶ added in v0.2.13
func (*Registry) ResolveLocalPath ¶ added in v0.2.11
func (r *Registry) ResolveLocalPath( ctx context.Context, value Source, locator basespec.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.
func (*Registry) SupportsLocalPath ¶ added in v0.2.13
func (r *Registry) SupportsLocalPath( kind basespec.SourceKind, ) bool
func (*Registry) SupportsManagedPackages ¶ added in v0.2.13
func (r *Registry) SupportsManagedPackages( kind basespec.SourceKind, ) bool
type Repository ¶
type Repository interface {
Reader
Create(
ctx context.Context,
value Source,
) error
List(
ctx context.Context,
rootID basespec.RootID,
) ([]Source, error)
Update(
ctx context.Context,
value Source,
expectedRevision uint64,
) error
Retire(
ctx context.Context,
value Source,
expectedRevision uint64,
) error
Discard(
ctx context.Context,
rootID basespec.RootID,
id basespec.SourceID,
expectedRevision uint64,
) error
Purge(
ctx context.Context,
rootID basespec.RootID,
id basespec.SourceID,
expectedRevision uint64,
) error
}
type Runtime ¶
type Runtime interface {
Get(
ctx context.Context,
rootID basespec.RootID,
id basespec.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.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) Discard ¶ added in v0.2.13
func (s *Service) Discard( ctx context.Context, rootID basespec.RootID, id basespec.SourceID, expectedRevision uint64, ) error
Discard removes a newly created, unattached Source after a higher-level workflow failed before it could publish a Collection attachment. Unlike Purge, it is intentionally limited to active Sources with no attachments.
func (*Service) Kinds ¶
func (s *Service) Kinds() []basespec.SourceKind
func (*Service) MarkContentChanged ¶ added in v0.2.13
func (s *Service) MarkContentChanged( ctx context.Context, rootID basespec.RootID, id basespec.SourceID, expectedRevision uint64, generation string, ) (Summary, error)
MarkContentChanged acknowledges a snapshot generation after an application-managed Source publication or removal changes visible content.
It is intentionally a trusted internal operation. It does not expose Source configuration. Persisting the acknowledged generation makes a source-side mutation recoverable when the source write succeeded but the subsequent metadata update was interrupted.
type Snapshot ¶
type Snapshot interface {
Generation() string
Stat(
ctx context.Context,
locator basespec.Locator,
) (Entry, error)
ReadDir(
ctx context.Context,
locator basespec.Locator,
) ([]Entry, error)
Open(
ctx context.Context,
locator basespec.Locator,
) (io.ReadCloser, error)
Confirm(ctx context.Context) error
Close() error
}
type Source ¶
type Source struct {
ID basespec.SourceID `json:"id"`
RootID basespec.RootID `json:"rootID"`
Kind basespec.SourceKind `json:"kind"`
DisplayName string `json:"displayName"`
Enabled bool `json:"enabled"`
Config json.RawMessage `json:"-"`
// ContentGeneration is the last snapshot generation acknowledged after an
// application-managed content mutation. It is internal metadata only:
// summaries, public APIs, portable definitions, and source configuration
// deliberately do not expose it.
ContentGeneration string `json:"-"`
Revision uint64 `json:"revision"`
CreatedAt time.Time `json:"createdAt"`
ModifiedAt time.Time `json:"modifiedAt"`
RetiredAt *time.Time `json:"retiredAt,omitempty"`
}
type Summary ¶
type Summary struct {
ID basespec.SourceID `json:"id"`
RootID basespec.RootID `json:"rootID"`
Kind basespec.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"`
RetiredAt *time.Time `json:"retiredAt,omitempty"`
}
type Update ¶
type Update struct {
ExpectedRevision uint64
DisplayName string
Enabled bool
// Config is write-only replacement configuration. A nil value preserves
// the current normalized configuration so public callers can update Source
// metadata without reading or resending private Source configuration.
Config json.RawMessage
}