Skip to main content

VirtualServerHandler

Trait VirtualServerHandler 

Source
pub trait VirtualServerHandler {
    type Error: Error + Send + Sync + 'static;

Show 14 methods // Required methods fn get_hosted_tables( &self, ) -> VirtualServerFuture<'_, Result<Vec<HostedTable>, Self::Error>>; fn table_schema( &self, table_id: &str, ) -> VirtualServerFuture<'_, Result<IndexMap<String, ColumnType>, Self::Error>>; fn table_size( &self, table_id: &str, ) -> VirtualServerFuture<'_, Result<u32, Self::Error>>; fn table_make_view( &mut self, view_id: &str, view_id: &str, config: &mut ViewConfigUpdate, ) -> VirtualServerFuture<'_, Result<String, Self::Error>>; fn view_delete( &self, view_id: &str, ) -> VirtualServerFuture<'_, Result<(), Self::Error>>; fn view_get_data( &self, view_id: &str, config: &ViewConfig, viewport: &ViewPort, ) -> VirtualServerFuture<'_, Result<VirtualDataSlice, Self::Error>>; // Provided methods fn table_column_size( &self, table_id: &str, ) -> VirtualServerFuture<'_, Result<u32, Self::Error>> { ... } fn view_size( &self, view_id: &str, ) -> VirtualServerFuture<'_, Result<u32, Self::Error>> { ... } fn view_column_size( &self, view_id: &str, config: &ViewConfig, ) -> VirtualServerFuture<'_, Result<u32, Self::Error>> { ... } fn view_schema( &self, view_id: &str, _config: &ViewConfig, ) -> VirtualServerFuture<'_, Result<IndexMap<String, ColumnType>, Self::Error>> { ... } fn table_validate_expression( &self, _table_id: &str, _expression: &str, ) -> VirtualServerFuture<'_, Result<ColumnType, Self::Error>> { ... } fn get_features( &self, ) -> VirtualServerFuture<'_, Result<Features<'_>, Self::Error>> { ... } fn table_make_port( &self, _req: &TableMakePortReq, ) -> VirtualServerFuture<'_, Result<u32, Self::Error>> { ... } fn make_table( &mut self, _table_id: &str, _data: &MakeTableData, ) -> VirtualServerFuture<'_, Result<(), Self::Error>> { ... }
}
Expand description

Handler trait for implementing virtual server backends.

This trait defines the interface that must be implemented to provide a custom data source for the Perspective virtual server. Implementors handle table and view operations, translating them to their underlying data store.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

The error type returned by handler methods.

Required Methods§

Source

fn get_hosted_tables( &self, ) -> VirtualServerFuture<'_, Result<Vec<HostedTable>, Self::Error>>

Returns a list of all tables hosted by this handler.

Source

fn table_schema( &self, table_id: &str, ) -> VirtualServerFuture<'_, Result<IndexMap<String, ColumnType>, Self::Error>>

Returns the schema (column names and types) for a table.

Source

fn table_size( &self, table_id: &str, ) -> VirtualServerFuture<'_, Result<u32, Self::Error>>

Returns the number of rows in a table.

Source

fn table_make_view( &mut self, view_id: &str, view_id: &str, config: &mut ViewConfigUpdate, ) -> VirtualServerFuture<'_, Result<String, Self::Error>>

Creates a new view on a table with the given configuration.

The handler may modify the configuration to reflect any adjustments made during view creation.

Source

fn view_delete( &self, view_id: &str, ) -> VirtualServerFuture<'_, Result<(), Self::Error>>

Deletes a view and releases its resources.

Source

fn view_get_data( &self, view_id: &str, config: &ViewConfig, viewport: &ViewPort, ) -> VirtualServerFuture<'_, Result<VirtualDataSlice, Self::Error>>

Retrieves data from a view within the specified viewport.

Provided Methods§

Source

fn table_column_size( &self, table_id: &str, ) -> VirtualServerFuture<'_, Result<u32, Self::Error>>

Return the column count of a Table

Source

fn view_size( &self, view_id: &str, ) -> VirtualServerFuture<'_, Result<u32, Self::Error>>

Returns the number of rows in a View.

Source

fn view_column_size( &self, view_id: &str, config: &ViewConfig, ) -> VirtualServerFuture<'_, Result<u32, Self::Error>>

Return the column count of a View

Source

fn view_schema( &self, view_id: &str, _config: &ViewConfig, ) -> VirtualServerFuture<'_, Result<IndexMap<String, ColumnType>, Self::Error>>

Returns the schema of a view after applying its configuration.

Source

fn table_validate_expression( &self, _table_id: &str, _expression: &str, ) -> VirtualServerFuture<'_, Result<ColumnType, Self::Error>>

Validates an expression against a table and returns its result type.

Default implementation returns Float for all expressions.

Source

fn get_features( &self, ) -> VirtualServerFuture<'_, Result<Features<'_>, Self::Error>>

Returns the features supported by this handler.

Default implementation returns default features.

Source

fn table_make_port( &self, _req: &TableMakePortReq, ) -> VirtualServerFuture<'_, Result<u32, Self::Error>>

Creates a new input port on a table.

Default implementation returns port ID 0.

Source

fn make_table( &mut self, _table_id: &str, _data: &MakeTableData, ) -> VirtualServerFuture<'_, Result<(), Self::Error>>

Creates a new table with the given data.

Default implementation panics with “not implemented”.

Implementors§