go-spatial / tegola

Tegola is a Mapbox Vector Tile server written in Go
http://tegola.io/
MIT License
1.25k stars 192 forks source link

Cleanup "provider" and "register" terminology #953

Open jchamberlain opened 9 months ago

jchamberlain commented 9 months ago

As a newcomer to the project, the mixed use of "provider" and "register" in the code base took me some time to grok.

Meanings of "Provider"

  1. A wrapper around some data resource, e.g., a specific PostGIS connection, with a list of layers available in this resource. For example, the "providers" section in the config file has this meaning. This is also referred to as a "Tiler", and its concrete type in common use is TilerUnion. This the kind of "provider" in the "providers" slice returned by cmd/internal/register.Providers(). One of these is "registered" for every "provider" in the config file.
  2. A driver which allows creating Tilers ("provider" definition 1) for a specific type of data resource. provider/postgis is this kind of "provider." This kind of "provider" is "registered" only once and then cleaned up at program exit. The providers map in provider/provider.go holds a set of this kind, although it is also translated into a driversList by provider.Drivers().

Meanings of "Register"

I found the usage of "register" also confusing, but primarily because it refers to different "provider" definitions and lifecycles. There's a register package which has nothing (almost) to do with registering the type 2 "providers". If the context were more clear, the usage of "register" would probably clear up as well.