datascript 2024-07-12

I’ve been looking through some of the storage protocol code and I’ve noticed that it seems like addr 1 is used exclusively for the tx-tail of a conn, is that right?

Just to double check, I’m assuming that if I only use my storage adapter with a db then I will never see anything other than addr 0 for the root, and addrs that correspond to eavt/aevt/avet btrees. My kv store would look like

0 | '{:schema ...}'
10000 | '...eavt'
10001 | '...aevt'
10002 | '...avet'
..... | '.......'
..... | '.......'
..... | '.......'
And if I were to use a conn, it would be structured roughly the same but I would potentially have another entry at addr 1 with a handful of pending (batched) transaction datoms?
0 | '{:schema ...}'
1 | [[[tx1 ...] [tx2 ...]] ...]
10000 | '...eavt'
10001 | '...aevt'
10002 | '...avet'
..... | '.......'
..... | '.......'
..... | '.......'

Something like that. But pls don’t rely on that, the idea is that we can use any addresses, it’s that just for now we only need 2 of them special

Thanks, I was testing both and got super confused when I didn’t get the same result.

yeah storing conn is better since it batches index changes until enough novelty is accumulated and you end up with less writes

1

> But pls don’t rely on that, the idea is that we can use any addresses, it’s that just for now we only need 2 of them special I’m curious if there are already additional special addrs you have in mind that might be needed?

not at the moment

at some point i was thinking of writing batches txs to separate keys

like 1…999 would be txes

when it overflows we update indexes

That is what I thought this was for originally.

but then decoded to just vector to the index 1 and update it with each tx

i don’t remember exact reason why I decided to go this way

It seems to me that if addrs mapped to txs then it would grow unbounded and you wouldn’t be able to keep them in the special addr section?

Not all txes, just the ones that haven’t been merged to the indexes

what tail is currently

Ah, that makes sense.