Documentation
¶
Index ¶
- func ConfirmSnapshotGeneration(ctx context.Context, runtime Runtime, value Source, expectedGeneration string) error
- func ReadSnapshotEntry(ctx context.Context, snapshot Snapshot, entry Entry, maximumBytes int64) ([]byte, error)
- func ReadVerifiedSnapshotEntry(ctx context.Context, runtime Runtime, value Source, locator basespec.Locator, ...) (content []byte, digest cryptoutil.Digest, returnErr error)
- func ResolveVerifiedLocalPath(ctx context.Context, runtime Runtime, value Source, ...) (string, error)
- func VerifySnapshotContentDigest(ctx context.Context, runtime Runtime, value Source, locator basespec.Locator, ...) error
- type Adapter
- type Draft
- type Entry
- type LocalPathCapability
- type LocalPathResolver
- type LocalPathRuntime
- type ManagedPackageAddress
- type ManagedPackageFile
- type ManagedPackagePublication
- type ManagedPackageWriter
- type ManagedRootRemover
- 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) RemoveManagedRoot(ctx context.Context, rootStorageKey basespec.StorageKey) error
- func (r *Registry) RemovePackage(ctx context.Context, value Source, address ManagedPackageAddress, ...) 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) CreateWithStatus(ctx context.Context, rootID basespec.RootID, draft Draft) (Summary, bool, 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
- type VerificationSession
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfirmSnapshotGeneration ¶ added in v0.2.14
func ConfirmSnapshotGeneration( ctx context.Context, runtime Runtime, value Source, expectedGeneration string, ) error
ConfirmSnapshotGeneration confirms that a trusted Source still presents the generation captured by a catalog or caller. It centralizes snapshot lifetime, generation comparison, confirmation, and close handling for consumers.
Consumers must not reimplement this with direct filesystem inspection.
func ReadSnapshotEntry ¶ added in v0.2.14
func ReadSnapshotEntry( ctx context.Context, snapshot Snapshot, entry Entry, maximumBytes int64, ) ([]byte, error)
ReadSnapshotEntry reads one regular Source snapshot entry with the same bounded-read and size-stability rules used by discovery.
It intentionally operates only through Snapshot. Feature code must not recreate this behavior by reading a Source's native filesystem path.
func ReadVerifiedSnapshotEntry ¶ added in v0.2.17
func ReadVerifiedSnapshotEntry( ctx context.Context, runtime Runtime, value Source, locator basespec.Locator, expectedGeneration string, maximumBytes int64, ) ( content []byte, digest cryptoutil.Digest, returnErr error, )
ReadVerifiedSnapshotEntry reads one source entry from an exact Source generation and confirms the snapshot before returning the owned bytes and their digest.
It is the generic Artifact Store boundary for feature code that needs the canonical source document itself. Features must not reopen native paths or duplicate snapshot generation, bounded-read, confirmation, and close rules.
func ResolveVerifiedLocalPath ¶ added in v0.2.16
func VerifySnapshotContentDigest ¶ added in v0.2.14
func VerifySnapshotContentDigest( ctx context.Context, runtime Runtime, value Source, locator basespec.Locator, expectedGeneration string, expectedDigest cryptoutil.Digest, maximumBytes int64, ) error
VerifySnapshotContentDigest confirms both the Source generation and the exact bytes of one catalogued Source entry through the Source runtime.
This is intentionally generic Source behavior. It does not parse Skill content, resolve native paths, or apply runtime sandbox policy.
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 {
ID basespec.SourceID `json:"id"`
StorageKey basespec.StorageKey `json:"storageKey"`
Kind basespec.SourceKind `json:"kind"`
DisplayName string `json:"displayName"`
Enabled bool `json:"enabled"`
Config json.RawMessage `json:"config"`
}
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 ManagedPackageAddress ¶ added in v0.2.17
type ManagedPackageAddress struct {
Kind basespec.PackageKind `json:"kind"`
Name basespec.LogicalName `json:"name"`
Version basespec.LogicalVersion `json:"version"`
}
ManagedPackageAddress is the generic semantic address of one complete managed package.
Artifact Store owns only this three-segment address shape:
<kind>/<name>/<version>
Artifact families own the values of Kind, Name, Version, all primary file names, and all package-relative resource conventions.
func NewManagedPackageAddress ¶ added in v0.2.17
func NewManagedPackageAddress( kind basespec.PackageKind, name basespec.LogicalName, version basespec.LogicalVersion, ) (ManagedPackageAddress, error)
func ParseManagedPackageAddressDirectory ¶ added in v0.2.17
func ParseManagedPackageAddressDirectory( directory basespec.Locator, ) (ManagedPackageAddress, error)
ParseManagedPackageAddressDirectory decodes an address previously derived through Directory. It accepts no extra namespace or implementation segments.
func (ManagedPackageAddress) Directory ¶ added in v0.2.17
func (a ManagedPackageAddress) Directory() (basespec.Locator, error)
Directory returns the source-relative directory used by MapStore and normal filesystem users. It is derived from semantic package identity and never caller-supplied as an arbitrary directory.
func (ManagedPackageAddress) FileLocator ¶ added in v0.2.17
FileLocator returns a source-relative locator for one package-relative regular file.
func (ManagedPackageAddress) Validate ¶ added in v0.2.17
func (a ManagedPackageAddress) Validate() error
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 root. Empty directories are deliberately not represented.
func NormalizeManagedPackageFiles ¶ added in v0.2.17
func NormalizeManagedPackageFiles( input []ManagedPackageFile, ) ([]ManagedPackageFile, error)
NormalizeManagedPackageFiles validates and returns an independently owned, deterministic package file set. It is separate from package addressing so a caller can validate package contents before it has derived the final semantic package address.
type ManagedPackagePublication ¶ added in v0.2.13
type ManagedPackagePublication struct {
Address ManagedPackageAddress `json:"address"`
ExpectedGeneration string `json:"expectedGeneration,omitempty"`
Files []ManagedPackageFile `json:"files"`
}
ManagedPackagePublication atomically publishes one package at one semantic address. ExpectedGeneration is optional for creation and required by callers that intentionally replace existing package content.
func NormalizeManagedPackagePublication ¶ added in v0.2.13
func NormalizeManagedPackagePublication( input ManagedPackagePublication, ) (ManagedPackagePublication, error)
NormalizeManagedPackagePublication validates both the semantic address and package files and returns fully owned deterministic data.
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,
address ManagedPackageAddress,
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 ManagedRootRemover ¶ added in v0.2.15
type ManagedRootRemover interface {
RemoveManagedRoot(
ctx context.Context,
rootStorageKey basespec.StorageKey,
) error
}
ManagedRootRemover is a trusted adapter capability used only when an application-owned topology is being replaced as a whole. It removes all managed Source storage below one Root, including packages that are no longer declared by a newer binary.
It must never be exposed through public Source APIs.
type ManagedSourceBootstrapper ¶ added in v0.2.13
type ManagedSourceBootstrapper interface {
BootstrapManagedSource(
ctx context.Context,
value Source,
) 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.
DiscardBootstrappedManagedSource is used for failed source provisioning and for discarding a bundle-owned Source after all published packages were removed. It must refuse to remove published package content, but may remove adapter-private staging state.
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) RemoveManagedRoot ¶ added in v0.2.15
func (r *Registry) RemoveManagedRoot( ctx context.Context, rootStorageKey basespec.StorageKey, ) error
RemoveManagedRoot removes adapter-owned managed storage for a complete Root. It is a trusted topology-maintenance capability and is intentionally not exposed by source.Service.
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 NewService( repository Repository, registry *Registry, roots rootReader, timeClock clockutil.Clock, policy protection.RootPolicy, ) (*Service, error)
func (*Service) CreateWithStatus ¶ added in v0.2.14
func (s *Service) CreateWithStatus( ctx context.Context, rootID basespec.RootID, draft Draft, ) (Summary, bool, error)
CreateWithStatus follows the normal caller-supplied-ID replay contract and additionally reports whether this invocation committed a new Source row.
The status is intentionally not persisted and is not part of the public Artifact Store API. Higher-level provisioning workflows use it only to avoid discarding a Source that existed before the current request.
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, ) (Summary, error)
MarkContentChanged advances Source metadata after a successful managed source-side mutation. The actual generation remains source-owned and is read from a confirmed snapshot when needed.
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"`
RootStorageKey basespec.StorageKey `json:"rootStorageKey"`
StorageKey basespec.StorageKey `json:"storageKey"`
Kind basespec.SourceKind `json:"kind"`
DisplayName string `json:"displayName"`
Enabled bool `json:"enabled"`
Config json.RawMessage `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"`
RootStorageKey basespec.StorageKey `json:"rootStorageKey"`
StorageKey basespec.StorageKey `json:"storageKey"`
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
}
type VerificationSession ¶ added in v0.2.16
type VerificationSession struct {
// contains filtered or unexported fields
}
VerificationSession reuses verified Source snapshots while one caller resolves multiple local paths from the same catalogued Source generation.
Snapshot operations are intentionally serialized because Snapshot adapters are not required to support concurrent use.