Following the discussion in T211800, assuming for now a single entity type can only be provided by single Wikibase instance, make it possible for wikibase to access entities provided by multiple sources.
For now, only direct database database access is considered.
The general idea would be to define "sources" that are providing entities of particular type. Services providing access to entity data will be defined per source (i,e. a particular service is configured to access the database of given source/instance/repository). Wikibase will determine which source-specific service to use to access data of particular entity based on the entity-type vs source configuration.
Entity ID prefixes are not considered for now, as long as there is no technical need (state January 2019) to have a single entity type provided by multiple Wikibase instances/sources./databases.
Update January 2020:
The implementation of "entity-source-based federation" is almost completed (remaining changes have related patches on gerrit) Wikibase Repo "component" (enabled instead of "repository-prefix-based" one using configuration setting), and also close to complete in the Wikibase Client "component".
After finishing the implementation, the remaining step to complete this work would be to remove the "use entity source based federation" setting and disable the possibility to use "repository-prefix-based federation". Consequently all code paths related to "repository-prefix-based federation" would be dropped.
The known remaining steps are listed below (list not complete as of 2020-01-15, being continuously updated) - note the list is broken in the ordered "steps", order of items in the "step" might be arbitrary
- Repo: adjust WikibaseRepo::getLocalEntityTypes: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/494051 +2ed
- Repo: adjust WikibaseRepo::newValidatorBuilders: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/494052 +2ed
- Repo and Client: adjust constructing of Generic Servicers: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/494650 +2ed
- Repo: adjust WikibaseRepo::getEnabledEntityTypes: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/494651 +2ed
- Repo: adjust (private) WikibaseRepo::getVocabularyBaseUri: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/564976 +2ed
- Repo: Allow to prefix the value namespace in RDF output: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/533202 +2ed
- T243184: entitysources: Client: adjust WikibaseClient::getRepoItemUriParser
- T243185: entitysources: Client: adjust WikibaseClient::getRecentChangeFactory
- T243186: entitysources: Client: adjust WikibaseClient::getStore
- T243187: entitysources: Client: adjust UpdateRepoHookHandlers::newFromGlobalState
- T243188: entitysources: Client: adjust UpdateSubscriptions::execute
- T243769: entitysources: DatabasePropertyTermStore and DatabaseItemTermStore should not perform any writes operations for items/properties from non-local source
A follow up to this task removing all of the stuff that this task replaces can be found at T241975: entitysources: Remove old MultiRepository & PerRepository Service containers and config