This is one of the most counter-intuitive APIs of the rdbms library. Some issues that comes to mind:
- ::getDBOptions() does both what to query (replica or primary) and how to query (query options). These are separate logical pieces.
- The method returns $options that would be fed into query builders or merged with existing options array. This is what we are trying to deprecate.
- Also the method returns DB_* constants which is also what we are trying to deprecate (passing around the constant)
- the same method provides fallback options when READ_LATEST_IMMUTABLE is provided, this is only used in one place and no more. Actually in place it actively removes this flag if it's provided by higher callers. Fallback options have been thrown away in all cases (but the sql blob store which I'm not even sure it really needs it).
- This is the weirdest to me: There is an interface that has these constants (IDBAccessObject), most classes using DBAccessObjectUtils implement the interface and call self:: on it. That is extremely confusing to a newcomer, not done in similar way in any other interface I know.
Proposed solution:
- Keep IDBAccessObject but just start calling the constants instead of classes implementing the interface.
- Get rid of the fallback logic, just copy-paste the logic to SqlBlobStore. And get rid of ::READ_LATEST_IMMUTABLE
- Create a new method ::getDBFromFlag combining getDBOptions and getDBFromIndex, taking a flag var and ICP and returning an IRDB.
- Add a method to SQB like ->lockingFlags() that would take the bitfield flag and set the locking options.
- Deprecate and remove ::getDBOptions and ::getDBFromIndex
- Document the decision and possibly use linting rules to enforce them.