Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseConfig ¶
ParseConfig parses a configuration for a datasource from the given marshaled JSON object.
func RegisterAdapter ¶ added in v0.7.1
func RegisterAdapter[Config any](s *Server, datasourceType string, adapter framework.Adapter[Config]) error
RegisterAdapter registers a new high-level Adapter implementation with the server. The Config type parameter is the type of the config object that will be passed to the high-level Adapter implementation.
If this function is called with the datasource type of an already-registered Adapter, it will return an error.
Types ¶
type AdapterGetPageFunc ¶ added in v0.7.1
type AdapterGetPageFunc func(ctx context.Context, req *api_adapter_v1.GetPageRequest) (framework.Response, *entityReverseIdMapping)
type Server ¶
type Server struct {
api_adapter_v1.UnimplementedAdapterServer
// AdapterGetPageFuncs contains a map of wrapper functions that call the
// GetPage function on the associated high-level Adapter implementation.
// The key in this map should match the Supported Datasource Type
// specified on the Adapter object created in SGNL.
AdapterGetPageFuncs map[string]AdapterGetPageFunc
// Tokens contains a lists of valid auth tokens for this server. This list of Tokens
// is populated when the server is created based on the JSON-encoded value in the file
// located under the path contained in the `AUTH_TOKENS_PATH` environment variable and is
// updated any time this file is modified.
// This field must only be accessed for reading or writing while locking TokensMutex.
Tokens []string
// TokensMutex is the mutex that must be locked for every access to Tokens.
TokensMutex sync.RWMutex
// Logger is an optional logger that can be used throughout the server and passed to adapters
// via the context in a GetPage request.
Logger logs.Logger
}
Server is an implementation of the AdapterServer gRPC service which delegates the implementation of the RPCs to high-level Adapter implementation based on a provided type, and translates and validates RPC requests and responses.
func (*Server) GetPage ¶
func (s *Server) GetPage(ctx context.Context, req *api_adapter_v1.GetPageRequest) (*api_adapter_v1.GetPageResponse, error)
Click to show internal directories.
Click to hide internal directories.