Documentation
¶
Overview ¶
Package source defines the public Source model, adapters, catalog, and standard evidence sources.
Index ¶
- Constants
- func Register[I any, S Value, V any](registry *Registry, adapter Adapter[I, S, V]) error
- func RegisterContent(registry *Registry) error
- type Adapter
- type AdapterNotFoundError
- type Catalog
- func (c *Catalog) Get(ctx context.Context, value Value) (Value, error)
- func (c *Catalog) List(ctx context.Context) ([]Value, error)
- func (c *Catalog) Read(ctx context.Context, value Value) (any, error)
- func (c *Catalog) Ref(value Value) (Ref, error)
- func (c *Catalog) Resolve(ctx context.Context, input any) (Value, error)
- type CatalogBackend
- type ConflictError
- type ContentAdapter
- type ContentCapture
- type ContentSource
- type Cursor
- type InvalidAdapterError
- type InvalidEntryError
- type InvalidReferenceError
- type InvalidResultError
- type JournalEntry
- type Materialization
- type NotFoundError
- type Ref
- type Registry
- type Service
- func (s *Service) Add(ctx context.Context, value Value) (Value, error)
- func (s *Service) Get(ctx context.Context, value Value) (Value, error)
- func (s *Service) List(ctx context.Context) ([]Value, error)
- func (s *Service) Read(ctx context.Context, value Value) (any, error)
- func (s *Service) Ref(value Value) (Ref, error)
- func (s *Service) Resolve(ctx context.Context, input any) (Value, error)
- type Store
- type Value
Constants ¶
const ( // MaxIDLength is the maximum Source identifier length in Unicode code points. MaxIDLength = 256 // MaxTypeLength is the maximum registered Source type length in Unicode code points. MaxTypeLength = 128 // MaxBindingNameLength is the maximum persistent Source cursor binding name. MaxBindingNameLength = 128 )
const ContentType = "content"
Variables ¶
This section is empty.
Functions ¶
func RegisterContent ¶
Types ¶
type Adapter ¶
type Adapter[I any, S Value, V any] interface { Name() string Resolve(context.Context, I) (S, error) Read(context.Context, S) (V, error) }
Adapter resolves one exact input type and reads one exact Source type.
type AdapterNotFoundError ¶
AdapterNotFoundError reports that no adapter owns an exact Go type.
func (*AdapterNotFoundError) Error ¶
func (e *AdapterNotFoundError) Error() string
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
Catalog is an immutable adapter registry over persisted Source reads.
func NewCatalog ¶
func NewCatalog(backend CatalogBackend, registry Registry) (*Catalog, error)
NewCatalog freezes a Registry into a Catalog.
type CatalogBackend ¶
type CatalogBackend interface {
Get(context.Context, Value) (Value, error)
List(context.Context) ([]Value, error)
}
CatalogBackend provides persisted Source reads.
type ConflictError ¶
ConflictError reports ambiguous immutable catalog routing.
func (*ConflictError) Error ¶
func (e *ConflictError) Error() string
type ContentAdapter ¶
type ContentAdapter struct{}
func (ContentAdapter) Name ¶
func (ContentAdapter) Name() string
func (ContentAdapter) Read ¶
func (ContentAdapter) Read(_ context.Context, value ContentSource) (ContentCapture, error)
func (ContentAdapter) Resolve ¶
func (ContentAdapter) Resolve(_ context.Context, value ContentCapture) (ContentSource, error)
type ContentCapture ¶
type ContentCapture struct {
// contains filtered or unexported fields
}
ContentCapture is text supplied by an integration with a caller-stable identity. Metadata is copied recursively at construction and access.
func NewContentCapture ¶
func NewContentCapture(sourceID, content string, metadata map[string]any) (ContentCapture, error)
func (ContentCapture) Content ¶
func (c ContentCapture) Content() string
func (ContentCapture) ID ¶
func (c ContentCapture) ID() string
func (ContentCapture) Metadata ¶
func (c ContentCapture) Metadata() map[string]any
type ContentSource ¶
type ContentSource struct {
// contains filtered or unexported fields
}
ContentSource is captured neutral text usable as Artifact evidence.
func RestoreContentSource ¶
func RestoreContentSource( name string, materialization Materialization, description *string, content string, metadata map[string]any, ) (ContentSource, error)
RestoreContentSource reconstructs a persisted Content Source. Unlike ContentCapture, persisted content is allowed to be empty because that is a valid ContentSource payload in the Python v0.0.1 storage schema.
func (ContentSource) Content ¶
func (s ContentSource) Content() string
func (ContentSource) Metadata ¶
func (s ContentSource) Metadata() map[string]any
func (ContentSource) SourceDescription ¶
func (s ContentSource) SourceDescription() (string, bool)
func (ContentSource) SourceMaterialization ¶
func (s ContentSource) SourceMaterialization() Materialization
func (ContentSource) SourceName ¶
func (s ContentSource) SourceName() string
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
Cursor is the last Source journal sequence consumed by one binding. It is a value type because trigger transitions are pure.
type InvalidAdapterError ¶
InvalidAdapterError reports an invalid adapter declaration.
func (*InvalidAdapterError) Error ¶
func (e *InvalidAdapterError) Error() string
type InvalidEntryError ¶
InvalidEntryError reports a value that does not satisfy the Source contract.
func (*InvalidEntryError) Error ¶
func (e *InvalidEntryError) Error() string
type InvalidReferenceError ¶
InvalidReferenceError reports an invalid Source identity.
func (*InvalidReferenceError) Error ¶
func (e *InvalidReferenceError) Error() string
type InvalidResultError ¶
type InvalidResultError struct {
AdapterName string
Operation string
Expected reflect.Type
Actual reflect.Type
}
InvalidResultError reports an adapter that returned a value outside its declared exact Source type.
func (*InvalidResultError) Error ¶
func (e *InvalidResultError) Error() string
type JournalEntry ¶
type JournalEntry struct {
// contains filtered or unexported fields
}
JournalEntry is one resolved Source in stable per-scope insertion order. The Source value is immutable by contract; concrete built-ins copy mutable fields at their access boundaries.
func NewJournalEntry ¶
func NewJournalEntry(ref Ref, value Value, position int64) (JournalEntry, error)
func (JournalEntry) Position ¶
func (e JournalEntry) Position() int64
func (JournalEntry) Ref ¶
func (e JournalEntry) Ref() Ref
func (JournalEntry) Value ¶
func (e JournalEntry) Value() Value
type Materialization ¶
type Materialization string
Materialization describes where a value read for a Source comes from.
const ( Captured Materialization = "captured" Referenced Materialization = "referenced" )
type NotFoundError ¶
type NotFoundError struct {
Source Value
}
NotFoundError reports that an exact Source value is absent from a catalog.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
type Ref ¶
type Ref struct {
// contains filtered or unexported fields
}
Ref is a stable reference to one Source in a catalog view.
func (Ref) MarshalText ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is a mutable builder for immutable Catalog routing.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service composes Source acquisition, persistence, and read operations.
type Value ¶
type Value interface {
SourceName() string
SourceMaterialization() Materialization
SourceDescription() (string, bool)
}
Value is an immutable adapter-owned Source description. Implementations should use value receivers or otherwise prevent callers from changing the identity returned by SourceName.