Skip to content

Instantly share code, notes, and snippets.

@grrowl
Created January 18, 2017 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grrowl/1cd891b8a08fd9e26034cff375296c85 to your computer and use it in GitHub Desktop.
Save grrowl/1cd891b8a08fd9e26034cff375296c85 to your computer and use it in GitHub Desktop.
  • when should this compacter run?
    • every n actions added (compactEvery)
    • when history is at n length (highWaterMark, compactAtLength)
  • can the function signal when it should?
    • run the compacter every time
    • needs a private state (below) or
    • getCompacter({ n, highwater }) => compactingDispatcher()

we can compactingReducer, basically searches the last 50 actions for "stop" or "compact irrelevant" actions as we go.

  • will this update the scuttlebut update history as well? probs not unless we tie scuttlebutt history into orderedHistory
  • what about a filter function, which might run in reverse to do the same, but can be called generically
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment