Project

General

Profile

Controller architecture » History » Revision 5

Revision 4 (Tom Clegg, 01/15/2019 04:28 PM) → Revision 5/6 (Tom Clegg, 05/09/2019 07:07 PM)

h1. Controller architecture 

 **arvados** (Apache2) defines a Provider DBClient interface with the Arvados database operations, like CollectionList(context.Context, CollectionList(Context, ListOptions) (CollectionListResponse, error). It also defines a Context interface that adds permission context to context.Context. 

 **rpc** (Apache2) implements arvados.Provider arvados.DBClient by calling an Arvados controller's http service. It also provides an implementation of arvados.Context that wraps a token so it can be forwarded to the remote. 

 **pgdb** implements arvados.Provider arvados.DBClient by doing PostgreSQL queries. Enforces permissions, validations, model integrity. It also implements a database-backed arvados.Context. 

 **pgdb/container** implements the Container/ContainerRequest methods of pgdb.Provider. Similarly: pgdb.DBClient. Also: pgdb/collection, pgdb/user, etc. 

 **pgdbrow** provides generic functions (used by pgdb/container et al.) to translate between object fields/transformations and SQL rows/statements. 

 **model** validates create/update operations (called by pgdb before doing insert/update statements) 

 **federation** implements arvados.Provider arvados.DBClient by fanning out to multiple arvados.DBClient backends (typically one local and several remotes, to suit cluster config). Federation-unaware APIs just call fall through to the a default (local) Provider. pgdb.DBClient. 

 **router** provides an http.Handler that maps each HTTP request requests to actions by checking auth scope and calling the appropriate arvados.DBClient method. 

 **server** listens on a Provider action: deserialize port and serves http requests. Handler gets an arvados.Context from the (caller-provided) arvados.DBClient, and passes the request to a Provider call signature, check auth scope, call the Provider method, and serialize the return values as an HTTP response. Router. 

 **controller** reads a cluster config file and starts a server backed by a federation.Provider. federation.DBClient. 

 Diagram: https://docs.google.com/drawings/d/1Qsj7Re4kE1tNMy7RaNR_dc9U5t6vswMJOhCI2YlbsCM/edit?usp=sharing 

 The rpc, federation, and pgdb providers offer the same interface so any given program can switch easily between using the federation and model logic built into its own binary and calling out to a different process or host.