aatree

https://github.com/aatree
micha 2015-12-20T03:05:38.000010Z

hello aatree world

micha 2015-12-20T03:32:36.000011Z

is there an example application that uses aatree? or rather calf etc

2015-12-20T03:35:32.000012Z

Yeah, look in the test files.

2015-12-20T03:36:25.000013Z

You want to look at yearling. this is the database that builds over virtual aatree structures. An OODBMS for EDN. :simple_smile:

2015-12-20T03:37:03.000014Z

@micha Thanks for asking.

micha 2015-12-20T03:37:04.000015Z

this is something i have been looking for for a long time

2015-12-20T03:38:47.000016Z

Using the Datomic analogy, I want the hoplon clients to be the peers with their own caches and 80% of the database code running in the client. Unfortunately, it is the 80% that has not yet been converted from java.

micha 2015-12-20T03:38:58.000017Z

dude yes

micha 2015-12-20T03:39:13.000018Z

so can i ask a sort of general kind of question?

micha 2015-12-20T03:39:25.000019Z

maybe off topic

2015-12-20T03:40:25.000020Z

of course

micha 2015-12-20T03:40:32.000021Z

it seems to me that we use relational databases to store our application state only because storing only facts in sorted sets achieves the laziness, like you don't need to fetch an entire tree or sequence of things from storage to perform a query

micha 2015-12-20T03:41:01.000022Z

but in all other ways relational databases are terrible, because you need to build your trees and maps and whatnot via joins

2015-12-20T03:41:09.000023Z

Even my sequences are indexed! :simple_smile:

micha 2015-12-20T03:41:12.000024Z

and the semantic of the join cannot exist in the database itself

micha 2015-12-20T03:41:21.000025Z

it's just something you have in your head

micha 2015-12-20T03:41:39.000026Z

so people make orms as a way to form abstractions that encompass the joins

2015-12-20T03:42:10.000027Z

My db is very close to datomic, with the same indexes and everything. (my java db, not what I have in clojure so far)

2015-12-20T03:42:33.000028Z

My starting point was to build a db for semantic relationships.

2015-12-20T03:42:49.000029Z

A knowledge db, rather than a data db.

micha 2015-12-20T03:43:13.000030Z

what's the distinction?

2015-12-20T03:43:46.000031Z

everything is about entities, attributes, values and time.

2015-12-20T03:43:53.000032Z

knowledge exists in time.

2015-12-20T03:44:21.000033Z

attributes are dynamic

2015-12-20T03:44:53.000034Z

attributes are largely used to define relationships between entities.

2015-12-20T03:45:10.000035Z

So it can be viewed as a graph database too.

micha 2015-12-20T03:45:30.000036Z

do you do extra indexing of the graph edges?

2015-12-20T03:45:33.000037Z

Dealing with knowledge always seems to require multiple perspectives.

2015-12-20T03:45:52.000038Z

nothing more in that area than datomic.

2015-12-20T03:46:00.000039Z

but I keep a lot more metadata!

micha 2015-12-20T03:46:19.000040Z

alan and i experimented with building a thing on top of datomic

micha 2015-12-20T03:46:25.000041Z

to store clojure data

2015-12-20T03:46:31.000042Z

i.e. relationships are also entities!

micha 2015-12-20T03:46:51.000043Z

we ran into the need to run our own indexes of which refs point where

micha 2015-12-20T03:46:55.000044Z

and stopped

2015-12-20T03:47:01.000045Z

Datomic makes it difficult to deal with changes over time, though I think it can still be done.

2015-12-20T03:47:53.000046Z

I'm doing the reverse. First implement virtual clojure data. Then add support for changes over time. Then build the indexes on top of that.

2015-12-20T03:48:27.000047Z

This gives me a rich mix. I can have some things that are not tracked over time, for example.

micha 2015-12-20T03:49:06.000048Z

we had a specific problem at hand

micha 2015-12-20T03:49:14.000049Z

and we had a datomic license so we thought why not

2015-12-20T03:49:29.000050Z

sounds like a lot of fun

micha 2015-12-20T03:49:34.000051Z

the problem was this huge php application that we needed to debug in production

2015-12-20T03:49:44.000052Z

OUCH!

micha 2015-12-20T03:49:46.000053Z

legacy code, 250K lines of it

micha 2015-12-20T03:49:59.000054Z

so we wanted to log data to datomic

2015-12-20T03:50:09.000055Z

wild

micha 2015-12-20T03:50:12.000056Z

so we could get a historical view of the data

micha 2015-12-20T03:50:22.000057Z

and automate as much as possible

micha 2015-12-20T03:50:32.000058Z

so we made entities for all the types

micha 2015-12-20T03:50:46.000059Z

and had a system for interning them

micha 2015-12-20T03:50:55.000060Z

and making refs to build the things

2015-12-20T03:51:04.000061Z

relationships should also be entities.

micha 2015-12-20T03:51:13.000062Z

ah interesting!

micha 2015-12-20T03:51:27.000063Z

we couldn't avoid following refs in code

2015-12-20T03:51:33.000064Z

gives you the edges. :simple_smile:

micha 2015-12-20T03:51:37.000065Z

this would allow you to avoid that

2015-12-20T03:52:54.000066Z

Now I am very excited about doing the om next thing, but with haplon and my own db. And put the application code in the browser!

micha 2015-12-20T03:52:55.000067Z

do you think you'll be able to write a "peer" that can run in a browser?

2015-12-20T03:53:02.000068Z

why not?

micha 2015-12-20T03:53:10.000069Z

i know datomic can't do it

2015-12-20T03:53:20.000070Z

it just needs to keep a cache.

micha 2015-12-20T03:53:34.000071Z

browsers don't have a big cache

2015-12-20T03:53:39.000072Z

but my transactor/storage IS the web server.

micha 2015-12-20T03:53:43.000073Z

you can count on maybe 5M

2015-12-20T03:53:49.000074Z

And it has the big cache.

2015-12-20T03:53:56.000075Z

the client just needs a little.

micha 2015-12-20T03:54:17.000076Z

this would be the final piece of the puzzle

2015-12-20T03:54:40.000077Z

a mobile client is very focused so it does not need a lot of cache

2015-12-20T03:54:52.000078Z

--small working set

micha 2015-12-20T03:55:06.000079Z

right now the thing that takes our dev time is incidental complexity involved with shuffling things in and out of memory in the client, making ajax requests etc

micha 2015-12-20T03:55:18.000080Z

it's like a virus infecting all your abstractions

micha 2015-12-20T03:55:26.000081Z

becaue you can't keep a reference to anything

2015-12-20T03:55:34.000082Z

I am a systems dev, not an app dev.

2015-12-20T03:55:46.000083Z

so my approach is a tad different

2015-12-20T03:56:23.000084Z

you can keep entity names, attribute names, times.

micha 2015-12-20T03:56:33.000085Z

in the client?

2015-12-20T03:56:58.000086Z

yes. some of them would be constants for a given app.

2015-12-20T03:57:36.000087Z

I did access control. So users can have a private part of the database for managing their apps.

2015-12-20T03:58:10.000088Z

And it would all exist virtually in the mobile. 😄

micha 2015-12-20T03:58:12.000089Z

or an application on the server that prunes the tree, making a view basically

2015-12-20T03:58:24.000090Z

why?

micha 2015-12-20T03:58:24.000091Z

like a proxy between the client and db

2015-12-20T03:58:38.000092Z

Put the app logic in the mobile, except for updates!

micha 2015-12-20T03:58:46.000093Z

interesting

micha 2015-12-20T03:59:14.000094Z

this is the cqrs approach

micha 2015-12-20T03:59:21.000095Z

which is A+

2015-12-20T03:59:31.000096Z

And even updates on the server would be generic and access controlled. So it is really all on the mobile. the logic anyway. most of the logic is data that can be moved anywhere.

micha 2015-12-20T04:00:06.000097Z

have you seen castra by the way?

2015-12-20T04:00:20.000098Z

Needless to say, I need to build a team to do all this. I am just happy that clojure is denser than java.

2015-12-20T04:00:46.000099Z

I updated castra chat today and put it in my github repository.

micha 2015-12-20T04:00:53.000100Z

oh right, derp

2015-12-20T04:01:02.000101Z

--rebuilt it on top of the new templates.

2015-12-20T04:01:20.000102Z

I dug into the default app. Tomorrow I do chat.

micha 2015-12-20T04:01:41.000103Z

so is the aatree interface very different than that?

micha 2015-12-20T04:01:54.000104Z

i mean just the interface between server and client

micha 2015-12-20T04:02:17.000105Z

i.e. you have opaque functions you can call to update the state

2015-12-20T04:02:31.000106Z

aatree is missing a layer--the entitys/attributes/values and indexes are all built on top.

micha 2015-12-20T04:02:32.000107Z

and a repository of state that may change from time to time

2015-12-20T04:02:51.000108Z

But at least what I have is persistent.

2015-12-20T04:03:05.000109Z

yeah I have that much

2015-12-20T04:03:17.000110Z

but I still need to add logging among other things.

micha 2015-12-20T04:03:17.000111Z

i mean you know, in your vision

2015-12-20T04:03:28.000112Z

always been there, yes

micha 2015-12-20T04:04:13.000113Z

i will clone the repo and see how far i can get with the tests

micha 2015-12-20T04:04:59.000114Z

i would enjoy learning about how databases work

2015-12-20T04:05:13.000115Z

With hoplon methinks I need to add subscriptions to notifications soon. To allow clients to maintain a cache. 😄

micha 2015-12-20T04:05:45.000116Z

here is a thing i ran into in the app i'm working on now

micha 2015-12-20T04:05:51.000117Z

it's a real puzzle

micha 2015-12-20T04:06:10.000118Z

at adzerk we have a pretty good api, and people can use it to create a lot of a thing

micha 2015-12-20T04:06:28.000119Z

like if someone wants to make 100k ads that's ok with us

micha 2015-12-20T04:06:44.000120Z

so the ui has to deal with that

micha 2015-12-20T04:06:49.000121Z

which is a really interesting problem

2015-12-20T04:06:50.000122Z

ok

micha 2015-12-20T04:07:02.000123Z

consider a simple dropdown menu

2015-12-20T04:07:10.000124Z

so you had to introduce some abstractions, hmm?

micha 2015-12-20T04:07:26.000125Z

we have these things called channels, and those have many priorities

2015-12-20T04:07:58.000126Z

I've always had forward and reverse pagination for all the query results in my ui.

micha 2015-12-20T04:08:11.000127Z

yeah but you can't paginate a tree

micha 2015-12-20T04:08:20.000128Z

i mean not in a nice way

2015-12-20T04:08:25.000129Z

:simple_smile:

2015-12-20T04:09:00.000130Z

you have trees that get large?

micha 2015-12-20T04:09:05.000131Z

huge yes

micha 2015-12-20T04:09:16.000132Z

our solution was to split it into two parts

micha 2015-12-20T04:09:29.000133Z

the channel and the priority as separate typeahead widgets

micha 2015-12-20T04:09:37.000134Z

but one is dependent on the other

2015-12-20T04:09:48.000135Z

so something of a matrix view

micha 2015-12-20T04:09:57.000136Z

well it's a tree

2015-12-20T04:09:59.000137Z

or matrix selection actually

micha 2015-12-20T04:10:05.000138Z

but you can't keep the tree in memory

2015-12-20T04:10:11.000139Z

a partitioned tree?

micha 2015-12-20T04:10:19.000140Z

so if you want to validate that the priority really belongs to the channel, you can't

micha 2015-12-20T04:10:51.000141Z

i mean you can, but you need to make a call to the backend to fetch the part of the tree where it lives

2015-12-20T04:10:59.000142Z

sounds like you really want vm

micha 2015-12-20T04:11:05.000143Z

vm?

2015-12-20T04:11:10.000144Z

virtual memory

micha 2015-12-20T04:11:12.000145Z

oh right

micha 2015-12-20T04:11:14.000146Z

yes

2015-12-20T04:11:17.000147Z

or virtual tree structures

2015-12-20T04:11:20.000148Z

😄

micha 2015-12-20T04:11:24.000149Z

it seems like aatree aims to provide this?

2015-12-20T04:11:35.000150Z

already does in yearling

2015-12-20T04:11:48.000151Z

it just needs a whole lot of love

2015-12-20T04:12:23.000152Z

but as it stands, it ONLY supports trees!

2015-12-20T04:12:37.000153Z

graphs come in the next layer

micha 2015-12-20T04:12:38.000154Z

haha that's all we need in lispland

2015-12-20T04:12:50.000155Z

well enjoy then

2015-12-20T04:13:06.000156Z

If you like it, I can provide support.

2015-12-20T04:13:23.000157Z

--I am not expensive when it comes to working on my own stuff!!!

2015-12-20T04:13:35.000158Z

Or I can just help you learn it.

2015-12-20T04:13:42.000159Z

--no charge

2015-12-20T04:13:58.000160Z

I am full time on this

micha 2015-12-20T04:14:26.000161Z

i would enjoy helping out wherever i can

2015-12-20T04:14:34.000162Z

cool

micha 2015-12-20T04:14:45.000163Z

maybe i could help with the hoplon stuff :simple_smile:

2015-12-20T04:14:55.000164Z

fer sure!

micha 2015-12-20T04:15:40.000165Z

is it a goal of the project to eventually support many peers?

micha 2015-12-20T04:15:53.000166Z

and large datasets?

micha 2015-12-20T04:16:00.000167Z

i mean reasonably large

micha 2015-12-20T04:16:30.000168Z

i guess i meant to ask about the intended use

2015-12-20T04:16:30.000169Z

I've added you as a collaborator

2015-12-20T04:16:52.000170Z

it depends on the interests of the team we need to put together.

2015-12-20T04:17:09.000171Z

I want to restrict initial use to 1TB on a single host.

micha 2015-12-20T04:17:36.000172Z

cool, that's reasonably large :simple_smile:

2015-12-20T04:18:35.000173Z

Once we have a reasonable team, we can fork out in different directions. With developers contributing to multiple forks. One size, after all, does not fit all. I think that is necessary to achieve real scale.

2015-12-20T04:19:38.000174Z

My basic design for the dbs is composits of bags. keeps things flexible. A VERY open architecture!

micha 2015-12-20T04:20:40.000175Z

a lot of documentation here

2015-12-20T04:22:04.000176Z

I hate docstrings. Of all the code, docstrings are the most difficult to refactor.

2015-12-20T04:22:30.000177Z

There are at least tools for updating variable names!

micha 2015-12-20T04:22:55.000178Z

hahah

2015-12-20T04:23:12.000179Z

Documents, on the other hand, are allowed to be a bit more abstract so they do not need to be constantly updated.

micha 2015-12-20T04:23:39.000180Z

i'm going to make a thing tomorrow that will let me generate markdown api docs

micha 2015-12-20T04:23:45.000181Z

for boot

2015-12-20T04:23:54.000182Z

Super!

micha 2015-12-20T04:24:03.000183Z

docstrings are nice there because you can attach them to vars

2015-12-20T04:24:11.000184Z

ok

2015-12-20T04:24:28.000185Z

and it is a good time. things are getting more stable

micha 2015-12-20T04:24:53.000186Z

boot has a ton of functions in the api

2015-12-20T04:25:11.000187Z

I'm sure

micha 2015-12-20T04:25:17.000188Z

so it seems like it's finally necessary to generate api docs

2015-12-20T04:25:47.000189Z

but don't let it get like lein--which has more issues than the next 100 most popular projects combined.

micha 2015-12-20T04:25:51.000190Z

i don't like the things that generate html because while it might look fancy, it's harder to version with the code

micha 2015-12-20T04:26:19.000191Z

yeah i mean boot is different than lein, because it's just a library really

micha 2015-12-20T04:26:37.000192Z

a collection of functiona and macros you can use to make a build program

2015-12-20T04:26:49.000193Z

with javadocs I always turned off the timestamps so versioning would be more reasonable.

micha 2015-12-20T04:27:25.000194Z

yeah i was thinking i'd generate the api docs as a precommit hook

micha 2015-12-20T04:27:40.000195Z

so you can go to a branch or a tag in github and see api docs for that commit

2015-12-20T04:28:00.000196Z

wild

micha 2015-12-20T04:28:01.000197Z

the docs would be committed in the repo of course

micha 2015-12-20T04:28:37.000198Z

i guess then you could even git diff the api docs and see a changelog

micha 2015-12-20T04:28:39.000199Z

heh

2015-12-20T04:29:07.000200Z

I wasted a lot of space in the past as I included a copy of the javadocs in each release.

micha 2015-12-20T04:29:27.000201Z

clojure is much better for docs

micha 2015-12-20T04:29:39.000202Z

with java you really need all the hyperlinks and frames and whatnot

2015-12-20T04:29:51.000203Z

yeah 😞

micha 2015-12-20T04:29:51.000204Z

because you have hundreds of classes in various packages

2015-12-20T04:30:00.000205Z

tell me about it!

2015-12-20T04:30:12.000206Z

I got so tired of it all

micha 2015-12-20T04:30:21.000207Z

yeah it makes me angry

micha 2015-12-20T04:30:30.000208Z

like honestly angry

2015-12-20T04:30:32.000209Z

I am happy with clojure

micha 2015-12-20T04:30:43.000210Z

clojure is great!

2015-12-20T04:30:49.000211Z

and excited about all the doors hoplon can open for me

micha 2015-12-20T04:31:15.000212Z

i've been obsessed with making web apps for a while now

2015-12-20T04:31:21.000213Z

Using pure clojure script would be much harder than .hl.

micha 2015-12-20T04:31:28.000214Z

because it seems so simple, like too simple to even be computer science

micha 2015-12-20T04:31:42.000215Z

but look at any real project, most of the work is wasted on trying to get a ui working

2015-12-20T04:32:25.000216Z

so lets close the loop and give the client in the browser access to the virtual data structures.

micha 2015-12-20T04:32:34.000217Z

yeah that's the missing part

micha 2015-12-20T04:33:00.000218Z

also i have been trying to design a sort of "state machine zoo"

micha 2015-12-20T04:33:22.000219Z

a way to form abstractions around distributed systems problems you encounter in the client

2015-12-20T04:33:24.000220Z

I am impressed with no-virtual-dom reactive web--so light weight!

2015-12-20T04:33:52.000221Z

I think we will have a lot of fun

2015-12-20T04:34:04.000222Z

complimentary strengths and all that

micha 2015-12-20T04:34:05.000223Z

by expressing them as a combination of datastructures stored on some persisted storage and the state machines that mediate access and modification of them

micha 2015-12-20T04:34:28.000224Z

like submitting a form in a web page

micha 2015-12-20T04:34:44.000225Z

that's really part of a state machine that is manipulating some data structure

micha 2015-12-20T04:34:53.000226Z

and the semantics of retries, failure modes, etc

2015-12-20T04:35:04.000227Z

I did some distributed stuff. Once you get the basics down, it is pretty simple. Just a tad subtle. Quarm logic on the bottom is key.

micha 2015-12-20T04:35:38.000228Z

i have this feeling that there are a relatively small number of state machines that can describe any kind of distributed system interaction

2015-12-20T04:35:51.000229Z

And google has done some good work in this area.

micha 2015-12-20T04:36:24.000230Z

what i'm specifically interested in is developing a set of abstractions that clearly define the tradeoffs involved

2015-12-20T04:36:44.000231Z

better to say that there are a relatively small number of state machines that can be used to describe any kind of distributed interaction. I.E. You only need a few.

micha 2015-12-20T04:37:19.000232Z

the key thing is to clearly delinieate the tradeoffs and ensure correctness within the constraints of those

micha 2015-12-20T04:37:58.000233Z

it would be great if anyone could use these in a simple and easy to understand way

2015-12-20T04:37:58.000234Z

But for the foreseeable future I plan to focus on plain old client server. Too much stuff left to migrate from Java.

2015-12-20T04:38:21.000235Z

Yes. Constraints are what it is all about.

micha 2015-12-20T04:38:46.000236Z

clojure is the inspiration, with the stm

2015-12-20T04:38:46.000237Z

Most developers chaff against them, but really they are enablers.

2015-12-20T04:39:04.000238Z

not a big fan of stm personally.

micha 2015-12-20T04:39:04.000239Z

rich devised a set of state machines

micha 2015-12-20T04:39:19.000240Z

and the tradeoffs and semantics are clearly defined

2015-12-20T04:39:24.000241Z

but perhaps I just haven't gotten there yet.

2015-12-20T04:39:31.000242Z

cool

micha 2015-12-20T04:39:33.000243Z

i mean the architecture of it

2015-12-20T04:39:56.000244Z

I agree with 90% of what the guy says.

micha 2015-12-20T04:39:57.000245Z

everything in clojure is immutable, but some things can be altered

2015-12-20T04:40:04.000246Z

😄

micha 2015-12-20T04:40:17.000247Z

but anything that can be altered can only be altered via a well defined state machine

micha 2015-12-20T04:40:33.000248Z

i.e. anything alterable can have watches added to it

2015-12-20T04:40:37.000249Z

yes, that is beauty!

micha 2015-12-20T04:40:57.000250Z

this is what i envision for distributed systems sort of

2015-12-20T04:40:59.000251Z

I want to add watches to yearling.

2015-12-20T04:41:39.000252Z

subscription would be key vectors a la assoc-in.

2015-12-20T04:41:59.000253Z

Which then get tied to haplon cells.

2015-12-20T04:43:07.000254Z

events would be deleted and updated.

2015-12-20T04:43:22.000255Z

deleted event would also unsubscribe

micha 2015-12-20T04:43:40.000256Z

this sounds like exactly what i want to work on also

2015-12-20T04:43:56.000257Z

interesting

micha 2015-12-20T04:44:28.000258Z

i had a wacky idea for subscriptions with hoplon and datomic

micha 2015-12-20T04:44:47.000259Z

a pull-based subscription

micha 2015-12-20T04:45:01.000260Z

because reads in datomic are almost free, you can spin on the server

2015-12-20T04:45:05.000261Z

my guess is that most of what I need to learn is in the castra-chat demo

micha 2015-12-20T04:45:42.000262Z

i'll add docs

micha 2015-12-20T04:45:49.000263Z

it's time :simple_smile:

2015-12-20T04:46:12.000264Z

I think there is a place in my virtual aatree structure where I can generate change notifications.

2015-12-20T04:46:57.000265Z

I'm gona call it a night. I must say, these discussions keep getting more interesting!

micha 2015-12-20T04:49:02.000266Z

see you later!