Summary:
Now that the Haxl 2 diff has landed, I wanted to take the opportunity to reorganise the codebase.
I split parts of `Haxl.Core.Types` out into
* `Haxl.Core.Flags`, the `Flags` type and functions
* `Haxl.Core.DataSource`: the `DataSource` class and related stuff
and I split the massive `Haxl.Core.Monad` module into smaller modules:
* the base `Haxl.Core.Monad` with the types and instances
* `Haxl.Core.Fetch`: data-fetching functionality
* `Haxl.Core.Run`: the scheduler, and `runHaxl`
* `Haxl.Core.Profile`: profiling
* `Haxl.Core.Parallel`: `pAnd` and `pOr`
* I've also moved all the memoization support into `Haxl.Core.Memo`.
This commit also fixes the build on GHC 7.8.x, 7.10.x, and 8.2.x, all the Travis builds are green again.
Closes https://github.com/facebook/Haxl/pull/79
Reviewed By: zilberstein
Differential Revision: D6030246
Pulled By: simonmar
fbshipit-source-id: 5a0dc708cf72f8ed0906f1e99000976dbfbc89e2
Summary: This adds a "visual" representation of when fetches are being performed. This is an aproximate view (as in it will show a * if the fetch was running at that time interval)
Reviewed By: simonmar
Differential Revision: D6063841
fbshipit-source-id: 5841e0fca316689b9765688814308f19d28ffe95
Summary:
Profiling was pretty broken in Haxl 2, the ad-hoc testing I did hadn't
shown up the problems. Some labels lost a lot of allocations.
Reviewed By: zilberstein
Differential Revision: D6022568
fbshipit-source-id: cbbd16f7fb50d26e10299ab026c64ba04b9565e6
Summary:
In order to allow multiple Haxl datasources to share the same state key, I am adding a method to the typeclass that defines how to derive the TypeRep for a given State. The default implementation is identical to the current behavior, so all current datasources will continue to work as they did before, however it's now possible to share state between datasources:
```lang=haskell
data family MyRequest r a
data instance MyRequest X a where ...
data instance MyRequest Y a where ...
instance StateKey (MyRequest r) where
data State (MyRequest r) = MyState
getStateType _ = typeOf2 (undefined :: MyRequest r a)
```
Reviewed By: xich
Differential Revision: D5965165
fbshipit-source-id: 92f9e393c80bf4ae453d1ba20e3f35dd51c57933
Summary:
The problem was that we could lose the correct Env if a continuation
got blocked and restarted.
Reviewed By: niteria
Differential Revision: D5985280
fbshipit-source-id: f8afdb9d4db38781b33a8bddde46c031a133dec1
Summary:
This is a complete reworking of the way that Haxl schedules I/O. The
main benefits are:
* Data fetches are no longer organised into rounds, but can be
arbitrarily overlapped with each other and with computation. The
scheduler supports an arbitrary queue of work items which it can
evaluate while data-fetching is taking place in the background. To
take advantage of this, data sources must implement a new form of
`PerformFetch`, namely `BackgroundFetch`. The old forms of
`PerformFetch` are still supported, but won't benefit from any
additional concurrency.
* It is now possible to specify on a per-data-source basis whether
fetching should be optimised for batching or for latency. A request
to a data source that doesn't benefit from batching can be submitted
immediately. This is done with the new `schedulerHint` method of
`DataSource`.
Reviewed By: niteria
Differential Revision: D4938005
fbshipit-source-id: 96f12ad05ee62d62474ee4cc1215f19d0a6fcdf3
Summary:
Restricted version of cachedComputation, useful for abusing
memoization for mocking functions.
Reviewed By: niteria
Differential Revision: D5861480
fbshipit-source-id: c3978bb675e260591bb99b7dd2219775a9422907
Summary:
We need a release for GHC 8.2.1 compatibility:
https://github.com/facebook/Haxl/issues/70
(Note: this ignores all push blocking failures!)
Reviewed By: simonmar
Differential Revision: D5488485
fbshipit-source-id: 61ae115e7456beb1dd8855d387690e13a1e09bdc
Summary:
Build with eventlog is enabled was broken by refactoring, this should fix
it.
Reviewed By: xich
Differential Revision: D5410539
fbshipit-source-id: fd2dc97d9d853bcd6bc4b322c3995eec765227eb
Summary: Bump to a more recent stackage-lts
Reviewed By: niteria
Differential Revision: D5257292
fbshipit-source-id: 8f3aa86c699e6b91d55998d03dab0d0440993317
Summary: This provides a way to override test file locations for other build systems.
Reviewed By: yfeldblum
Differential Revision: D5218507
fbshipit-source-id: 7087ca13afb105b727ecf3f7dfdaecd26d27ea81
Summary:
It doesn't exist in GHC 8.2 and it appears that
Data.Typeable just works.
This should fix https://github.com/facebook/Haxl/issues/70.
Differential Revision: D5086644
fbshipit-source-id: e3e48ea7d603bbdf4fd78b4acd5125761ce799b2
Summary: text prior to 1.2.1.0 doesn't work because we need the Binary instance
Reviewed By: niteria
Differential Revision: D5027630
fbshipit-source-id: d6eeefb40a19ae2c0aaccaad868dc42ed4976ea5
Summary: Adds a simple `stack` file using the latest version of stackage.
Reviewed By: watashi
Differential Revision: D4843970
fbshipit-source-id: 938a16de769210661064157084f5eac42c7c0494
Summary:
- `binary-0.9` is accidental major jump and is now deprecated, I'm not sure what's best to do, cabal solver should pick `-0.8.x.y.` version
- `HUnit` and `time` changes do not affect use in haxl.
Closes https://github.com/facebook/Haxl/pull/68
Differential Revision: D4843906
Pulled By: JonCoens
fbshipit-source-id: b97c78e644a170745d7a29aab5c137e86f7018be
Summary:
These two operators are subtly non-deterministic, but can potentially
improve performance significantly in cases where
* We don't want to use .|| because it's too sequential
* We don't want to use || because it forces us to do wasted work
(and equivalently for &&).
The implementation is a bit subtle, see Note [tricky pOr/pAnd]
Reviewed By: xich
Differential Revision: D4611809
fbshipit-source-id: 832ace29dfc44e48c14cc5d4f52a0114ee326c92
Summary:
I didn't look into this too deeply but I'm guessing it was because the
constant expression had been lifted out, so I made it not a constant
expression.
Reviewed By: JonCoens
Differential Revision: D4521430
fbshipit-source-id: 687075d8486b38743b3bd8b9a9f26aa198b2d258
Summary:
If this goes ok, can we have a release?
Closes https://github.com/facebook/Haxl/pull/66
Reviewed By: simonmar
Differential Revision: D4409114
Pulled By: niteria
fbshipit-source-id: 6d6e88f1cf7b9ae2d851eaa86966f2eb417b4d7e
Summary:
Alternatively we could change dependency to `aeson-compat`, which has less major version bumps (because it has smaller public API surface, yet one have to be careful .e.g. not to rely on instance implementations).
Closes https://github.com/facebook/Haxl/pull/64
Differential Revision: D4385525
Pulled By: xich
fbshipit-source-id: 72246e0f9144728e618de7bfcf983531bd3d281a
Summary:
Include request in the uninitialized data source error so we will
know which request is not in cache or triggering this problem.
This will increase the size of error message, but in production
this should not happen as we should sanitize data source is
initizlied correctly.
Reviewed By: codemiller
Differential Revision: D4342674
fbshipit-source-id: ec3506285806e749dccade5ba5eb8cfdb25a5671
Summary: `GenHaxl` having an `NFData` instance is apparently a lie. Remove this functionality
Reviewed By: simonmar
Differential Revision: D3967290
fbshipit-source-id: 1da91dcd6470de0f911e8a29b86c4aa5d6c7301f
Summary: Some of the test files were not listed in haxl.cabal
Reviewed By: kuk0
Differential Revision: D3951346
fbshipit-source-id: 8e6677a728acde3713c618a6383b2de510b1ac86
Summary: Having an NFData instance allows forcing calls that return a Haxl computation to run.
Reviewed By: xich
Differential Revision: D3906781
fbshipit-source-id: e49448152695383031af6d315a20dbcd1c10720c
Summary:
Labels which throw Haxl exceptions are recorded, but pure exceptions bubble up
and labels are lost. This test demonstrates this.
Reviewed By: simonmar
Differential Revision: D3672479
fbshipit-source-id: fab10878e7eb067e0c65bcf401d75604c333007f
Summary: Prior to GHC 7.10, <$> was not in the prelude, so requires an explicit import.
Reviewed By: watashi
Differential Revision: D3656379
fbshipit-source-id: 43925bc9c483ee712b04976d6fa6cb6b9d9b998e
Summary:
The 7.8 build keeps breaking, but no one notices until someone opens an issue.
With the travis badge, breakage will at least be visible from the github
landing page for Haxl repo.
Reviewed By: zilberstein
Differential Revision: D3656468
fbshipit-source-id: 5537ab78b9dd44a5a3f07e7e3db7f73ec959f096
Summary: Expose MiddleException because the `eName` function is useful.
Reviewed By: watashi
Differential Revision: D3635507
fbshipit-source-id: bec3fac0b4f7c009c57d14857d46576ffc5ab826
Summary:
This revision generalizes the existing memoization framework to 1-ary and 2-ary
functions (namely functions of type (a -> GenHaxl u b) and (a -> b _> GenHaxl u c)).
For every support arity (currently 0, 1, and 2), a family of functions {
newMemoWithX, prepareMemoX and runMemoX } are provided. newMemo itself is
generic across all arities.
Reviewed By: simonmar
Differential Revision: D3555791
fbshipit-source-id: 010a9889d42327607c8b03a5f7a609ee0c70de49