Trait Sources

Source
pub trait Sources:
    Send
    + Sync
    + 'static {
    type ListEntriesStream: Stream<Item = Result<Entry, Status>> + Send + 'static;
    type GetEntryBytesStream: Stream<Item = Result<Chunk, Status>> + Send + 'static;

    // Required methods
    fn list_entries<'life0, 'async_trait>(
        &'life0 self,
        request: Request<EntryRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::ListEntriesStream>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_entry_bytes<'life0, 'async_trait>(
        &'life0 self,
        request: Request<EntryRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::GetEntryBytesStream>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Generated trait containing gRPC methods that should be implemented for use with SourcesServer.

Required Associated Types§

Source

type ListEntriesStream: Stream<Item = Result<Entry, Status>> + Send + 'static

Server streaming response type for the ListEntries method.

Source

type GetEntryBytesStream: Stream<Item = Result<Chunk, Status>> + Send + 'static

Server streaming response type for the GetEntryBytes method.

Required Methods§

Source

fn list_entries<'life0, 'async_trait>( &'life0 self, request: Request<EntryRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<Self::ListEntriesStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the entries of a directory in a streaming way. The idea is that this helps time-to-first-paint especially when the folder is large. The client can start rendering the entries as they come in.

Notes:

  • All paths are relative to the workspace root. The idea is that clients do not need to know the absolute position of a workspace and with workspace-relative paths we can reduce the amount of PII sent.
  • This API DOES NOT recursively list workspace entries. The idea is that the client renders a tree-view with all sub-folder collapsed by default and issue a new list_entries call for a sub-folder when a tree node is expanded.
  • File type is a set of bitflags that represent the various properties of the entry. See the Entry message for more details.
Source

fn get_entry_bytes<'life0, 'async_trait>( &'life0 self, request: Request<EntryRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<Self::GetEntryBytesStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the bytes of a file in a streaming way. The idea is that this helps time-to-first-paint especially when the file is large. This is done, again, to optimize the time to first paint for assets that are streaming compatible such as images.

Implementors§