Conversation
4ee5f77 to
fa16091
Compare
|
|
||
| type LocationEpochId = int<locationEpochId> | ||
| and [<Measure>] locationEpochId | ||
| module LocationEpochId = |
There was a problem hiding this comment.
Any reason these parse/next/tostrings are not just member functions of the type?
There was a problem hiding this comment.
The 'type', being a type alias, only exists at compile time, so there's no type to augment as such
| | Some i when i.TotalHours >= 1. -> i.ToString "h\hmm\mss\s" | ||
| | Some i when i.TotalMinutes >= 1. -> i.ToString "m\mss\s" | ||
| | Some i -> i.ToString("s\.ff\s") | ||
| | Some i when i.TotalMinutes >= 1. -> i.ToString "m\mss\.f\s" |
There was a problem hiding this comment.
Generally these timestamps are represented as "m/mss/" with slashes going the other way. Is it the opposite way outside of the US? Or is this just escaping the character?
There was a problem hiding this comment.
escaping the char (this is a stray commit that shouldnt be here!)
|
|
||
| open Equinox.Cosmos | ||
| let resolve (context,cache) = | ||
| let cacheStrategy = CachingStrategy.SlidingWindow (cache, System.TimeSpan.FromMinutes 20.) |
There was a problem hiding this comment.
Why 20 minutes? Is this default? If so, can we make it explicit?
There was a problem hiding this comment.
generally, this should be something that makes sense in the context of the actual app - in many apps, where there's not a lot of state being computed, longer timespans may be perfectly appropriate (the 20m random number originally derives from interaction patterns for the Store's carts). The more significant factor is of course that the Cache has a max size, and stuff gets dropped in LRU order
|
Would each service have to implement a version of this to be able to consume these long running streams? |
|
This shows a protocol for having writers cooperatively write to a series with a long-running state. Typically you'd expect a given BC to encapsulate access to such streams from the write perspective. To manage reading, there are any number of ways of covering that, depending on need:
In both cases, you'd likely conceal the fact that the representation uses two categories internally to realize the implementation. |
|
Moving to jet/dotnet-templates#40 |
This PR illustrates an approach to deal with long-lived streams without having them actually be infinite, which involves:
LocationEpochwhich maintains a rolling balanceClosedevent, after which no writers are permitted to writeLocationSeriesaggregate which holds a pointer to verified active epoch (competing readers/writers read this optimistically on a cached basis; in the event that they're behind, they'll compete to log the successful commencement of a new epoch, which cannot happen before theCarriedForwardevent for the successor epoch has been committed)TODO:
🤔is tranche a better term for this than epoch?