serviceenv

package
v2.8.0-nightly.20230901 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NonblockingServiceEnv

type NonblockingServiceEnv struct {
	// contains filtered or unexported fields
}

NonblockingServiceEnv is an implementation of ServiceEnv that initializes clients in the background, and blocks in the getters until they're ready.

func InitDBOnlyEnv added in v2.7.0

func InitDBOnlyEnv(rctx context.Context, config *pachconfig.Configuration) *NonblockingServiceEnv

InitDBOnlyEnv is like InitServiceEnv, but only connects to the database.

func InitPachOnlyEnv

func InitPachOnlyEnv(rctx context.Context, config *pachconfig.Configuration) *NonblockingServiceEnv

InitPachOnlyEnv initializes this service environment. This dials a GRPC connection to pachd only (in a background goroutine), and creates the template pachClient used by future calls to GetPachClient.

This call returns immediately, but GetPachClient will block until the client is ready.

func InitServiceEnv

func InitServiceEnv(ctx context.Context, config *pachconfig.Configuration) *NonblockingServiceEnv

InitServiceEnv initializes this service environment. This dials a GRPC connection to pachd and etcd (in a background goroutine), and creates the template pachClient used by future calls to GetPachClient.

This call returns immediately, but GetPachClient and GetEtcdClient block until their respective clients are ready.

func InitWithKube

func InitWithKube(ctx context.Context, config *pachconfig.Configuration) *NonblockingServiceEnv

InitWithKube is like InitNonblockingServiceEnv, but also assumes that it's run inside a kubernetes cluster and tries to connect to the kubernetes API server.

func (*NonblockingServiceEnv) AuthServer

func (env *NonblockingServiceEnv) AuthServer() auth_server.APIServer

AuthServer returns the registered Auth APIServer

func (*NonblockingServiceEnv) Close

func (env *NonblockingServiceEnv) Close() error

func (*NonblockingServiceEnv) ClusterID

func (env *NonblockingServiceEnv) ClusterID() string

func (*NonblockingServiceEnv) Config

func (*NonblockingServiceEnv) Context

func (env *NonblockingServiceEnv) Context() context.Context

func (*NonblockingServiceEnv) EnterpriseServer

func (env *NonblockingServiceEnv) EnterpriseServer() enterprise_server.APIServer

EnterpriseServer returns the registered PFS APIServer

func (*NonblockingServiceEnv) GetDBClient

func (env *NonblockingServiceEnv) GetDBClient() *pachsql.DB

GetDBClient returns the already connected database client without modification.

func (*NonblockingServiceEnv) GetDexDB

func (env *NonblockingServiceEnv) GetDexDB() dex_storage.Storage

func (*NonblockingServiceEnv) GetDirectDBClient

func (env *NonblockingServiceEnv) GetDirectDBClient() *pachsql.DB

func (*NonblockingServiceEnv) GetEtcdClient

func (env *NonblockingServiceEnv) GetEtcdClient() *etcd.Client

GetEtcdClient returns the already connected etcd client without modification.

func (*NonblockingServiceEnv) GetKubeClient

func (env *NonblockingServiceEnv) GetKubeClient() kube.Interface

GetKubeClient returns the already connected Kubernetes API client without modification.

func (*NonblockingServiceEnv) GetLokiClient

func (env *NonblockingServiceEnv) GetLokiClient() (*loki.Client, error)

GetLokiClient returns the loki client, it doesn't require blocking on a connection because the client is just a dumb struct with no init function.

func (*NonblockingServiceEnv) GetPachClient

func (env *NonblockingServiceEnv) GetPachClient(ctx context.Context) *client.APIClient

GetPachClient returns a pachd client with the same authentication credentials and cancellation as 'ctx' (ensuring that auth credentials are propagated through downstream RPCs).

Functions that receive RPCs should call this to convert their RPC context to a Pachyderm client, and internal Pachyderm calls should accept clients returned by this call.

(Warning) Do not call this function during server setup unless it is in a goroutine. A Pachyderm client is not available until the server has been setup.

func (*NonblockingServiceEnv) GetPostgresListener

func (env *NonblockingServiceEnv) GetPostgresListener() col.PostgresListener

GetPostgresListener returns the already constructed database client dedicated for listen operations without modification. Note that this listener lazily connects to the database on the first listen operation.

func (*NonblockingServiceEnv) GetTaskService

func (env *NonblockingServiceEnv) GetTaskService(prefix string) task.Service

func (*NonblockingServiceEnv) IdentityServer

func (env *NonblockingServiceEnv) IdentityServer() identity.APIServer

IdentityServer returns the registered Identity APIServer

func (*NonblockingServiceEnv) InitDexDB

func (env *NonblockingServiceEnv) InitDexDB()

func (*NonblockingServiceEnv) PfsServer

func (env *NonblockingServiceEnv) PfsServer() pfs_server.APIServer

PfsServer returns the registered PFS APIServer

func (*NonblockingServiceEnv) PpsServer

func (env *NonblockingServiceEnv) PpsServer() pps_server.APIServer

PpsServer returns the registered PPS APIServer

func (*NonblockingServiceEnv) SetAuthServer

func (env *NonblockingServiceEnv) SetAuthServer(s auth_server.APIServer)

SetAuthServer registers an Auth APIServer with this service env

func (*NonblockingServiceEnv) SetEnterpriseServer

func (env *NonblockingServiceEnv) SetEnterpriseServer(s enterprise_server.APIServer)

SetEnterpriseServer registers a Enterprise APIServer with this service env

func (*NonblockingServiceEnv) SetIdentityServer

func (env *NonblockingServiceEnv) SetIdentityServer(s identity.APIServer)

SetIdentityServer registers an Identity APIServer with this service env

func (*NonblockingServiceEnv) SetKubeClient

func (env *NonblockingServiceEnv) SetKubeClient(s kube.Interface)

SetKubeClient can be used to override the kubeclient in testing.

func (*NonblockingServiceEnv) SetPfsServer

func (env *NonblockingServiceEnv) SetPfsServer(s pfs_server.APIServer)

SetPfsServer registers a Pfs APIServer with this service env

func (*NonblockingServiceEnv) SetPpsServer

func (env *NonblockingServiceEnv) SetPpsServer(s pps_server.APIServer)

SetPpsServer registers a Pps APIServer with this service env

type ServiceEnv

type ServiceEnv interface {
	AuthServer() auth_server.APIServer
	IdentityServer() identity.APIServer
	PfsServer() pfs_server.APIServer
	PpsServer() pps_server.APIServer
	EnterpriseServer() enterprise_server.APIServer
	SetAuthServer(auth_server.APIServer)
	SetIdentityServer(identity.APIServer)
	SetPfsServer(pfs_server.APIServer)
	SetPpsServer(pps_server.APIServer)
	SetEnterpriseServer(enterprise_server.APIServer)
	SetKubeClient(kube.Interface)

	Config() *pachconfig.Configuration
	GetPachClient(ctx context.Context) *client.APIClient
	GetEtcdClient() *etcd.Client
	GetTaskService(string) task.Service
	GetKubeClient() kube.Interface
	GetLokiClient() (*loki.Client, error)
	GetDBClient() *pachsql.DB
	GetDirectDBClient() *pachsql.DB
	GetPostgresListener() col.PostgresListener
	InitDexDB()
	GetDexDB() dex_storage.Storage
	ClusterID() string
	Context() context.Context
	Close() error
}

ServiceEnv contains connections to other services in the cluster. In pachd, there is only one instance of this struct, but tests may create more, if they want to create multiple pachyderm "clusters" served in separate goroutines.

type TestServiceEnv

type TestServiceEnv struct {
	Configuration            *pachconfig.Configuration
	PachClient               *client.APIClient
	EtcdClient               *etcd.Client
	KubeClient               kube.Interface
	LokiClient               *loki.Client
	DBClient, DirectDBClient *pachsql.DB
	PostgresListener         col.PostgresListener
	DexDB                    dex_storage.Storage
	Ctx                      context.Context

	// Auth is the registered auth APIServer
	Auth auth_server.APIServer

	// Identity is the registered auth APIServer
	Identity identity.APIServer

	// Pps is the registered pps APIServer
	Pps pps_server.APIServer

	// Pfs is the registered pfs APIServer
	Pfs pfs_server.APIServer

	// Enterprise is the registered pfs APIServer
	Enterprise enterprise_server.APIServer

	// Ready is a channel that blocks `GetPachClient` until it's closed.
	// This avoids a race when we need to instantiate the server before
	// getting a client pointing at the same server.
	Ready chan interface{}
}

TestServiceEnv is a simple implementation of ServiceEnv that can be constructed with existing clients.

func (*TestServiceEnv) AuthServer

func (env *TestServiceEnv) AuthServer() auth_server.APIServer

AuthServer returns the registered Auth APIServer

func (*TestServiceEnv) Close

func (s *TestServiceEnv) Close() error

func (*TestServiceEnv) ClusterID

func (s *TestServiceEnv) ClusterID() string

func (*TestServiceEnv) Config

func (*TestServiceEnv) Context

func (s *TestServiceEnv) Context() context.Context

func (*TestServiceEnv) EnterpriseServer

func (env *TestServiceEnv) EnterpriseServer() enterprise_server.APIServer

EnterpriseServer returns the registered Enterprise APIServer

func (*TestServiceEnv) GetDBClient

func (s *TestServiceEnv) GetDBClient() *pachsql.DB

func (*TestServiceEnv) GetDexDB

func (s *TestServiceEnv) GetDexDB() dex_storage.Storage

func (*TestServiceEnv) GetDirectDBClient

func (s *TestServiceEnv) GetDirectDBClient() *pachsql.DB

func (*TestServiceEnv) GetEtcdClient

func (s *TestServiceEnv) GetEtcdClient() *etcd.Client

func (*TestServiceEnv) GetKubeClient

func (s *TestServiceEnv) GetKubeClient() kube.Interface

func (*TestServiceEnv) GetLokiClient

func (s *TestServiceEnv) GetLokiClient() (*loki.Client, error)

func (*TestServiceEnv) GetPachClient

func (s *TestServiceEnv) GetPachClient(ctx context.Context) *client.APIClient

func (*TestServiceEnv) GetPostgresListener

func (s *TestServiceEnv) GetPostgresListener() col.PostgresListener

func (*TestServiceEnv) GetTaskService

func (s *TestServiceEnv) GetTaskService(prefix string) task.Service

func (*TestServiceEnv) IdentityServer

func (env *TestServiceEnv) IdentityServer() identity.APIServer

IdentityServer returns the registered Identity APIServer

func (*TestServiceEnv) InitDexDB

func (end *TestServiceEnv) InitDexDB()

InitDexDB implements the ServiceEnv interface.

func (*TestServiceEnv) PfsServer

func (env *TestServiceEnv) PfsServer() pfs_server.APIServer

PfsServer returns the registered PFS APIServer

func (*TestServiceEnv) PpsServer

func (env *TestServiceEnv) PpsServer() pps_server.APIServer

PpsServer returns the registered PPS APIServer

func (*TestServiceEnv) SetAuthServer

func (env *TestServiceEnv) SetAuthServer(s auth_server.APIServer)

SetAuthServer returns the registered Auth APIServer

func (*TestServiceEnv) SetEnterpriseServer

func (env *TestServiceEnv) SetEnterpriseServer(s enterprise_server.APIServer)

SetEnterpriseServer returns the registered Enterprise APIServer

func (*TestServiceEnv) SetIdentityServer

func (env *TestServiceEnv) SetIdentityServer(s identity.APIServer)

SetIdentityServer returns the registered Identity APIServer

func (*TestServiceEnv) SetKubeClient

func (env *TestServiceEnv) SetKubeClient(s kube.Interface)

SetKubeClient can be used to override the kubeclient in testing.

func (*TestServiceEnv) SetPfsServer

func (env *TestServiceEnv) SetPfsServer(s pfs_server.APIServer)

SetPfsServer returns the registered PFS APIServer

func (*TestServiceEnv) SetPpsServer

func (env *TestServiceEnv) SetPpsServer(s pps_server.APIServer)

SetPpsServer returns the registered PPS APIServer

Jump to

Keyboard shortcuts

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