Skip to main content

PersistedQueryStore

Trait PersistedQueryStore 

Source
pub trait PersistedQueryStore:
    Send
    + Sync
    + 'static {
    // Required methods
    fn get<'a>(&'a self, hash: &'a str) -> BoxFuture<'a, Option<Arc<str>>>;
    fn put<'a>(&'a self, hash: &'a str, document: Arc<str>) -> BoxFuture<'a, ()>;
}
Expand description

Where APQ registrations live.

The in-memory InMemoryPersistedQueryStore is per process; a fleet behind a load balancer shares one by implementing this trait over Redis or the database (a miss is harmless — the client re-sends the document — so a best-effort store is fine).

Required Methods§

Source

fn get<'a>(&'a self, hash: &'a str) -> BoxFuture<'a, Option<Arc<str>>>

The document registered under hash, if any.

Source

fn put<'a>(&'a self, hash: &'a str, document: Arc<str>) -> BoxFuture<'a, ()>

Register document under hash. The hash has already been verified.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§