internal

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseConfig

func ParseConfig[Config any](data []byte) (*Config, error)

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
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL