pub struct Compiler { /* private fields */ }Expand description
Owns schema-compilation cache state. Construct one per process (or per isolated tenant); nothing here is required to be a singleton.
Implementations§
Source§impl Compiler
impl Compiler
Sourcepub fn new(options: CompilerOptions) -> Self
pub fn new(options: CompilerOptions) -> Self
A compiler with its own cache, budgeted per options.
Sourcepub fn without_cache() -> Self
pub fn without_cache() -> Self
A compiler that caches nothing: every compile and bind rebuilds its artifacts.
Useful for deterministic tests or callers that cache SchemaProgram themselves.
Sourcepub fn compile_json_schema(
&self,
schema: &str,
) -> Result<SchemaProgram, CompileError>
pub fn compile_json_schema( &self, schema: &str, ) -> Result<SchemaProgram, CompileError>
Compiles JSON Schema text with default options. Vocabulary-independent: reuse the
returned SchemaProgram across every vocabulary that needs this schema.
Sourcepub fn compile_json_schema_with_options(
&self,
schema: &str,
options: CompileOptions,
) -> Result<SchemaProgram, CompileError>
pub fn compile_json_schema_with_options( &self, schema: &str, options: CompileOptions, ) -> Result<SchemaProgram, CompileError>
Compiles JSON Schema text with explicit lowering options.
Sourcepub fn compile_json_schema_with_resources(
&self,
schema: &str,
retrieval_uri: Option<&str>,
resources: &[(String, String)],
options: CompileOptions,
limits: SchemaResourceLimits,
) -> Result<SchemaProgram, CompileError>
pub fn compile_json_schema_with_resources( &self, schema: &str, retrieval_uri: Option<&str>, resources: &[(String, String)], options: CompileOptions, limits: SchemaResourceLimits, ) -> Result<SchemaProgram, CompileError>
Compiles against caller-supplied resources; never fetches a $ref target itself.
Sourcepub fn compile_ir_wire(
&self,
wire: &[u8],
) -> Result<SchemaProgram, CompileError>
pub fn compile_ir_wire( &self, wire: &[u8], ) -> Result<SchemaProgram, CompileError>
Decodes and compiles a frozen MFIR wire payload (see crate::SchemaIR::to_wire).
Sourcepub fn cache_stats(&self) -> ExecutableCacheStats
pub fn cache_stats(&self) -> ExecutableCacheStats
Current retention plus cumulative traffic for the executable cache.
Sourcepub fn trie_cache_stats(&self) -> TrieCacheStats
pub fn trie_cache_stats(&self) -> TrieCacheStats
Current retention plus cumulative traffic for the shared vocabulary trie cache.
Sourcepub fn clear_caches(&self)
pub fn clear_caches(&self)
Drops every cached executable and retained vocabulary trie; an existing BoundSchema keeps its own Arc-retained trie safely.