Originally posted by @miparnisari in #2859 (review)
We've seen two instances (one: #2636, the other caught in a PR #2859) where a server flag wasn't passed down properly to the datastore's implementation of the server method being called.
this is because the process of passing down a flag involves too many changes and it is VERY to miss a step.
i think a refactor is due.
proposal for Watch:
- split
datastore.WatchOptions struct to ServerWatchOptions and ClientWatchOptions
- add a new
datastore.WatchOptionsDefaults interface method that must be overriden per datastore
- introduce a common fn
merge(serverOptions, defaultDsOptions, clientWatchOptions) -> ClientAndServerOptions. also, serverWatchOptions are the same no matter the datastore, so they don't need to live in the cds or memdb implementations, they could live inside watchServer,
- have
server.Watch() call the merge function
- then we change the
datastore.Watch interface to take ClientAndServerOptions
This proposal could later be extended to other APIs.
Originally posted by @miparnisari in #2859 (review)
We've seen two instances (one: #2636, the other caught in a PR #2859) where a server flag wasn't passed down properly to the datastore's implementation of the server method being called.
this is because the process of passing down a flag involves too many changes and it is VERY to miss a step.
i think a refactor is due.
proposal for Watch:
datastore.WatchOptionsstruct toServerWatchOptionsandClientWatchOptionsdatastore.WatchOptionsDefaultsinterface method that must be overriden per datastoremerge(serverOptions, defaultDsOptions, clientWatchOptions) -> ClientAndServerOptions. also,serverWatchOptionsare the same no matter the datastore, so they don't need to live in thecdsormemdbimplementations, they could live insidewatchServer,server.Watch()call the merge functiondatastore.Watchinterface to takeClientAndServerOptionsThis proposal could later be extended to other APIs.