Documentation
¶
Overview ¶
Package statedb is subflux's one store: the core namespace of a bolttable file holding source facts, ownership, coverage, locks, the write protocol's rows, history, work, jobs and credentials (the storage spec's design sections 3 to 10).
Index ¶
- Constants
- Variables
- type Activation
- type Coverage
- type CoverageRow
- type CredentialDisable
- type Delta
- type Download
- type EmbeddedTrack
- type FileRecord
- type HistoryScope
- type Identity
- type Instance
- type InstanceID
- type Intent
- type ItemRow
- type ListCursor
- type LocalFile
- type NoResult
- type Op
- type OrdinalKey
- type PassID
- type PassScope
- type PendingDeliver
- type Provenance
- type Removal
- type RootRow
- type RootTarget
- type RunID
- type Store
- func (s *Store) AckWork(ctx context.Context, ws []Work) error
- func (s *Store) Activate(ctx context.Context, a Activation) error
- func (s *Store) Baseline(ctx context.Context, inst InstanceID, name string) (timing.Cues, bool, error)
- func (s *Store) BeginDelete(ctx context.Context, inst InstanceID, name string, removed [32]byte) error
- func (s *Store) BeginDeliver(ctx context.Context, d PendingDeliver) error
- func (s *Store) BeginPass(ctx context.Context, src media.SourceID, scope PassScope) (PassID, error)
- func (s *Store) BeginRetime(ctx context.Context, rec FileRecord, adopt *timing.Cues) error
- func (s *Store) Changed() <-chan struct{}
- func (s *Store) Close() error
- func (s *Store) Coverage(ctx context.Context, k media.Key) ([]CoverageRow, error)
- func (s *Store) CredentialDisable(ctx context.Context, provider string) (CredentialDisable, bool, error)
- func (s *Store) DeferWork(ctx context.Context, w Work, notBefore time.Time) (first time.Time, deferred bool, err error)
- func (s *Store) DeleteCredentialDisable(ctx context.Context, provider string) error
- func (s *Store) DeleteJobsEndedBefore(ctx context.Context, t time.Time) (int, error)
- func (s *Store) Embedded(ctx context.Context, inst InstanceID) (VideoProbe, bool, error)
- func (s *Store) EndDelete(ctx context.Context, inst InstanceID, name string, landed bool) error
- func (s *Store) EndDeliver(ctx context.Context, inst InstanceID, name string, landed bool) error
- func (s *Store) EndRetime(ctx context.Context, inst InstanceID, name string, landed bool) error
- func (s *Store) EnqueueWork(ctx context.Context, ids []InstanceID, cause WorkCause) error
- func (s *Store) Files(ctx context.Context, id InstanceID) ([]FileRecord, error)
- func (s *Store) FinishPass(ctx context.Context, src media.SourceID, pass PassID, complete bool, ...) ([]media.SourceID, error)
- func (s *Store) GetJob(ctx context.Context, id status.JobID) (status.Job, bool, error)
- func (s *Store) History(ctx context.Context, scope HistoryScope, c ListCursor, limit int) ([]Download, ListCursor, error)
- func (s *Store) InsertJob(ctx context.Context, j status.Job, lim status.JobLimits) (status.Job, bool, error)
- func (s *Store) Instance(ctx context.Context, id InstanceID) (Instance, bool, error)
- func (s *Store) Item(ctx context.Context, k media.Key) (mediasource.Item, mediasource.Root, bool, error)
- func (s *Store) ItemRow(ctx context.Context, k media.Key) (ItemRow, bool, error)
- func (s *Store) Items(ctx context.Context, root media.RootKey, c ListCursor, limit int) ([]ItemRow, ListCursor, error)
- func (s *Store) JobByKey(ctx context.Context, owner int64, key string) (status.Job, bool, error)
- func (s *Store) NextWork(ctx context.Context, limit int) ([]Work, error)
- func (s *Store) NoResults(ctx context.Context, root media.RootKey, season uint16) ([]NoResult, error)
- func (s *Store) ObserveItems(ctx context.Context, src media.SourceID, pass PassID, root mediasource.Root, ...) error
- func (s *Store) PendingDeliverOf(ctx context.Context, inst InstanceID, name string) (PendingDeliver, bool, error)
- func (s *Store) PendingWrites(ctx context.Context) ([]Intent, error)
- func (s *Store) Policy() language.Policy
- func (s *Store) PutCredentialDisable(ctx context.Context, d CredentialDisable) error
- func (s *Store) PutEmbedded(ctx context.Context, inst InstanceID, p VideoProbe) error
- func (s *Store) PutExternal(ctx context.Context, inst InstanceID, files []LocalFile) error
- func (s *Store) PutJob(ctx context.Context, j status.Job) error
- func (s *Store) PutNoResults(ctx context.Context, rows []NoResult) error
- func (s *Store) RecordAttempts(ctx context.Context, ds []Download) error
- func (s *Store) ReserveOrdinal(ctx context.Context, k OrdinalKey, highestOnDisk int) (int, error)
- func (s *Store) Root(ctx context.Context, root media.RootKey) (RootRow, bool, error)
- func (s *Store) RootEvidence(ctx context.Context, src media.SourceID, root mediasource.NativeRef) (mediasource.RootEvidence, bool, error)
- func (s *Store) RootTargets(ctx context.Context, root media.RootKey) ([]RootTarget, error)
- func (s *Store) Roots(ctx context.Context, c ListCursor, limit int) ([]RootRow, ListCursor, error)
- func (s *Store) SetLock(ctx context.Context, inst InstanceID, tag language.Tag, v language.Variant, ...) error
- func (s *Store) Since(ctx context.Context, epoch [16]byte, after uint64) (Delta, error)
- func (s *Store) SourceCursor(ctx context.Context, src media.SourceID) (mediasource.Cursor, bool, error)
- func (s *Store) UnfinishedJobs(ctx context.Context) ([]status.Job, error)
- func (s *Store) Unidentified(ctx context.Context, c ListCursor, limit int) ([]UnidentifiedRow, ListCursor, error)
- func (s *Store) WorkReady() <-chan struct{}
- func (s *Store) WriteHealth() WriteHealth
- type UnidentifiedRow
- type VideoProbe
- type VideoStamp
- type Work
- type WorkCause
- type WriteHealth
Constants ¶
const ( // MarkHistory: a download attempt was recorded. MarkHistory = "history" // MarkAccounts: a user, invite, session, passkey or API key changed. MarkAccounts = "accounts" // MarkUnidentified: an unidentified sighting appeared, changed or went. MarkUnidentified = "unidentified" // MarkConfig: the activation changed; every reader re-reads in full. MarkConfig = "config" )
The marks a Delta carries. Every writer and BeforeCommit sets a mark only through these, so a rename is a compile error at every reader.
Variables ¶
var ( ErrSourceInactive = errors.New("statedb: source is not in the activation") ErrPassUnknown = errors.New("statedb: not the source's open pass") )
The refusals of a pass call.
var ErrCursorInvalid = errors.New("statedb: cursor names no position of this list")
ErrCursorInvalid refuses a cursor that does not decode to a position of the list and scope it is given to.
var ErrNotLockable = errors.New("statedb: nothing to lock")
ErrNotLockable is SetLock's refusal: an unknown or ownerless instance, a pair none of its items configures, or locking a pair none can serve.
Functions ¶
This section is empty.
Types ¶
type Activation ¶
type Activation struct {
Languages language.Policy
Sources []media.SourceID
IgnoredCodecs []string
}
Activation is the configuration every source fact is judged under: the sources in force, the language policy and the embedded codecs coverage ignores.
type Coverage ¶
type Coverage uint8
Coverage is how well an item's files serve one configured pair. Zero is invalid.
func (Coverage) MarshalText ¶
MarshalText is missing, substitute or exact, refusing any other value.
func (*Coverage) UnmarshalText ¶
UnmarshalText reads exactly what MarshalText writes, leaving c unchanged on a refusal.
type CoverageRow ¶
type CoverageRow struct {
Target language.Tag
Variant language.Variant
Coverage Coverage
Locked bool
}
CoverageRow is how one configured pair of an item is covered, and whether the user locked it.
type CredentialDisable ¶
CredentialDisable is a provider's disabled credential: the Argon2 fingerprint of the credential refused, why, and when.
type Delta ¶
type Delta struct {
Roots []media.RootKey
Written []media.RootKey
Marks []string
Epoch [16]byte
Rev uint64
Full bool
}
Delta is what changed after a revision. Roots are the library roots whose rows changed, Written those whose managed files changed (each also in Roots), Marks the marks set. Full means the feed cannot answer from the reader's revision, so the reader re-reads everything; it carries MarkConfig when an activation change is why.
type Download ¶
type Download struct {
At time.Time
Target language.Tag
Refusal string
Items []media.Key
Provenance Provenance
Attempt int
Inst InstanceID
Run RunID
Candidate [32]byte
Variant language.Variant
Delivered bool
}
Download is one attempt of a run at one target for an instance's items, delivered or not. Refusal is stored as given; Candidate tells one candidate from another with the same release name.
type EmbeddedTrack ¶
EmbeddedTrack is one subtitle stream inside a video file.
type FileRecord ¶
type FileRecord struct {
Timing timing.Timing
Provenance *Provenance
Name string
Tag language.Tag
Identity Identity
Ordinal int
Inst InstanceID
Generation uint64
Flags language.Flags
Locked bool
}
FileRecord is one file subflux manages beside an instance's video, at the Generation its last landed write gave it. Provenance is nil for a file adopted from the user.
type HistoryScope ¶
type HistoryScope struct {
// contains filtered or unexported fields
}
HistoryScope selects the downloads History reads; the zero value is the whole log.
func ItemHistory ¶
func ItemHistory(k media.Key) HistoryScope
ItemHistory is every download naming k.
func RootHistory ¶
func RootHistory(r media.RootKey) HistoryScope
RootHistory is every download naming an item of r.
type Instance ¶
type Instance struct {
Source media.SourceID
VideoPath string
SceneName string
Items []media.Key
ID InstanceID
}
Instance is one video file; an empty Source is ownerless.
type InstanceID ¶
type InstanceID uint64
InstanceID names one video file's instance. Zero is invalid.
func ParseInstanceID ¶
func ParseInstanceID(s string) (InstanceID, error)
ParseInstanceID is String's inverse for a non-zero id, refusing every other spelling: a sign, a space, a leading zero, a base prefix, a value past 2^64-1.
func (InstanceID) MarshalText ¶
func (id InstanceID) MarshalText() ([]byte, error)
MarshalText refuses the zero id, which ParseInstanceID would refuse.
func (InstanceID) String ¶
func (id InstanceID) String() string
String is the canonical base-10 text ParseInstanceID reads.
func (*InstanceID) UnmarshalText ¶
func (id *InstanceID) UnmarshalText(b []byte) error
UnmarshalText reads what ParseInstanceID reads, leaving id unchanged on a refusal.
type Intent ¶
type Intent struct {
Name string
Inst InstanceID
SHA256 [32]byte
Op Op
}
Intent is one pending write: the operation, the file it names and the content hash its outcome is judged by.
type ItemRow ¶
type ItemRow struct {
Coverage []CoverageRow
Item mediasource.Item
Key media.Key
Inst InstanceID
HasHistory bool
}
ItemRow is one listed item: its facts from the sighting its record names, its instance (0: no video) and its configured pairs.
type ListCursor ¶
type ListCursor string
ListCursor is a page's position in one list: "" asks for the first page, and a returned "" means the page was the last. It is not signed: a forged cursor reaches only a position paging reaches.
type NoResult ¶
NoResult is how many searches of Provider for Key at target Tag found nothing, and when the next may run.
type OrdinalKey ¶
type OrdinalKey struct {
Tag language.Tag
Inst InstanceID
Flags language.Flags
}
OrdinalKey names one sequence of numbered files of an instance: the files of one tag and flags.
type PassScope ¶
type PassScope struct{ Roots []mediasource.NativeRef }
PassScope is what a pass covers: Roots nil is the whole source; any other value, empty included, is a change batch over those roots.
type PendingDeliver ¶
type PendingDeliver struct {
Baseline timing.Cues
Attempts []Download
Removes []Removal
Record FileRecord
}
PendingDeliver is what a delivery stages: the record, its baseline cues, its attempts (the delivered one first) and the files it supersedes.
type Provenance ¶
type Provenance struct {
Provider, Release string
Timing timing.Outcome
Facts rank.Facts
MatchedBy rank.MatchedBy
Fit rank.Fit
Manual bool
Uploaded bool
MachineTranslated bool
}
Provenance is where a managed file came from and how its timing was decided. A user's upload is Manual and Uploaded with no Provider, and is matched and fitted by nothing.
type Removal ¶
Removal names a file a delivery supersedes, with the bytes it must still hold to be removed.
type RootRow ¶
type RootRow struct {
Source media.SourceID
Root mediasource.Root
Key media.RootKey
HasHistory bool
}
RootRow is one listed root: its display facts come from the source of its lowest item that is owned or has no instance.
type RootTarget ¶
type RootTarget struct {
Root mediasource.NativeRef
Source media.SourceID
VideoPaths []string
}
RootTarget is one source root owning instances under a root key, with those instances' video paths.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is subflux's state store over one bolttable file.
func Open ¶
Open opens or creates the store at path, holding path.lock until Close. A format change resets the changed namespaces after keeping the whole file as path.<8 hex>.<stamp>.old; another holder of the lock fails it with bolttable.ErrLocked after 5 s. Every error leaves the live file unreset.
func (*Store) Activate ¶
func (s *Store) Activate(ctx context.Context, a Activation) error
Activate installs a. When its sources, policy digest or ignored codecs differ from the stored ones, one write applies design 5.4's removal to every removed source and marks config, so every reader re-reads in full. The first Activate after Open, and one changing the policy or codecs, also recomputes every item's coverage in that write, deleting only unconfigured pairs' locks; byte-equal rows write nothing. A failed Activate keeps the previous activation in force.
func (*Store) Baseline ¶
func (s *Store) Baseline(ctx context.Context, inst InstanceID, name string) (timing.Cues, bool, error)
Baseline returns the baseline cues of name's record; false when none is stored.
func (*Store) BeginDelete ¶
func (s *Store) BeginDelete(ctx context.Context, inst InstanceID, name string, removed [32]byte) error
BeginDelete stages the removal of name, which must hold removed when the removal lands. It refuses, writing nothing, a name with a pending intent and an unknown instance.
func (*Store) BeginDeliver ¶
func (s *Store) BeginDeliver(ctx context.Context, d PendingDeliver) error
BeginDeliver stages d under its record's name: nothing live changes until EndDeliver. It refuses, writing nothing, a name with a pending intent, an unknown instance, a Timing Validate refuses, the zero baseline, no attempt, an attempt for another instance, and a delivered attempt naming an item the instance does not hold.
func (*Store) BeginRetime ¶
BeginRetime stages rec, the retimed record of a managed file, or with adopt the baseline of an unmanaged file rec adopts. It refuses, writing nothing, a name with a pending intent, an unknown instance, a Timing Validate refuses, a retime of a name with no record, and an adoption of one that has a record or of the zero baseline.
func (*Store) Changed ¶
func (s *Store) Changed() <-chan struct{}
Changed returns the current generation's channel, closed by the next commit that allocates a revision. An observer reads Changed before Since and waits on the channel it read, so one revision wakes every observer.
func (*Store) Coverage ¶
Coverage returns k's configured pairs in Policy.TargetsFor order; none for a key with no item record.
func (*Store) CredentialDisable ¶
func (s *Store) CredentialDisable(ctx context.Context, provider string) (CredentialDisable, bool, error)
CredentialDisable returns provider's record; found is false when the provider has none.
func (*Store) DeferWork ¶
func (s *Store) DeferWork(ctx context.Context, w Work, notBefore time.Time) (first time.Time, deferred bool, err error)
DeferWork makes w's row due no earlier than notBefore when it is still at w's generation, records its first deferral the first time and returns that first deferral; at another generation, or for no row, it changes nothing and answers deferred false. Both survive a reopen.
func (*Store) DeleteCredentialDisable ¶
DeleteCredentialDisable deletes provider's record; none stored is nil.
func (*Store) DeleteJobsEndedBefore ¶
DeleteJobsEndedBefore implements status.Persister: the ended index's range stops at the first record ended at or after t.
func (*Store) Embedded ¶
func (s *Store) Embedded(ctx context.Context, inst InstanceID) (VideoProbe, bool, error)
Embedded returns inst's stored probe; false when none is stored.
func (*Store) EndDelete ¶
EndDelete settles name's pending removal in one write. Landed, it deletes the record and baseline, or for an unmanaged name removes it from the local-file set, then recomputes the instance's coverage. With no pending removal it writes nothing and returns nil.
func (*Store) EndDeliver ¶
EndDeliver settles name's pending delivery in one write. Landed, it writes the record one generation above the stored one (1 for none), its baseline, a lock on every item of the delivered attempt when the record is locked, every attempt, and removes each superseded name other than the record's own, then recomputes the instance's coverage. Not landed, it records the attempts undelivered. With no pending delivery it writes nothing and returns nil, so recovery may repeat it.
func (*Store) EndRetime ¶
EndRetime settles name's pending retime in one write. Landed, it writes the record one generation above the stored one and, for an adoption, its baseline and a lock on every configured pair the adopted file makes servable, then recomputes the instance's coverage. With no pending retime it writes nothing and returns nil.
func (*Store) EnqueueWork ¶
EnqueueWork queues each known instance once: a new row takes the next enqueue position, an existing one keeps its position and the higher cause, becomes due at once and moves to the next generation, so an AckWork of the run that read the older one leaves it queued. Unknown instances are skipped.
func (*Store) Files ¶
func (s *Store) Files(ctx context.Context, id InstanceID) ([]FileRecord, error)
Files returns the instance's managed file records by name; none for an unknown instance.
func (*Store) FinishPass ¶
func (s *Store) FinishPass(ctx context.Context, src media.SourceID, pass PassID, complete bool, next mediasource.Cursor, keep []mediasource.NativeRef) ([]media.SourceID, error)
FinishPass closes src's open pass and returns the distinct owners all of src's overlap rows name (design 5.3). Incomplete, it retires nothing. Complete, in one write, it retires what in scope the pass did not stamp, except under a root in keep, stores next as the cursor, after a whole pass queues Scan work for src's instances outside keep, and expires instances ownerless for more than 30 days. keep, the roots a whole pass could not read, is refused, writing nothing, for a batch, an incomplete pass, or past 32 roots.
func (*Store) History ¶
func (s *Store) History(ctx context.Context, scope HistoryScope, c ListCursor, limit int) ([]Download, ListCursor, error)
History returns up to limit downloads of scope, newest first, and the cursor of the next page, "" after the last. limit outside 1 to 500 is an error, and a cursor of another list or scope is ErrCursorInvalid.
func (*Store) InsertJob ¶
func (s *Store) InsertJob(ctx context.Context, j status.Job, lim status.JobLimits) (status.Job, bool, error)
InsertJob implements status.Persister in one write. A refusal or a replay writes nothing.
func (*Store) Instance ¶
Instance returns any stored instance, ownerless ones included; false for an unknown id.
func (*Store) Item ¶
func (s *Store) Item(ctx context.Context, k media.Key) (mediasource.Item, mediasource.Root, bool, error)
Item returns k's facts from the sighting its item record names, and that sighting's root; false when k has no record or its instance is ownerless.
func (*Store) ItemRow ¶
ItemRow returns k's row as Items lists it; false when k has no record or its instance is ownerless.
func (*Store) Items ¶
func (s *Store) Items(ctx context.Context, root media.RootKey, c ListCursor, limit int) ([]ItemRow, ListCursor, error)
Items returns up to limit of root's items in key order, skipping those of ownerless instances, and the cursor of the next page, "" after the last. limit outside 1 to 500 is an error; a cursor of another list or root is ErrCursorInvalid.
func (*Store) NextWork ¶
NextWork returns up to limit due rows, every Item row before any other and each cause oldest first. limit outside 1 to 1,000 is an error.
func (*Store) NoResults ¶
func (s *Store) NoResults(ctx context.Context, root media.RootKey, season uint16) ([]NoResult, error)
NoResults returns every row of root's season (0 for a movie) with one prefix scan, in key, tag and provider order.
func (*Store) ObserveItems ¶
func (s *Store) ObserveItems(ctx context.Context, src media.SourceID, pass PassID, root mediasource.Root, items []mediasource.Item) error
ObserveItems records what src's open pass saw of root, in one write (design 5.2): the root record and its evidence (deleted when nil), then each item's sighting, claim and stamp in order. It refuses with ErrSourceInactive or ErrPassUnknown, and with a plain error for a root ref of no media kind or no id, evidence failing Validate or naming another TVDB series, an empty or duplicate item id, or a video path neither empty nor absolute and clean, writing nothing. Under a change batch it also queues Import work for every instance an observed item is attached to.
func (*Store) PendingDeliverOf ¶
func (s *Store) PendingDeliverOf(ctx context.Context, inst InstanceID, name string) (PendingDeliver, bool, error)
PendingDeliverOf returns what name's pending delivery staged; false when name has no pending delivery.
func (*Store) PendingWrites ¶
PendingWrites lists every pending intent, by instance and name.
func (*Store) Policy ¶
Policy returns the language policy of the activation in force, the zero Policy before the first Activate.
func (*Store) PutCredentialDisable ¶
func (s *Store) PutCredentialDisable(ctx context.Context, d CredentialDisable) error
PutCredentialDisable stores d, replacing its provider's record; an empty Provider is refused, writing nothing.
func (*Store) PutEmbedded ¶
func (s *Store) PutEmbedded(ctx context.Context, inst InstanceID, p VideoProbe) error
PutEmbedded stores inst's probe and recomputes its items' coverage in the same write; it deletes only locks on pairs no longer configured, since it runs before the local-file listing. An unknown instance is refused, writing nothing.
func (*Store) PutExternal ¶
PutExternal stores inst's local-file set, empty included, and recomputes its items' coverage in the same write, also when the set is unchanged: with a probe stored the inventory is complete, so a lock nothing serves is deleted. Files are stored by name; an empty or repeated name, or an unknown instance, is refused, writing nothing.
func (*Store) PutNoResults ¶
PutNoResults writes rows in one write: a row with Count 0 deletes the stored one, and a row for a key with no item record is skipped, since the item record's deletion is what removes its rows. A negative Count is refused, writing nothing.
func (*Store) RecordAttempts ¶
RecordAttempts appends ds to the download log as undelivered attempts in one write. A delivered attempt is EndDeliver's to record and is refused, as is an attempt naming no item, writing nothing.
func (*Store) ReserveOrdinal ¶
ReserveOrdinal returns the next ordinal of k's numbered files: above highestOnDisk and above every ordinal it returned before for k, so none is ever reused while k's instance lives. It refuses a negative highestOnDisk, an unknown instance, and an ordinal past math.MaxInt, storing nothing; once math.MaxInt is returned every later call for k is refused, across restarts.
func (*Store) Root ¶
Root returns root's row as Roots lists it; false when no item of root is owned or has no instance.
func (*Store) RootEvidence ¶
func (s *Store) RootEvidence(ctx context.Context, src media.SourceID, root mediasource.NativeRef) (mediasource.RootEvidence, bool, error)
RootEvidence returns the evidence src's last observation of root carried; found is false when it carried none or the root has no record.
func (*Store) RootTargets ¶
RootTargets returns one target per source root owning instances under root, by source and root, each with its instances' video paths sorted.
func (*Store) Roots ¶
func (s *Store) Roots(ctx context.Context, c ListCursor, limit int) ([]RootRow, ListCursor, error)
Roots returns up to limit roots in key order that have an item owned or with no instance, and the cursor of the next page, "" after the last. limit outside 1 to 500 is an error; a cursor of another list is ErrCursorInvalid.
func (*Store) SetLock ¶
func (s *Store) SetLock(ctx context.Context, inst InstanceID, tag language.Tag, v language.Variant, locked bool) error
SetLock sets or clears the pair's lock on every item of inst that configures it, in one write, so a double episode is pinned or resumed whole. It refuses with ErrNotLockable an unknown or ownerless instance or a pair no item configures, and, locking, a pair none of the instance's evidence can serve. Locking a locked pair or clearing an unlocked one writes nothing.
func (*Store) Since ¶
Since answers what changed after revision after of the store opened with epoch: Full with the head revision for another epoch, an after of 0 or below the last activation change, or a range the feed no longer retains; otherwise every root, written root and mark since after, deduplicated.
func (*Store) SourceCursor ¶
func (s *Store) SourceCursor(ctx context.Context, src media.SourceID) (mediasource.Cursor, bool, error)
SourceCursor returns the cursor src's last complete pass stored; false when none.
func (*Store) UnfinishedJobs ¶
UnfinishedJobs implements status.Persister, scanning at most the DefaultLimits' Total plus one owner's PerOwner (SystemOwner's) records.
func (*Store) Unidentified ¶
func (s *Store) Unidentified(ctx context.Context, c ListCursor, limit int) ([]UnidentifiedRow, ListCursor, error)
Unidentified returns up to limit sightings no key could be chosen for, by source, root and item, and the cursor of the next page, "" after the last. limit outside 1 to 500 is an error; a cursor of another list is ErrCursorInvalid.
func (*Store) WorkReady ¶
func (s *Store) WorkReady() <-chan struct{}
WorkReady is signalled after every commit that enqueued work, and once at Open when the stored queue is not empty. It holds one wake, for one drainer, which reads NextWork until it answers none.
func (*Store) WriteHealth ¶
func (s *Store) WriteHealth() WriteHealth
WriteHealth reports the outcomes of every write since Open. A refusal, a unique-index conflict or a context error is not a failure.
type UnidentifiedRow ¶
type UnidentifiedRow struct {
Source media.SourceID
Root mediasource.Root
Item mediasource.Item
}
UnidentifiedRow is a sighting no key could be chosen for, with its root.
type VideoProbe ¶
type VideoProbe struct {
Tracks []EmbeddedTrack
Stamp VideoStamp
FPS float64
}
VideoProbe is what probing a video file found. A failed probe is stored as one with no tracks and a zero stamp, so the instance's inventory still completes.
type VideoStamp ¶
type VideoStamp struct{ Size, MtimeNs int64 }
VideoStamp is the video file's size and modification time when probed; zero for a probe that failed.
type Work ¶
type Work struct {
Inst InstanceID
Gen uint64
Cause WorkCause
}
Work is one queued instance at the generation NextWork read it.