Interface DataSrc


public interface DataSrc
Represents a data source corresponding to an external data resource, serving as a factory for data connections or as a connection pool.

Implementations encapsulate connection management, pool configuration, and resource allocation for specific data stores or external services (such as relational databases, HTTP clients, or caching services). Data sources can be registered globally via Sabi.uses(String, DataSrc) or bound locally to a DataHub.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes this data source and disposes of any allocated resources or connection pools.
    Creates a new DataConn instance associated with this data source.
    void
    Sets up this data source.
  • Method Details

    • setup

      void setup(AsyncGroup ag) throws com.github.sttk.errs.Err
      Sets up this data source.

      This method is invoked during application startup or hub setup to prepare connections or connection pools. Asynchronous setup background tasks can be registered using the provided AsyncGroup.

      Parameters:
      ag - the asynchronous group for registering background tasks
      Throws:
      com.github.sttk.errs.Err - if setting up the data source fails
    • close

      void close()
      Closes this data source and disposes of any allocated resources or connection pools.
    • createDataConn

      DataConn createDataConn() throws com.github.sttk.errs.Err
      Creates a new DataConn instance associated with this data source.
      Returns:
      a new, initialized DataConn connection instance
      Throws:
      com.github.sttk.errs.Err - if creating or establishing the data connection fails