The one we never shipped, where we built a distributed graph database with a built-in compute fabric using event sourcing and immutable delta CRDTs.

The value is in what it taught me, from writing a binary format to wrangling Hadoop to how products can fail.
What if you wrote a database that didn't store state? What if you only tracked changes, via append-only logs of (hypernode) events carrying relational data between different nodes in your hypergraph?
What if state could be derived at any time from those changes? So you could pre-populate a downstream SQL database by parsing the changes and turning them into SQL writes. You could group events by target for quicker queries.
If your database is a giant relational pool of delta events, every response to every query from your database is a subset of that pool. This leads to interesting architectural capabilities - Datomic was just coming out when we were building this, doing some similar stuff.
We had so many cool features. We could dynamically generate JSON representations of complex graphs in response to incredibly complex graph queries.

But my favorite part of this whole thing was that when you pointed to a node, it received a notification. Which means...
We had nodes that were functions. You could invoke a function by creating a new "instance" of it and then connecting, via a graph, other nodes to its argument input edges. Then you could bind other functions etc to its output edges.

And the function itself returns delta events.
So we did this by reserving the last 4 bits in the GUID for a "node type" key. 1 was a regular node, 2 was a hypernode, 3 was a "negate" node, etc. 4 was an "input" node, meaning "treat this as function input"

Which is how we implemented queries. They were delta events too.
Realizing this made us realize that wait, we can think of our whole database as a function. Deltas are its inputs, and its default implementation is persistence and indexing. But by overriding the default behavior we generalized what it meant to "write to the database".
friends I _hand-wrote_ a binary protocol for this, because we didn't want to use protobuf as it was too new and we wanted a bit more control over a few things.

I hand-wrote and hand-optimized a binary protocol for a graph database. I did that. That was so fun and hard!
Because I wrote the binary protocol, I was also able to write a custom compression engine for it. We got it to the point where only the bits necessary for each level of abstraction were written. All events are in a tx, part of its guid is the tx guid. So factor that out on write.
I'll never forget the day my old coworker had a bug, and I asked him to open his console and then eyeballed a few lines of hex data to understand where the bug was. I don't think anyone has ever looked at me more like I'm a wizard.
the core insight for this whole thing, btw, is in the event delta schema, which I'm not going to publish here because I didn't come up with it. I inherited it from boss, who spent a decade trying to build this system. I'm technically still under NDA, I think, tho company is gone.
What I will ONE DAY DO, however, is publish my own version of this system using my own schema, which is heavily informed by the one we used but which makes a few different assumptions in pursuit of a few different goals.
Maybe the best way to think of this is: picture Redux, but without custom reducers because the actions themselves work with a general-case reducer to build a single giant easily-queriable store from which you can trivially query and cache stateful objects. cc @dan_abramov
(using Hadoop at the time we were horizontally scalable beyond the needs of a Fortune Ten company that hired us to do a proof of concept where we consumed all of their conflicting upstream databases, resolved the conflicts and served an always-fresh SQL interface for latest data)
The thing is, this was _ten years ago_ and nobody I tried to talk to about it understood it. "Why don't you just use {SQL/Mongo}?" was a common refrain.

This is a new _kind_ of database, which is actually a compute fabric, with a full stream computing engine built into it.
(And did I mention that this was a _fully relational NoSQL_ according to Codd's Relational Algebra?! People didn't even understand what that meant. Hell WE didn't fully understand what that meant, but my boss saw it all in a crystal clear vision I came to grok.)
BTW when I say we had nodes that were functions, I mean you could define a thing and say "language: javascript, behavior: function(input_deltas) { ... return output_deltas }" and it would find a worker instance with javascript to run your string of code against the input.
You want to update your function's behavior? No sweat, just point to a new behavior. Everything is immutable so you lose nothing, but you could e.g. re-run yesterday's query as if you had used a different function, or whatever.
(Oh, right -- we didn't resolve conflicts of any sort. If you said Foo == 42 and I say Foo == 21, anyone querying the system for the value of Foo gets "Myk says it's 21, so-and-so says it's 42, which value would you like to use? Or we can average them, take the latest, etc")
All writes had full provenance, so you know what user generated the delta, you know what system they're on, etc. That's all in the metadata of the delta.

You can share deltas, btw, between systems. Two instances that have never met can handshake and exchange schemas and nodes.
What I didn't realize until almost a decade after I left this company was that my real passion in this work had been metaphysical in nature.

This was a model of reality that worked for me, and I could see reality as a hypergraph of deltas over time -- each of us as a local cache
Things possible with our database:

"Run this query as if it were last week"

"Run this query as if you were Myk. Run again as Dan. Return the intersecting deltas after applying this schema to them."

"Send the results of this query to my friend Sarah's database."
Because the deltas are so fine-grained, this effectively gives you _cell-level_ access control on a derived tabular view of your data.

Or it lets you serialize all of your deltas directly into a JSON store for your front end.

Or cache important personal data on a private device

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with your friend myk

your friend myk Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @mykola

29 Jun
ME is one of the most debilitating conditions you've probably never heard of. Learn this today:

Most people with ME consider the CFS part to be dismissive and outdated. "Chronic Fatigue Syndrome" is such a misleading term that the doctor who coined it later apologized. #pwme
ME has always been with us -- some people, after they get a virus or have certain other kinds of trauma, experience ongoing symptoms that disable them for the rest of their lives.

During pandemics, we see waves of ME sweep across populations. Lots of #LongCovid patients have it.
But here's the catch: despite 9000 different biomedical findings in ME patients and despite ME being classified as a neuroimmune condition, there are still tons of doctors who treat it is as psychosomatic. Why?
Read 8 tweets
26 Jun
This is a good question, what’s the difference between masking and simply using social skills that are maybe harder to learn?

Masking to me involves fear - a fear of being perceived as a fraud, a poser behind social skills, maybe? There’s an edge.
I’m having Interesting Thoughts based on some excellent replies.

What if what we call masking is a response to dealing with shame, and autistic people mask so much because we are taught to literally be ashamed of who we are?

Everyone masks a little, maybe. But we hide so much.
My advice to people who want to stop masking has long been “your shame is a map to those parts of yourself you were taught to hate, and so need more love.”

What if it IS that simple? Autistic trauma leads to toxic shame leads to masking.
Read 11 tweets
17 Jun
There's this old show Northern Exposure about this arrogant young doctor who just graduated med school and has to go work in Alaska to pay off his debt, and it's an ensemble cast about a quirky small town, and it's a lot of fun.
As I take my meds this morning I'm particularly reminded of an episode featuring "Chris In The Morning", the local radio DJ who plays esoteric tracks and rambles philosophical musings onto the airwaves every day. Totally lovable dude, turns 40 and gets super sad.
"It's just, I love life so much and I'm sad that I have to die soon. All the men in my family die in their early 40s."

And the doctor is like, dude, you just have high blood pressure. You can take pills for that and live a full life.
Read 4 tweets
16 Jun
My god is it Bloomsday already?

James Joyce #wasNotNeurotypical. I read him and his stand-in character Stephan Daedalus both as autistic+adhd.

His daughter was almost certainly autistic before we had words for it.

I need to write this paper.
"A Portrait of the Artist as a Young Man" is a story of a kid who grows up as an outsider to his own culture. He is constantly seeking to understand what makes him unique, what makes him not fit - religion? values? He sets off to find himself.

Short answer: he's ND, without dx.
When he comes back to Ireland a few years later as a young man in Ulysses he's just as alienated, he's living in his own head.

The book gives him three chapters of attention and then sort of restarts with a different protagonist.
Read 8 tweets
11 May
A hundred years ago the modernist era in literature was thriving.

The entire social order of western civilization had just been burned away in a senseless war. Identity had to be created from scratch. You couldn’t just go on being the person you’d been, the world had ended!
Writers like Virginia Woolf and James Joyce and Ford Madox Ford took as their themes this deep into identity, but crucially into identity as defined in opposition or contrast to society at large.

Put bluntly: these people wrote about ND experiences suddenly being valid.
Here in 2021 we are in a similar cultural moment. The old world, where media decides truth, is over. We’re in a post-truth postmodern future, and we are once again in a place where identity itself is broken.
Read 8 tweets
10 May
You know, reflecting on how I used to feel before I knew I was autistic and had reasonable but different limits, I think about how often I felt like "I don't want to do X" but did it anyway.

And I think about how "I don't want to" is a box that could hold one of many things.
Now it's never "I don't want to X", it's often "I don't have the energy for X" or "I'd prefer not to have to do X if Y is going to be there" or "Doing X is really loud and therefore painful".

And how before I started getting to know myself I just thought I didn't want to do X.
I used to think "I don't feel good" or "I feel good". Now I think "I'm proud of the work I did today but bothered by my friend's comment and a little bit anxious about that family thing next weekend" etc.

These things can be learned - it's just sometimes we don't learn them.
Read 8 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(