Documentation
¶
Index ¶
- type AdoptRequest
- type AdoptionMode
- type Artifact
- type ArtifactAddress
- type ArtifactRef
- type Draft
- type PinRequest
- type Policy
- type Reader
- type Reconciler
- type Reconciliation
- type Repository
- type Service
- func (s *Service) Adopt(ctx context.Context, request AdoptRequest) (Artifact, error)
- func (s *Service) Get(ctx context.Context, ref ArtifactRef) (Artifact, error)
- func (s *Service) ListByCollection(ctx context.Context, ref collection.CollectionRef) ([]Artifact, error)
- func (s *Service) ListSuppressions(ctx context.Context, ref collection.CollectionRef) ([]Suppression, error)
- func (s *Service) Move(ctx context.Context, ref ArtifactRef, c collection.CollectionRef) error
- func (s *Service) Pin(ctx context.Context, request PinRequest) (Artifact, error)
- func (s *Service) Purge(ctx context.Context, ref ArtifactRef, expectedRevision uint64) error
- func (s *Service) SetEnabled(ctx context.Context, ref ArtifactRef, expectedRevision uint64, enabled bool) (Artifact, error)
- func (s *Service) Suppress(ctx context.Context, request SuppressRequest) (Suppression, error)
- func (s *Service) Unadopt(ctx context.Context, ref ArtifactRef, expectedRevision uint64, suppress bool) error
- func (s *Service) Unsuppress(ctx context.Context, ref collection.CollectionRef, binding SourceBinding, ...) error
- func (s *Service) UpdateData(ctx context.Context, ref ArtifactRef, expectedRevision uint64, ...) (Artifact, error)
- type SourceBinding
- type SourceStateUpdate
- type State
- type SuppressRequest
- type Suppression
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdoptRequest ¶
type AdoptRequest struct {
Collection collection.CollectionRef
Occurrence catalog.OccurrenceKey
ExpectedCatalogRevision uint64
Name string
Enabled bool
Data json.RawMessage
}
type AdoptionMode ¶
type AdoptionMode string
const ( AdoptionObserved AdoptionMode = "observed" AdoptionPinned AdoptionMode = "pinned" )
type Artifact ¶
type Artifact struct {
ID basespec.ArtifactID `json:"id"`
RootID basespec.RootID `json:"rootID"`
CollectionID basespec.CollectionID `json:"collectionID"`
Binding SourceBinding `json:"binding"`
Kind basespec.ArtifactKind `json:"kind"`
Name string `json:"name"`
Enabled bool `json:"enabled"`
Adoption AdoptionMode `json:"adoption"`
ResolvedDefinition *cryptoutil.Digest `json:"resolvedDefinition,omitempty"`
Data json.RawMessage `json:"-"`
State State `json:"state"`
Diagnostics []diagnostic.Diagnostic `json:"diagnostics,omitempty"`
Revision uint64 `json:"revision"`
CreatedAt time.Time `json:"createdAt"`
ModifiedAt time.Time `json:"modifiedAt"`
}
func (Artifact) Address ¶
func (a Artifact) Address() ArtifactAddress
func (Artifact) Ref ¶
func (a Artifact) Ref() ArtifactRef
type ArtifactAddress ¶
type ArtifactAddress struct {
RootID basespec.RootID `json:"rootID"`
CollectionID basespec.CollectionID `json:"collectionID"`
ArtifactID basespec.ArtifactID `json:"artifactID"`
Kind basespec.ArtifactKind `json:"kind"`
}
func (ArtifactAddress) Validate ¶
func (a ArtifactAddress) Validate() error
type ArtifactRef ¶
type ArtifactRef struct {
RootID basespec.RootID `json:"rootID"`
ArtifactID basespec.ArtifactID `json:"artifactID"`
}
func (ArtifactRef) Validate ¶
func (r ArtifactRef) Validate() error
type PinRequest ¶
type PinRequest struct {
Collection collection.CollectionRef
ExpectedCollectionRevision uint64
Binding SourceBinding
Name string
Enabled bool
Data json.RawMessage
}
type Policy ¶
type Policy interface {
Derive(
ctx context.Context,
value collection.Collection,
occurrence catalog.Occurrence,
def definition.Definition,
) (Draft, bool, []diagnostic.Diagnostic)
}
type Reader ¶
type Reader interface {
Get(
ctx context.Context,
ref ArtifactRef,
) (Artifact, error)
ListByCollection(
ctx context.Context,
ref collection.CollectionRef,
) ([]Artifact, error)
ListSuppressions(
ctx context.Context,
ref collection.CollectionRef,
) ([]Suppression, error)
}
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
func NewReconciler ¶
func (*Reconciler) Reconcile ¶
func (r *Reconciler) Reconcile( ctx context.Context, collectionValue collection.Collection, occurrences []catalog.Occurrence, existing []Artifact, suppressions []Suppression, definitions definition.Reader, policy Policy, ) (Reconciliation, error)
type Reconciliation ¶
type Reconciliation struct {
Creates []Artifact
Updates []SourceStateUpdate
Diagnostics []diagnostic.Diagnostic
}
type Repository ¶
type Repository interface {
Reader
CreateAdopted(
ctx context.Context,
value Artifact,
expectedCollectionRevision uint64,
expectedCatalogRevision uint64,
) error
CreatePinned(
ctx context.Context,
value Artifact,
expectedCollectionRevision uint64,
expectedCatalogRevision uint64,
) error
Update(
ctx context.Context,
value Artifact,
expectedRevision uint64,
) error
Unadopt(
ctx context.Context,
ref ArtifactRef,
expectedRevision uint64,
suppression *Suppression,
) error
Suppress(
ctx context.Context,
value Suppression,
expectedCollectionRevision uint64,
) error
Unsuppress(
ctx context.Context,
ref collection.CollectionRef,
binding SourceBinding,
expectedRevision uint64,
) error
Purge(
ctx context.Context,
ref ArtifactRef,
expectedRevision uint64,
) error
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) ListByCollection ¶
func (s *Service) ListByCollection( ctx context.Context, ref collection.CollectionRef, ) ([]Artifact, error)
func (*Service) ListSuppressions ¶
func (s *Service) ListSuppressions( ctx context.Context, ref collection.CollectionRef, ) ([]Suppression, error)
func (*Service) Move ¶
func (s *Service) Move( ctx context.Context, ref ArtifactRef, c collection.CollectionRef, ) error
func (*Service) Purge ¶
Purge destructively removes one local Artifact Record.
Unlike Unadopt, Purge never creates a suppression. It does not remove externally owned Source content or immutable definitions.
func (*Service) SetEnabled ¶
func (*Service) Suppress ¶
func (s *Service) Suppress( ctx context.Context, request SuppressRequest, ) (Suppression, error)
func (*Service) Unsuppress ¶
func (s *Service) Unsuppress( ctx context.Context, ref collection.CollectionRef, binding SourceBinding, expectedRevision uint64, ) error
func (*Service) UpdateData ¶
func (s *Service) UpdateData( ctx context.Context, ref ArtifactRef, expectedRevision uint64, data json.RawMessage, ) (Artifact, error)
type SourceBinding ¶
type SourceBinding struct {
SourceID basespec.SourceID `json:"sourceID"`
Locator basespec.Locator `json:"locator"`
SubresourceLocator basespec.SubresourceLocator `json:"subresourceLocator,omitempty"`
ExpectedKind basespec.ArtifactKind `json:"expectedKind"`
}
func (SourceBinding) Validate ¶
func (b SourceBinding) Validate() error
type SourceStateUpdate ¶
type SourceStateUpdate struct {
ArtifactID basespec.ArtifactID
RootID basespec.RootID
CollectionID basespec.CollectionID
ResolvedDefinition *cryptoutil.Digest
State State
Diagnostics []diagnostic.Diagnostic
Revision uint64
ModifiedAt time.Time
ExpectedRevision uint64
}
func (SourceStateUpdate) Validate ¶
func (u SourceStateUpdate) Validate() error
type State ¶
type State string
func DeriveSourceState ¶
func DeriveSourceState( current Artifact, occurrence *catalog.Occurrence, ) ( *cryptoutil.Digest, State, []diagnostic.Diagnostic, error, )
DeriveSourceState derives only the source-owned fields of an existing Artifact from its current Collection occurrence.
It is shared by reconciliation and SQLite publication validation so a Publisher cannot apply a source-derived state transition that the Reconciler itself would never produce.
type SuppressRequest ¶
type SuppressRequest struct {
Collection collection.CollectionRef
ExpectedCollectionRevision uint64
Binding SourceBinding
}
type Suppression ¶
type Suppression struct {
RootID basespec.RootID `json:"rootID"`
CollectionID basespec.CollectionID `json:"collectionID"`
Binding SourceBinding `json:"binding"`
Revision uint64 `json:"revision"`
CreatedAt time.Time `json:"createdAt"`
ModifiedAt time.Time `json:"modifiedAt"`
}
func (Suppression) Validate ¶
func (s Suppression) Validate() error
Click to show internal directories.
Click to hide internal directories.