pub trait TransactionalPromptCacheMechanisms<A, B>: ReplicatedTextSessionMechanisms<A, B>where
B: SubmissionBackend<Executor = <<B as NeuralBackend>::Tensor as Tensor>::Context>,
A: LayeredArchitecture<B, Self::State>,
Self::State: RuntimeState<B>,
Self::ResidentPolicy: LayerwisePolicy<B, A::Unit, Error = Self::PolicyError>,
Self::BoundedPolicy: LayerwisePolicy<B, A::Unit, Error = Self::PolicyError>,{
type PromptCacheSaveTransaction;
// Required methods
fn prepare_prompt_cache_save(
&mut self,
state: &mut Self::State,
destination: &Path,
descriptor: PromptCacheDescriptor,
prefix_token_ids: &[u32],
options: &PromptCacheOptions,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<Self::PromptCacheSaveTransaction, Self::Error>;
fn prepared_prompt_cache_manifest(
transaction: &Self::PromptCacheSaveTransaction,
) -> &PromptCacheManifest;
fn publish_prompt_cache_save(
&mut self,
transaction: &mut Self::PromptCacheSaveTransaction,
) -> Result<(), Self::Error>;
fn commit_prompt_cache_save(
&mut self,
transaction: Self::PromptCacheSaveTransaction,
);
fn rollback_prompt_cache_save(
&mut self,
transaction: Self::PromptCacheSaveTransaction,
);
}Expand description
Reversible prompt-cache publication used by distributed session control.
Preparation must not make the destination visible. Publication may replace
an existing destination, but the returned transaction must retain enough
ownership to restore that destination exactly until Self::commit_prompt_cache_save
is called. Commit and rollback are deliberately infallible: an implementation
that cannot provide an exact reversible publication must not implement this
capability.
Required Associated Types§
Sourcetype PromptCacheSaveTransaction
type PromptCacheSaveTransaction
Opaque staged publication retaining any superseded destination.
Required Methods§
Sourcefn prepare_prompt_cache_save(
&mut self,
state: &mut Self::State,
destination: &Path,
descriptor: PromptCacheDescriptor,
prefix_token_ids: &[u32],
options: &PromptCacheOptions,
context: &<<B as NeuralBackend>::Tensor as Tensor>::Context,
) -> Result<Self::PromptCacheSaveTransaction, Self::Error>
fn prepare_prompt_cache_save( &mut self, state: &mut Self::State, destination: &Path, descriptor: PromptCacheDescriptor, prefix_token_ids: &[u32], options: &PromptCacheOptions, context: &<<B as NeuralBackend>::Tensor as Tensor>::Context, ) -> Result<Self::PromptCacheSaveTransaction, Self::Error>
Serializes a candidate without publishing or replacing the destination.
Sourcefn prepared_prompt_cache_manifest(
transaction: &Self::PromptCacheSaveTransaction,
) -> &PromptCacheManifest
fn prepared_prompt_cache_manifest( transaction: &Self::PromptCacheSaveTransaction, ) -> &PromptCacheManifest
Returns the fully validated candidate manifest before publication.
Sourcefn publish_prompt_cache_save(
&mut self,
transaction: &mut Self::PromptCacheSaveTransaction,
) -> Result<(), Self::Error>
fn publish_prompt_cache_save( &mut self, transaction: &mut Self::PromptCacheSaveTransaction, ) -> Result<(), Self::Error>
Makes the staged candidate visible while retaining reversible ownership.
Sourcefn commit_prompt_cache_save(
&mut self,
transaction: Self::PromptCacheSaveTransaction,
)
fn commit_prompt_cache_save( &mut self, transaction: Self::PromptCacheSaveTransaction, )
Finalizes a globally successful publication and releases its backup.
Sourcefn rollback_prompt_cache_save(
&mut self,
transaction: Self::PromptCacheSaveTransaction,
)
fn rollback_prompt_cache_save( &mut self, transaction: Self::PromptCacheSaveTransaction, )
Removes an unpublished candidate or exactly restores a published destination.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".