Documentation
¶
Overview ¶
Package jobcontent owns content publication and durable job references.
Index ¶
- Variables
- func ValidateClaims(spec jobcontract.JobSpec, claims []Claim) error
- type AdmissionResources
- type AssetResolver
- type AssetStream
- type Claim
- type Dependencies
- type Entry
- type EntryState
- type Generation
- type Inventory
- type JobResources
- type Ledger
- type Limits
- type Manager
- func (manager *Manager) Close() error
- func (manager *Manager) Prepare(ctx context.Context, spec jobcontract.JobSpec) (result PreparedResources, prepareErr error)
- func (manager *Manager) Status() Status
- func (manager *Manager) Upload(ctx context.Context, identity jobcontract.ContentIdentity, body io.ReadCloser) (UploadResult, error)
- func (manager *Manager) ValidatePermit(permit *Permit, expectedSpecSHA256 string) ([]Claim, error)
- type ObjectIdentity
- type Permit
- type PhysicalStore
- type PinnedContent
- type PreparedResources
- type Publication
- type Status
- type Store
- type StoreKind
- type UploadResult
Constants ¶
This section is empty.
Variables ¶
var ( ErrClosed = errors.New("content_closed") ErrLimit = errors.New("content_limit") )
Functions ¶
func ValidateClaims ¶
func ValidateClaims(spec jobcontract.JobSpec, claims []Claim) error
ValidateClaims checks metadata correspondence only. Admission still requires manager-owned physical pins; callers cannot turn this validation into a pin.
Types ¶
type AdmissionResources ¶
type AdmissionResources interface {
Prepare(context.Context, jobcontract.JobSpec) (PreparedResources, error)
}
AdmissionResources is called outside the Host mutex and database transaction.
type AssetResolver ¶
type AssetResolver interface {
Open(context.Context, string) (AssetStream, error)
}
type AssetStream ¶
type AssetStream interface {
io.ReadCloser
Identity() jobcontract.ContentIdentity
MediaType() string
}
type Claim ¶
type Claim struct {
Ref string
Object ObjectIdentity
MediaType string
}
type Dependencies ¶
type Dependencies struct {
Physical PhysicalStore
Ledger Ledger
Limits Limits
}
type EntryState ¶
type EntryState string
const ( EntryCapturing EntryState = "capturing" EntryLive EntryState = "live" EntryReleased EntryState = "released" EntryCaptureFailed EntryState = "capture_failed" )
type Generation ¶
type Generation struct {
Object ObjectIdentity
Number uint64
CreatedAt time.Time
}
func (Generation) Validate ¶
func (generation Generation) Validate() error
type JobResources ¶
type JobResources interface {
Resolver() AssetResolver
Close() error
}
type Ledger ¶
type Ledger interface {
RegisterContentStore(context.Context, Store) error
// The bool identifies a new publication generation, not a new physical file.
PublishContent(context.Context, Publication) (Generation, bool, error)
ContentPublication(context.Context, string, string) (Generation, error)
JobContent(context.Context, string) (Inventory, error)
}
Ledger contains metadata operations. Implementations never open or hash files.
type Limits ¶
func DefaultLimits ¶
func DefaultLimits() Limits
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) Prepare ¶
func (manager *Manager) Prepare( ctx context.Context, spec jobcontract.JobSpec, ) (result PreparedResources, prepareErr error)
func (*Manager) Upload ¶
func (manager *Manager) Upload( ctx context.Context, identity jobcontract.ContentIdentity, body io.ReadCloser, ) (UploadResult, error)
Upload owns body, including failures before reading. Close must unblock Read; this is the cancellation contract required of the HTTP request body adapter.
func (*Manager) ValidatePermit ¶
ValidatePermit is deliberately lightweight. Prepare performed the physical verification; this validates its still-live private ownership without IO. File reads and new borrows additionally verify the current physical identity.
type ObjectIdentity ¶
type ObjectIdentity struct {
StoreID string
Content jobcontract.ContentIdentity
IncarnationID string
WitnessSHA256 string
ChangeToken string
}
ObjectIdentity binds verified bytes to one private physical file incarnation. It is internal metadata, not proof that an untrusted caller owns a live pin.
func (ObjectIdentity) Validate ¶
func (object ObjectIdentity) Validate() error
type Permit ¶
type Permit struct {
// contains filtered or unexported fields
}
Permit has no public constructor or writable evidence. It identifies a live resource owned by one Manager; copying Claims cannot create a permit.
type PhysicalStore ¶
type PhysicalStore interface {
Store() Store
Ready(context.Context) error
PutContent(context.Context, jobcontract.ContentIdentity, io.Reader) (bool, error)
OpenPinned(context.Context, jobcontract.ContentIdentity) (PinnedContent, error)
}
PhysicalStore owns one private root. The runtime closes it after Manager.Close.
type PinnedContent ¶
type PinnedContent interface {
io.ReadSeekCloser
Object() ObjectIdentity
Check() error
}
PinnedContent retains a fully hashed file descriptor. Each open has its own offset; Object is immutable evidence, and Check verifies the live private file.
type PreparedResources ¶
type PreparedResources interface {
Claims() []Claim
Permit() *Permit
BindJob(string) (JobResources, error)
Close() error
}
PreparedResources owns physical pins until BindJob succeeds or Close returns. Its metadata does not authorize admission without the owning manager permit.
type Publication ¶
type Publication struct {
Object ObjectIdentity
At time.Time
}
func (Publication) Validate ¶
func (publication Publication) Validate() error
type UploadResult ¶
type UploadResult struct {
PhysicalCreated bool
Generation Generation
}