const ( // StorageBucketScale determines the (exponential) spacing of storage buckets. // For example, a scale of 5s means that the second bucket will attempt to hold // a closed timestamp 5s in the past from the first, and the third 5*5=25s from // the first, etc. // // TODO(tschottdorf): it's straightforward to make this dynamic. It should track // the interval at which timestamps are closed out, ideally being a little shorter. // The effect of that would be that the most recent closed timestamp and the previous // one can be queried against separately. StorageBucketScale = 10 * time.Second )
Config is a container that holds references to all of the components required to set up a full closed timestamp subsystem.
A Container is a full closed timestamp subsystem along with the Config it was created from.
NewContainer initializes a Container from the given Config. The Container will need to be started separately, and will only be populated during Start().
However, its RegisterClosedTimestampServer method can only be called before the Container is started.
NoopContainer returns a Container for which all parts of the subsystem are mocked out. This is for usage in testing where there just needs to be a structure that stays out of the way.
The returned container will behave correctly. It will never allow any time- stamps to be closed out, so it never makes any promises; it doesn't use any locking and it does not consume any (nontrivial) resources.
RegisterClosedTimestampServer registers the Server contained in the container with gRPC.
Start starts the Container. The Stopper used to create the Container is in charge of stopping it.