载入中...
搜索中...
未找到
eve::production::WorkQueue类 参考

Generic multi-owner, multi-slot continuous-progress work queue. 更多...

#include <Production.h>

Public 成员函数

 WorkQueue (const WorkQueue &)=delete
 
WorkQueue & operator= (const WorkQueue &)=delete
 
 WorkQueue (WorkQueue &&)=default
 Work queue.
 
WorkQueue & operator= (WorkQueue &&)=default
 Operator =.
 
 WorkQueue (eve::PersistentId instanceId={})
 Creates an empty queue with an optional persistent identity.
 
eve::Result< std::string > enqueue (std::string_view owner, std::string_view kind, std::string_view product, eve::Value context, double duration, int priority=0)
 Enqueues a task and returns its stable ID.
 
eve::Result< std::string > enqueue (ProductionRequest request)
 Enqueues a validated request with optional pinned definition and reservation evidence.
 
eve::Result< void > pause (std::string_view taskId)
 Pauses a queued or running task, or returns NotFound/Conflict.
 
eve::Result< void > resume (std::string_view taskId)
 Returns a paused task to deterministic scheduling.
 
eve::Result< void > cancel (std::string_view taskId, std::string_view reason="cancelled")
 Cancels a non-terminal task with a structured outcome.
 
eve::Result< void > fail (std::string_view taskId, std::string_view reason="failed")
 Marks a non-terminal task failed with a structured outcome.
 
eve::Result< void > settle (std::string_view taskId, ProductionSettlementReceipt receipt)
 Atomically marks a ready task settled and retains its idempotency receipt.
 
eve::Result< void > failSettlement (std::string_view taskId, std::string_view reason)
 Records a retryable domain settlement failure without losing completed work.
 
eve::Result< void > retrySettlement (std::string_view taskId)
 Returns a failed settlement to the ready state for an explicit retry.
 
eve::Result< ProductionReservationRelease > releaseReservation (std::string_view taskId, std::string_view releaseId)
 Idempotently releases cancelled/failed reservation evidence for domain rollback.
 
eve::Result< void > contribute (std::string_view taskId, WorkContribution contribution)
 Applies deterministic external work after efficiency scaling.
 
eve::Result< void > reportStock (std::string_view taskId, int observedStock)
 Reports current domain stock for a maintain-stock task and reschedules deterministically.
 
eve::Result< void > advance (const eve::SimulationStep &step)
 Applies one injected deterministic simulation step.
 
eve::Result< std::uint32_t > advanceTo (eve::SimulationTick target, eve::Duration fixedDelta, std::uint32_t maxSteps)
 Advances through bounded fixed steps to a target tick.
 
eve::SimulationTick currentTick () const noexcept
 Return the latest simulation tick applied to this queue.
 
eve::Result< void > setSlotCount (std::string_view owner, int slots)
 Sets an owner's parallel slot count; zero prevents new tasks from running.
 
int slotCount (std::string_view owner) const
 Returns an owner's slot count, defaulting to one.
 
int runningCount (std::string_view owner) const
 Returns the number of currently running tasks for an owner.
 
eve::Result< void > setSchedulerStrategy (std::string_view owner, SchedulerStrategy strategy)
 Selects an owner's deterministic queue ordering strategy.
 
SchedulerStrategy schedulerStrategy (std::string_view owner) const
 Returns an owner's queue ordering strategy, defaulting to Priority.
 
eve::Result< void > setResourceCapacity (std::string_view owner, std::string_view resource, int capacity)
 Sets named running capacity for an owner; zero disables that capability.
 
int resourceCapacity (std::string_view owner, std::string_view resource) const
 Returns named capacity, defaulting slot to slotCount and other resources to zero.
 
eve::Result< std::string > blockReason (std::string_view taskId) const
 Returns the deterministic reason a task cannot start, or an empty string when runnable.
 
eve::Result< void > setDefinitionAvailable (std::string_view owner, const eve::definition::DefinitionHandle &definition, bool available)
 Publishes or withdraws one generation-qualified definition fact for an owner.
 
eve::Result< void > setTagAvailable (std::string_view owner, std::string_view tag, bool available)
 Publishes or withdraws one exact tag fact for an owner.
 
bool definitionAvailable (std::string_view owner, const eve::definition::DefinitionHandle &definition) const
 Reports whether an exact definition incarnation is available to an owner.
 
bool tagAvailable (std::string_view owner, std::string_view tag) const
 Reports whether an exact tag is available to an owner.
 
eve::Result< ProductionPrediction > predict (std::string_view taskId) const
 Predicts task timing without mutating queue state.
 
eve::Result< ProductionDiagnostic > diagnose (std::string_view taskId) const
 Returns structured diagnostic state for a task.
 
eve::OptionalRef< const ProductionTask > find (std::string_view taskId)
 Finds a retained task by stable ID.
 
eve::OptionalRef< const ProductionTask > find (std::string_view taskId) const
 Const overload of find with the same immediate-borrow lifetime.
 
int taskCount () const
 Returns retained task count in enqueue order.
 
eve::OptionalRef< const ProductionTask > taskAt (int index)
 Returns a retained task by enqueue index, or an empty borrowed reference.
 
eve::OptionalRef< const ProductionTask > taskAt (int index) const
 Const overload of taskAt with the same immediate-borrow lifetime.
 
int ownerTaskCount (std::string_view owner) const
 Returns retained task count for an owner.
 
eve::OptionalRef< const ProductionTask > ownerTaskAt (std::string_view owner, int index)
 Returns an owner's retained task by enqueue index, or an empty borrowed reference.
 
eve::OptionalRef< const ProductionTask > ownerTaskAt (std::string_view owner, int index) const
 Const overload of ownerTaskAt with the same immediate-borrow lifetime.
 
int eventCount () const
 Returns retained event count.
 
eve::OptionalRef< ProductionEvent > eventAt (int index)
 Returns an event by sequence index, or an empty borrowed reference.
 
eve::OptionalRef< const ProductionEvent > eventAt (int index) const
 Const overload of eventAt with the same immediate-borrow lifetime.
 
void clearEvents ()
 Clears retained events without resetting sequence numbering.
 
eve::Result< std::string > snapshot () const
 Serializes the complete queue as deterministic JSON.
 
eve::Result< void > restore (std::string_view json)
 Transactionally restores a snapshot; failure preserves current state.
 
void clear ()
 Clears tasks, owner settings, events, and stable counters.
 
eve::Result< eve::SnapshotEnvelope > snapshot (const eve::SnapshotHashProvider &hashProvider) const
 Captures the production payload in the common snapshot envelope.
 
eve::Result< void > restoreSnapshot (const eve::SnapshotEnvelope &snapshot, const eve::SnapshotHashProvider &hashProvider)
 Restores a verified or migrated production envelope atomically.
 
eve::Result< std::string > snapshotEnvelopeJson (const eve::SnapshotHashProvider &hashProvider) const
 Serializes the common production snapshot envelope.
 
eve::Result< void > restoreSnapshotJson (std::string_view json, const eve::SnapshotHashProvider &hashProvider)
 Parses and transactionally restores a common production envelope.
 

详细描述

Generic multi-owner, multi-slot continuous-progress work queue.

在文件 Production.h 第 200 行定义.

构造及析构函数说明

◆ WorkQueue() [1/3]

eve::production::WorkQueue::WorkQueue ( const WorkQueue &  )
delete

◆ WorkQueue() [2/3]

eve::production::WorkQueue::WorkQueue ( WorkQueue &&  )
default

Work queue.

◆ WorkQueue() [3/3]

eve::production::WorkQueue::WorkQueue ( eve::PersistentId  instanceId = {})
explicit

Creates an empty queue with an optional persistent identity.

在文件 Production.cpp 第 54 行定义.

成员函数说明

◆ advance()

eve::Result< void > eve::production::WorkQueue::advance ( const eve::SimulationStep &  step)

Applies one injected deterministic simulation step.

参数
stepTick and fixed duration supplied by a SimulationClock.
返回
Success, or a structured failure if the tick is not strictly newer or the step is invalid.
备注
Owner-thread only. The queue never reads a wall clock.

在文件 Production.cpp 第 509 行定义.

引用了 appliedNanoseconds, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Duration::fromNanoseconds(), eve::InvalidArgument, pending, eve::PreconditionViolation, remainderPermille, eve::production::Running, step , 以及 eve::Result< T >::success().

被这些函数引用 advanceTo().

◆ advanceTo()

eve::Result< std::uint32_t > eve::production::WorkQueue::advanceTo ( eve::SimulationTick  target,
eve::Duration  fixedDelta,
std::uint32_t  maxSteps 
)

◆ blockReason()

◆ cancel()

◆ clear()

void eve::production::WorkQueue::clear ( )

Clears tasks, owner settings, events, and stable counters.

在文件 ProductionPersistence.cpp 第 699 行定义.

引用了 eve::detail::StrongUint64< detail::SimulationTickTag >::zero() , 以及 eve::detail::StrongUint64< detail::RevisionTag >::zero().

◆ clearEvents()

void eve::production::WorkQueue::clearEvents ( )

Clears retained events without resetting sequence numbering.

在文件 Production.cpp 第 621 行定义.

◆ contribute()

◆ currentTick()

eve::SimulationTick eve::production::WorkQueue::currentTick ( ) const
inlinenoexcept

Return the latest simulation tick applied to this queue.

在文件 Production.h 第 265 行定义.

◆ definitionAvailable()

bool eve::production::WorkQueue::definitionAvailable ( std::string_view  owner,
const eve::definition::DefinitionHandle &  definition 
) const

Reports whether an exact definition incarnation is available to an owner.

在文件 ProductionAdvanced.cpp 第 40 行定义.

引用了 key.

被这些函数引用 blockReason().

◆ diagnose()

◆ enqueue() [1/2]

◆ enqueue() [2/2]

eve::Result< std::string > eve::production::WorkQueue::enqueue ( std::string_view  owner,
std::string_view  kind,
std::string_view  product,
eve::Value  context,
double  duration,
int  priority = 0 
)

Enqueues a task and returns its stable ID.

参数
ownerLogical owner of the work slots.
kindDomain task kind; the queue does not interpret it.
productDomain product identifier; the queue does not interpret it.
contextOwning canonical payload for the task.
durationPositive work duration in seconds.
priorityHigher priorities run first; enqueue order breaks ties.
返回
A stable task ID, or a structured validation/allocation failure.

在文件 Production.cpp 第 216 行定义.

引用了 context, duration, enqueue(), eve::Result< T >::failure(), eve::Duration::fromSeconds(), kind, eve::production::ProductionRequest::owner, priority , 以及 request.

被这些函数引用 enqueue().

◆ eventAt() [1/2]

eve::OptionalRef< ProductionEvent > eve::production::WorkQueue::eventAt ( int  index)

Returns an event by sequence index, or an empty borrowed reference.

在文件 Production.cpp 第 611 行定义.

引用了 index.

被这些函数引用 eve::queue_editing::RuntimeQueueInspector::capture().

◆ eventAt() [2/2]

eve::OptionalRef< const ProductionEvent > eve::production::WorkQueue::eventAt ( int  index) const

Const overload of eventAt with the same immediate-borrow lifetime.

在文件 Production.cpp 第 616 行定义.

引用了 index.

◆ eventCount()

int eve::production::WorkQueue::eventCount ( ) const

Returns retained event count.

在文件 Production.cpp 第 609 行定义.

被这些函数引用 eve::queue_editing::RuntimeQueueInspector::capture().

◆ fail()

eve::Result< void > eve::production::WorkQueue::fail ( std::string_view  taskId,
std::string_view  reason = "failed" 
)

◆ failSettlement()

eve::Result< void > eve::production::WorkQueue::failSettlement ( std::string_view  taskId,
std::string_view  reason 
)

◆ find() [1/2]

eve::OptionalRef< const ProductionTask > eve::production::WorkQueue::find ( std::string_view  taskId)

Finds a retained task by stable ID.

返回
An immediate borrowed reference, empty when the ID is absent. @ownership WorkQueue owns the task; the reference is not owning. @lifetime Valid until queue mutation, restore, clear, or destruction. @thread Owner-thread only; no synchronization is provided.

在文件 Production.cpp 第 332 行定义.

引用了 taskId.

被这些函数引用 blockReason(), diagnose(), enqueue(), predict(), restore() , 以及 eve::rpg::Crafting::settle().

◆ find() [2/2]

eve::OptionalRef< const ProductionTask > eve::production::WorkQueue::find ( std::string_view  taskId) const

Const overload of find with the same immediate-borrow lifetime.

在文件 Production.cpp 第 338 行定义.

引用了 taskId.

◆ operator=() [1/2]

WorkQueue & eve::production::WorkQueue::operator= ( const WorkQueue &  )
delete

◆ operator=() [2/2]

WorkQueue & eve::production::WorkQueue::operator= ( WorkQueue &&  )
default

Operator =.

◆ ownerTaskAt() [1/2]

eve::OptionalRef< const ProductionTask > eve::production::WorkQueue::ownerTaskAt ( std::string_view  owner,
int  index 
)

Returns an owner's retained task by enqueue index, or an empty borrowed reference.

在文件 Production.cpp 第 595 行定义.

引用了 index.

◆ ownerTaskAt() [2/2]

eve::OptionalRef< const ProductionTask > eve::production::WorkQueue::ownerTaskAt ( std::string_view  owner,
int  index 
) const

Const overload of ownerTaskAt with the same immediate-borrow lifetime.

在文件 Production.cpp 第 602 行定义.

引用了 index.

◆ ownerTaskCount()

int eve::production::WorkQueue::ownerTaskCount ( std::string_view  owner) const

Returns retained task count for an owner.

在文件 Production.cpp 第 590 行定义.

引用了 t.

◆ pause()

eve::Result< void > eve::production::WorkQueue::pause ( std::string_view  taskId)

◆ predict()

◆ releaseReservation()

◆ reportStock()

eve::Result< void > eve::production::WorkQueue::reportStock ( std::string_view  taskId,
int  observedStock 
)

◆ resourceCapacity()

int eve::production::WorkQueue::resourceCapacity ( std::string_view  owner,
std::string_view  resource 
) const

Returns named capacity, defaulting slot to slotCount and other resources to zero.

在文件 Production.cpp 第 104 行定义.

引用了 key, resource , 以及 slotCount().

◆ restore()

◆ restoreSnapshot()

eve::Result< void > eve::production::WorkQueue::restoreSnapshot ( const eve::SnapshotEnvelope &  snapshot,
const eve::SnapshotHashProvider &  hashProvider 
)

Restores a verified or migrated production envelope atomically.

参数
snapshotSource envelope with schema production:queue.
hashProviderExplicit content-digest provider.
返回
Success, or a failure leaving queue state unchanged.

在文件 ProductionSnapshot.cpp 第 245 行定义.

引用了 eve::Conflict, eve::Result< T >::failure(), eve::InvalidArgument, eve::detail::Id128< Tag >::isNil(), payload, restore(), source, eve::Result< T >::success() , 以及 eve::validateSnapshotPayloadMetadata().

被这些函数引用 restoreSnapshotJson().

◆ restoreSnapshotJson()

eve::Result< void > eve::production::WorkQueue::restoreSnapshotJson ( std::string_view  json,
const eve::SnapshotHashProvider &  hashProvider 
)

Parses and transactionally restores a common production envelope.

在文件 ProductionSnapshot.cpp 第 279 行定义.

引用了 eve::Result< T >::failure(), eve::parseSnapshotEnvelope(), restoreSnapshot() , 以及 source.

◆ resume()

eve::Result< void > eve::production::WorkQueue::resume ( std::string_view  taskId)

◆ retrySettlement()

eve::Result< void > eve::production::WorkQueue::retrySettlement ( std::string_view  taskId)

◆ runningCount()

int eve::production::WorkQueue::runningCount ( std::string_view  owner) const

Returns the number of currently running tasks for an owner.

在文件 Production.cpp 第 98 行定义.

被这些函数引用 predict().

◆ schedulerStrategy()

SchedulerStrategy eve::production::WorkQueue::schedulerStrategy ( std::string_view  owner) const

Returns an owner's queue ordering strategy, defaulting to Priority.

在文件 ProductionAdvanced.cpp 第 34 行定义.

引用了 key , 以及 eve::production::Priority.

◆ setDefinitionAvailable()

eve::Result< void > eve::production::WorkQueue::setDefinitionAvailable ( std::string_view  owner,
const eve::definition::DefinitionHandle &  definition,
bool  available 
)

Publishes or withdraws one generation-qualified definition fact for an owner.

在文件 ProductionAdvanced.cpp 第 51 行定义.

引用了 eve::Applied, exists, eve::InvalidArgument, key, eve::NoOp, schedule, eve::Status::success() , 以及 eve::Result< T >::success().

被这些函数引用 restore().

◆ setResourceCapacity()

eve::Result< void > eve::production::WorkQueue::setResourceCapacity ( std::string_view  owner,
std::string_view  resource,
int  capacity 
)

Sets named running capacity for an owner; zero disables that capability.

在文件 Production.cpp 第 563 行定义.

引用了 eve::Applied, capacity, eve::InvalidArgument, key, resource, schedule, eve::Status::success() , 以及 eve::Result< T >::success().

被这些函数引用 restore().

◆ setSchedulerStrategy()

eve::Result< void > eve::production::WorkQueue::setSchedulerStrategy ( std::string_view  owner,
SchedulerStrategy  strategy 
)

Selects an owner's deterministic queue ordering strategy.

在文件 ProductionAdvanced.cpp 第 80 行定义.

引用了 eve::Applied, eve::InvalidArgument, key, schedule, eve::Status::success() , 以及 eve::Result< T >::success().

被这些函数引用 restore().

◆ setSlotCount()

eve::Result< void > eve::production::WorkQueue::setSlotCount ( std::string_view  owner,
int  slots 
)

Sets an owner's parallel slot count; zero prevents new tasks from running.

在文件 Production.cpp 第 549 行定义.

引用了 eve::Applied, eve::InvalidArgument, key, schedule, slots, eve::Status::success() , 以及 eve::Result< T >::success().

被这些函数引用 restore().

◆ setTagAvailable()

eve::Result< void > eve::production::WorkQueue::setTagAvailable ( std::string_view  owner,
std::string_view  tag,
bool  available 
)

Publishes or withdraws one exact tag fact for an owner.

在文件 ProductionAdvanced.cpp 第 66 行定义.

引用了 eve::Applied, exists, eve::InvalidArgument, key, eve::NoOp, schedule, eve::Status::success(), eve::Result< T >::success() , 以及 tag.

被这些函数引用 restore().

◆ settle()

◆ slotCount()

int eve::production::WorkQueue::slotCount ( std::string_view  owner) const

Returns an owner's slot count, defaulting to one.

在文件 Production.cpp 第 92 行定义.

引用了 key.

被这些函数引用 predict() , 以及 resourceCapacity().

◆ snapshot() [1/2]

◆ snapshot() [2/2]

eve::Result< eve::SnapshotEnvelope > eve::production::WorkQueue::snapshot ( const eve::SnapshotHashProvider &  hashProvider) const

Captures the production payload in the common snapshot envelope.

在文件 ProductionSnapshot.cpp 第 236 行定义.

引用了 eve::Result< T >::failure(), eve::Value::fromJson(), eve::makeSnapshotEnvelope(), payload , 以及 snapshot().

◆ snapshotEnvelopeJson()

eve::Result< std::string > eve::production::WorkQueue::snapshotEnvelopeJson ( const eve::SnapshotHashProvider &  hashProvider) const

Serializes the common production snapshot envelope.

在文件 ProductionSnapshot.cpp 第 272 行定义.

引用了 eve::Result< T >::failure(), eve::serializeSnapshotEnvelope(), snapshot() , 以及 value.

◆ tagAvailable()

bool eve::production::WorkQueue::tagAvailable ( std::string_view  owner,
std::string_view  tag 
) const

Reports whether an exact tag is available to an owner.

在文件 ProductionAdvanced.cpp 第 46 行定义.

引用了 tag.

被这些函数引用 blockReason().

◆ taskAt() [1/2]

eve::OptionalRef< const ProductionTask > eve::production::WorkQueue::taskAt ( int  index)

Returns a retained task by enqueue index, or an empty borrowed reference.

在文件 Production.cpp 第 580 行定义.

引用了 index.

被这些函数引用 eve::queue_editing::RuntimeQueueInspector::capture().

◆ taskAt() [2/2]

eve::OptionalRef< const ProductionTask > eve::production::WorkQueue::taskAt ( int  index) const

Const overload of taskAt with the same immediate-borrow lifetime.

在文件 Production.cpp 第 585 行定义.

引用了 index.

◆ taskCount()

int eve::production::WorkQueue::taskCount ( ) const

Returns retained task count in enqueue order.

在文件 Production.cpp 第 578 行定义.

被这些函数引用 eve::queue_editing::RuntimeQueueInspector::capture().


该类的文档由以下文件生成: