Skip to main content

SourcePlugin

Trait SourcePlugin 

Source
pub trait SourcePlugin {
    // Required methods
    fn describe(&self) -> Describe;
    fn validate_config(&self, config: &str) -> Result<(), String>;
    fn auth_status(&self, ctx: &Context) -> Result<AuthStatus, String>;
    fn authenticate(&self, ctx: &Context) -> Result<(), String>;
    fn fetch(&self, req: &FetchRequest) -> Result<FetchResult, String>;

    // Provided methods
    fn config_auth_realm(&self, _config: &str) -> Result<Option<String>, String> { ... }
    fn auth_begin(&self, _ctx: &Context) -> Result<AuthChallenge, String> { ... }
    fn auth_poll(
        &self,
        _ctx: &Context,
        _handle: &str,
    ) -> Result<AuthPollResult, String> { ... }
}
Expand description

The contract (ADR 0001). Builtins implement it in-process; the stdio harness for external plugins wraps the same shapes.

Required Methods§

Source

fn describe(&self) -> Describe

Source

fn validate_config(&self, config: &str) -> Result<(), String>

Pure, offline config validation — run at PROPOSAL validation so a malformed sources.ron cannot be accepted (SOL finding 35).

Source

fn auth_status(&self, ctx: &Context) -> Result<AuthStatus, String>

Source

fn authenticate(&self, ctx: &Context) -> Result<(), String>

Source

fn fetch(&self, req: &FetchRequest) -> Result<FetchResult, String>

Provided Methods§

Source

fn config_auth_realm(&self, _config: &str) -> Result<Option<String>, String>

The auth realm this CONFIGURATION requires (tenant/client-derived — SOL finding 33). None falls back to Describe::auth_realm.

Source

fn auth_begin(&self, _ctx: &Context) -> Result<AuthChallenge, String>

Begin an interactive sign-in (device-code style). Default: not supported — surfaces degrade to “run the CLI” with a live status poll, so plugins without an interactive flow still work in the web.

Source

fn auth_poll( &self, _ctx: &Context, _handle: &str, ) -> Result<AuthPollResult, String>

One poll of a pending interactive sign-in.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§